How to use values in home assistant automation?

#73 · closed · 2 comments

View on GitHub ↗

bartplessers

Hi everyone, I'm trying to create an automation that turns on a light when my active power is below a certain threshold. In the GUI of HA: ## TRIGGERS ![2022-01-17_16-39-31](https://user-images.githubusercontent.com/10470708/149808289-225a8a56-08e5-4c83-91bc-549dd4efabae.png) ## CONDITIONS ![2022-01-17_16-40-16](https://user-images.githubusercontent.com/10470708/149808330-d63111e3-380d-4940-a633-cc56e33791e5.png) ## ACTIONS ![2022-01-17_16-40-45](https://user-images.githubusercontent.com/10470708/149808363-0bc1904a-e373-4220-98c5-1ea31698267a.png) However, this seems not to work. I checked the values, i.e.: ![2022-01-17_17-42-19](https://user-images.githubusercontent.com/10470708/149808633-53b711a6-21e4-4f1a-b08d-c016f3db6756.png) PS. In YAML, the automation became ![2022-01-17_17-45-09](https://user-images.githubusercontent.com/10470708/149808980-2b9e1c46-d32a-4c9d-98d0-4225eddfa5b0.png) ``` - id: '1642434242283' alias: SchakelAlsVerbruikOnderGrens description: SchakelAlsVerbruikOnderGrens trigger: - platform: numeric_state entity_id: sensor.p1_meter_active_power_l1 id: sensor.p1_meter_active_power_l1_250W attribute: unit_of_measurement below: '325' condition: [] action: - type: toggle device_id: 829993eca56b2896acc3b9851fec86f7 entity_id: light.my_n00_p03_light_l19_hanglamp domain: light mode: single ``` What am I doing wrong? Any help is appreciated, kind regards, Bart Plessers

Comments

DCSBL

Don't automate on `unit_of_measurement`. Just leave it blank. Unit of measurement is like 'Watts'. So you are literally asking `When "Watts" goes below 250`. ```diff id: '1642434242283' alias: SchakelAlsVerbruikOnderGrens description: SchakelAlsVerbruikOnderGrens trigger: - platform: numeric_state entity_id: sensor.p1_meter_active_power_l1 id: sensor.p1_meter_active_power_l1_250W - attribute: unit_of_measurement below: '325' condition: [] action: - type: toggle device_id: 829993eca56b2896acc3b9851fec86f7 entity_id: light.my_n00_p03_light_l19_hanglamp domain: light mode: single ``` Also, `trigger_id` is not required. Only if you want to some advances automations. This works as trigger: <img width="1051" alt="Screenshot 2022-01-17 at 18 05 52" src="https://user-images.githubusercontent.com/74970928/149812573-4156a22a-f681-4662-9bef-9a1e21b99e4e.png">

DCSBL

@bartplessers Did it work?