-
-
Notifications
You must be signed in to change notification settings - Fork 34
Using Home Assistant smart app
The home assistant smart app uses the home assistant template API shown here under POST /api/template
- Open HA,
- click on your profile in bottom left,
- Scroll the bottom until you see "Long-Lived Access Tokens",
- then select create new token and copy this into fenrus
You have 2 sets of 2 properties, the stat title and the stat template
The title is what will be shown on the UI page such as
resulting in that same 'Lights ON' appearing on home screen
The stat template is what is sent to your home assistant in order to retrieve a set piece of information
Fenrus takes care of the API request itself you just need to provide it with your 'Template' in the template param inputs. This is the 'code' that home assistant runs to grab your data. The documentation for this can be found here however it can be quite complex so here are some examples below, Keep note that all pieces of 'code' are surrounded by {{ }}
- You can grab something simple like the temperature of your house {{ states.sensor.home_realfeel_temperature.state }}
You are able to mix in strings with your request such as
Paulus is at {{ states('device_tracker.paulus') }}
could return 'Paulus is at work!' (or whatever the value is of device_tracker.paulus at that time)
Returns a count of all switches that are on
{{ states.switch | selectattr('state','equalto','on') | list | count }}
Returns a count of all windows that are open (on)
{{ states.window | selectattr('state','equalto','on') | list | count }}
You can also combine multiple entries such as
Count all switches AND all lights which are on
{{ ((states.light | list) + (states.switch | list)) | selectattr('state','equalto','on') | list | count }}