This is not too complex, but I find it really useful, so I thought I’d share. Especially since I have all the Tasker stuff and apps linked, that you can just import and modify for your use-case.
This is a “Kustom” (KWGT) widget on an Android home screen to control anything in home assistant without having to speak out loud, open an app, or flip a physical switch.
Even with a lot of actual automation going on, sometimes you just need that manual override. And sometimes having to say it out loud is not the best option. Especially not when some people are sleeping (so I’ve been told. Sternly! ). As an additional bonus, you can see the state of whatever you put here.
Software
-
Home Assistant (D’uh)
-
Appdaemon, though you might be able to do it without?
The widget explained:
-
The lights, I assume, are pretty self-explanatory. There are separate on/off buttons (since some are groups, so even though some lights in the group are ‘off’, the group might show as ‘on’).
-
’Espresso’, ‘Fountain’, and the two ‘Fume’ just toggle switches.
-
The top up/down buttons are for increasing/decreasing the brightness of the selected light (this is the one I haven’t done properly yet).
-
The bottom up/down buttons are for increasing/decreasing the fume hood power.
-
The text at the bottom gives me some notification from home assistant. In this case, I have just set it up to note which door was the last to open, and at what time. Home assistant keeps track of the door, Tasker keeps track of the time and text formatting.
-
The blue line is a percentage bar, that (once I have the dimming automations set up) will display the light intensity of the selected light(s).
On the Tasker end:
I have some examples for both profiles and tasks, as well as a widget for Kustom that you can just import. I think that’s easier than to try explaining how these were created.
The toggling of the color in the widget is separated from the widget controls. That is, color is controlled by home assistant pushing updates in state, not by Tasker states, so the color changes to yellow (‘on’), even if the light/switch is turned on by other means.
There are a bunch of (global) variables defined in Tasker, that keeps track of everything that HASS sends. I think you can see which ones once you import the Tasker profiles/tasks, but otherwise let me know.
In the “RESTask” configuration, you need to swipe left to the “Headers” section. Here you need to write Authorization
at the top, and at the bottom you need to enter your bearer token. It should look like this:
Bearer
asdfASDFGgagAERTesRgterY456HaerGhW34Yherahw45bhr... etc. etc.
On the Home Assistant end
I use AppDaemon. For sending the states to Tasker, I have some example apps here. Only a few, but there are basically two general types. The one that updates the state of an entity (this is the universal one), and the one that sends notifications in text form. So just substitute different entity_ids, and you’re good to go.
They are redacted, since there is some sensitive information in them, but you can definitely use them as templates. You just need to get your private key in the AutoRemote App.
There are a few variables defined in my apps.yaml in my main home assistant repo; search for the relevant ones (they are all under the tasker
section):
Do do:
-
The light brightness, of course.
-
Yes, I am working on a nicer looking widget, which also includes controls for TVs, as well as a way to have “selected lights” in the widget, so I know which ones I would increase/decrease the brightness of.
-
I also have this idea that I’d like scrolling text, so I can fit longer notifications (so not “just” about the door that was opened, that was more as proof-of-concept).
-
I’ve also noticed that occasionally, the toggle won’t work. Usually I can open tasker, go into the “RESTask” part of the task, edit config (without changing anything), and/or trying to run the task manually, and after that, they will all work again. This is rare, but quite annoying, and something I have to fix (ideas, anyone?)