I am a HA newby. I got hass.io installed on a RPI 3 B+ with the zigbee2mqtt add-on, which was a bit of a struggle.
I now have an Aqara Human Body Movemnet sensor and an Aqara Led Bulb connected, and can read / controll them individually in the hass.io frontend.
So it was time for my first automation: switch the light on when the sensor sees movement.
I edited the automation in the hass.io web interface, this is the result in automations.yaml:
When I wave at the sensor the light does not turn on, but the state of the sensor changes from false to true. Also, when I click on ātriggerā in the automation state the lamp switches on. So the separate parts seem to work, but the automation that is supposed to bring it all together does not?
This must be new, because most of the action part doesnāt look familiar. But since it works when you manually trigger it, Iād say the problem is the states youāre using in the trigger. They should be 'off' and 'on' instead of 'false' and 'true'. To be sure, check the states as shown for binary_sensor.0x00158d0002c636c4_occupancy on the States page under Developer Tools.
Yeah, I must have been asleep as Iāve never seen domain: and type: before
They seem to replace service: and all seem to be under the device_id:
weird !!!
Thanx, Phil. The states as shown for binary_sensor.0x00158d0002c636c4_occupancy on the States page are āfalseā and ātrueā.
I changed false/true to off/on in the automation trigger and suddenly it worked! Just to check I changed it back to false/true and that worked too ā¦
Very confusing!
Apparently thereās some new features for interacting with devices. I saw mention of it but havenāt really read up on it. Seems itās meant only to be used via the UI. (I.e., one is not supposed to manually write stuff this way.)
If youāre using the Automation Editor in the UI, then I canāt really help you. I never have, and never will, use that. I can only comment about whatās in the YAML file. In there, a binary_sensor can only take on two states, which are exactly 'on' and 'off'. And you have to quote these, because YAML will convert on and off (without quotes) to the boolean values true and false, which will never equal the strings 'on' and 'off'.
The states for the sensor in the āstatesā tab (itās a tab, not a column, come on ā¦ ) are off and on. I am still discovering new areas in HA.
But the states in the trigger part of the automation are still defined as false and true and that works ā¦
Now I am going to figure out how I can switch the light off after 2 minutes ā¦
Thanks for all the help, appreciate it a lot!
Hmmm ā¦ so I am using an integration ā¦ neat!
I think what you are looking for is zigbee2mqtt, especially the zigbee2mqtt hass.io add-on. It interfaces a cheap zigbee hub (a cc2530 device) with a mqtt broker (mosquitto in my case). Mosquitto is what I see on the integrations page, with the 2 devices listed.
I donāt know a lot about mqtt, but I do know that any entity in the binary_sensor domain is supposed to only take on the states of 'on' and 'off'. It appears you have something that is breaking that rule. Maybe what you said before is correct ā i.e., the states actually showed as true and false (which are, of course, strings, not boolean values, because all states are always strings.)
That worked. I.e., when I turned input_boolean.test1 to 'on', it triggered, and the state displayed in the notification was indeed on. Then I changed it to this:
Iām still here to tell you true and false canāt work if on and off do. Are you sure you donāt have multiple automations and the one that is firing is not the one youāre working on??? There is still something that doesnāt add up here. But if youāre happy, Iām happy!
I changed it back to on/off in automations.yaml, and then back to true/false again, and the automation keeps working.
Only: do I need to reset or restart something after editing automations.yaml? Becuase if so I could have a cached version or something active right now?