With the Home Assistant API, you can build a variety of things, including:
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
home_assistant: {
type: "app",
app: "home_assistant",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://${this.home_assistant.$auth.hostname}/api`,
headers: {
Authorization: `Bearer ${this.home_assistant.$auth.token}`,
"Content-Type": `application/json`,
},
})
},
})
Home Assistant uses API keys for authentication. When you connect your Home Assistant account, Pipedream securely stores the keys so you can easily authenticate to Home Assistant APIs in both code and no-code steps.
All API calls have to be accompanied by the header Authorization: Bearer ABCDEFGH
, where ABCDEFGH
is replaced by your token. You can obtain a token by going to your profile. For hostname, the default would be IP_ADDRESS:8123
but user-configured values such as home.family.network:8824
can also work.