Hello guys. I want to create a sensor that shows if a gate is closing or opening. For this I have 2 reed switches, one with the state when it’s open (binary_sensor.gate_open), another for when it’s closed (binary_sensor.gate_closed), and a binary sensor that shows when the gate is moving (binary_sensor.gate_moving).
My idea to create a template is based on the following, but I have no knowledge to do so:
binary_sensor.gate_moving is on and binary_sensor.gate_open goes from on to off = gate is closing
binary_sensor.gate_moving is on and binary_sensor.gate_closed goes from on to off = gate is opening
Is this possible? Is there another way to achieve this?
A cover entity has opening and closing states. You can define a template cover using YAML configs.
Here’s an example that might help you, but it relies on using the existing state of itself to determine whether the movement is in the open or close direction. I haven’t checked if it lets you actually do this, but there are other options and they may depend on what entity(ies) you are actually controlling.