It is currently April 27th, 2024, 2:15 pm

Homeassistant plugin

Share and get help with Plugins and Addons
cperryoh
Posts: 10
Joined: May 22nd, 2022, 10:38 pm

Homeassistant plugin

Post by cperryoh »

Homeassistant is an open-source smart home platform normally self-hosted. I wanted to be able to have some quick access to the devices connected to it so I wrote a plugin in rain meter for it. It can be used in a few ways, getting data or calling services. Services allow you to take actions on entities connected to Homeassistant, like toggling power or adjusting the brightness of a light.
The base format will look something like this,

Code: Select all

[hassio]
Measure=Plugin
Plugin=#SETTINGSPATH#\Plugins\HomeAssitantPlugin.dll
auth=<api-key-from-hassio>
server=<ip> #server ip
From here you can either pull data from your server to be displayed or use bangs to call services. Say you want to display the state of some entity. The skin would look like this:

Code: Select all

You can get an auth token by clicking on your profile on your server.
[hassio]
Measure=Plugin
Plugin=#SETTINGSPATH#\Plugins\HomeAssitantPlugin.dll
server=homeassistant.local
auth=<auth token>
entityId=switch.example
isInt=true
[example]
Meter=String
MeasureName=hassio
X=400
Y=70
FontSize=30
StringAlign=Center
Text=Entity: %1
If you want to access attributes that are part of the entity, there is a way to do that which is detailed in the documentation.

If you'd like to call a service, the general format is

Code: Select all

[!CommandMeasure hassio "<domain>!<service>!<service data>"]
There is a full-fledged explanation in the docs for this as well.

Let me know what you all think, I'm more than happy to get some advice or recommendations on how to make it better.

Note: I have not figured out how to compile x32 binaries so if anyone knows how to with Visual Studio and C# please let me know so I can properly distribute this plugin.
Edit: i figured it out I think, the x32 version should be up on the releases section of the github
Github: https://github.com/cperryoh/HomeAssitant-Rainmeter