I would like to setup a xiaomi door sensor to turn on a light, but only if the sun is below the horizon. I think it should be simple (do it in configurator?)
Is there some documenation that can help me with this kind of thing? I’m semi technical…
You need automation with a ‘state’ trigger on the door sensor, a ‘sun’ condition (sun being ‘below_horizon’) and and action, that uses ‘light.turn_on’ service and the entity id of that light.
Roughly:
automation:
- trigger:
platform: state
entity_id: binary_sensor.my_xiamoni_door_sensor
to: 'on'
condition:
condition: sun
after: sunset
before: sunrise
action:
service: light.turn_on
entity_id: light.my_door_light
You can find all entity IDs in the developer tools section of HA, lower end of the left main menu, the < > symbol.
I don’t know about your door opening sensor, but my Homematic sensors are binary, because they only can turn ‘on’ or ‘off’. Your sensor may act different, just scan the entity list to figure out what’s its type (domain) and what’s its id. You can also watch different states here, just click on it’s entity id to get the current state and attributes at the top of the list.