I made a PowerShell modulefor Home-Assistant

I know I’m not the first to use the Home-Assistant API in PowerShell, and the project is based on this post.

Anyway, I made this Module (or collection of functions) last year and published it yesterday on GitHub, the point is to interact with Home-Assistant from PowerShell, I think this can be useful. I am open to suggestions, requests and changes

Here is the guthub page:

Current functions and parameters:

  Get-HomeAssistantConfig
  Get-HomeAssistantEntity
  Get-HomeAssistantEntity -entity_id ENTITY_ID
  Get-HomeAssistantServices
  Invoke-HomeAssistantService -service SERVICE -entity_id ENTITY_ID
  Invoke-HomeAssistantService -service SERVICE -json 'JSON'
  New-HomeAssistantSession -ip HOME-ASSISTANT_IP -port HOME-ASSISTANT_PORT -token ACCESS_TOKEN

You can make a token at http://HOME-ASSISTANT-IP:8123/profile
For more info: https://developers.home-assistant.io/docs/en/auth_index.html

In action:

I have some plans for the future. One thing I like to be able to do is to update template sensors with information from PowerShell. And maybe make is useful to make automations.

6 Likes

Nice! Could you tell me what do you use this module for? Maybe some great automation scripts on your PC? :slight_smile:

Right now, not much .
But it can be used to fast get information about entities and so on if you are familiar with PowerShell.
Also you can easly make HA-controlls in windows like:
Uten%20navn
One thing i want to implement is a way of updating a sensor of some kind with information from powershell. So you can get a scheduled task for example to update drive space and so on to Home-Assistant. Like System monitoring.

3 Likes

This is cool. You could use it to interact with the Toast via (BurntToast) and/or speech. I’ve been messing with MQTT with both for notifications.

This looks good. I am currently writing a PowerShell function to update a binary sensor using the HTTP Integration. Are you open to pull requests? I’d love to add my function to your module if that would be okay.

I am, :slight_smile: Just make sure it is not breaking any of the existing functionality