A numeric_state trigger only triggers on the transition to the target state (i.e., the test changes from false to true), not simply if the test is satisfied. If you manually set the value of that sensor to less than 0.19 and then to greater than 0.19, it should trigger.
If you want to execute the action whenever the value reported by the sensor is above 0.19, then you’d need something like the following:
- alias: 'livingroom lights on when dark'
trigger:
- platform: state
entity_id: sensor.front_illuminance
condition:
- condition: numeric_state
entity_id: sensor.front_illuminance
above: 0.19
action:
- service: light.turn_on
data:
entity_id: light.computer_room
But based on your automation, I suspect that you’re just not transitioning from below 0.19 to above it when you’re testing.
Well, I feel stupid.
Your sample code gave me more reason to poke around my setup when it still didn’t trigger. What happened was, I had turned off the automation a few days ago during my setup/testing and totally forgot it was off since.
My original code above works; the automation was turned off was why it didn’t triggered. Now it is coming back to me. I remembered it worked a few days ago and I was scratching my head why it isn’t working now.
I have a numeric entity that triggers a relay and sometimes it triggers and sometimes it doesn’t. I can’t work out what’s going on. The entity’s state change is registered by the HA, the condition for the trigger is met, but it doesn’t fire. Anyone knows what it could be? The system is busy with something else? How can I find the bug?