I have a radon sensor (Airthings) I want to use to control three lights leds on an ESP. (light.foo.green, light.foo.yellow, light.foo.red)
The default Airthings radon reading is in Bq/m, and I’ve done a conversion in my config.yaml as to pci/l (more typical) as templated sensors. “MyReadingPCIL”
How best should I go about automating this? I’m new to HA coding and it seems I can do it as a blueprinted automation or a raw automation. Should it be a trigger on crossing a threshold (e.g. 0-4, 4-7, >7). The sensor is definitely slow moving so I don’t think I really need a trigger window or frequent sensor sampling.
I’m searching the forum and looking at lots of examples for things like lux sensors turning lights on or off. Just lookign to get pointed the right direction, then I’ll go experiment (some more).
I would create a single automation that triggers whenever the value reported by the sensor changes.
Then you can use it ‘choose’ statement to add three conditions, one for each of your ranges, then have each one set the lights accordingly:
description: ""
mode: single
trigger:
- platform: state
entity_id:
- sensor.your_sensor
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.your_sensor
below: 3
sequence:
- service: light.toggle
metadata: {}
data: {}
- conditions:
- condition: numeric_state
entity_id: sensor.your_sensor
above: 3
below: 7
sequence:
- service: light.toggle
metadata: {}
data: {}
- conditions:
- condition: numeric_state
entity_id: sensor.your_sensor
above: 7
sequence:
- service: light.toggle
metadata: {}
data: {}
alias: New Automation
Obviously your lights need to be added to this but that’s easy to do in the visual editor
I like this approach. Thanks! @tobywhiting10