The token you enter on the Omlet website is called a Long-Lived Access Token in Home Assistant. It’s created in your user profile inside Home Assistant. Click on your icon/initials at the bottom left, then Security. It’ll only be displayed once, so make sure to copy it.
Check the webhook page on the omlet website to see what the incoming data should look like. It’s in the Request field, under the Events heading.
Mine look like this:
And from the webhook automation this should be in the payload section of the json generated by the Automation being triggered.
You can find this under Traces (top right from the edit automation page), then Changed Variables in your Coop Door Get State (webhoook) [I’ve just noticed that typooo…]
I think I found my error. Actually, the automation seems to work as long as it is triggered by a real change of door state. The error messages I got were generated by triggering the automation manually.
@fishter: Do you plan to add other features? I would like to have sensors for door fault and
light level. Others might want to have sensors for battery level and light status. If you are not interested, me and Bing Copilot might give it another try…
Ah, yes, manually triggering the automation will mean it has no payload. I’m sure there’s a way to test it without involving the coop door, but I can’t see how to do it within HA. From a windows command line you can try :
You’ll need an input_helper number (chicken_coop_door_fault) and add a new sensor to the configuration.yaml (in the same section as the coop_door_state sensor:
If I get some more time I’ll have a look at the other features. Light on/off isn’t useful for me as I don’t have one, but light sensor could be interesting.
Thank you! The light sensor was quite easy to add. But I wonder, how useful it will be. Currently, it shows 100% percent, while the autumn sky is clouded. I guess it is too primitive for controlling more than just the coop door. Currently, my coop run light is controlled by the mathematical sun set. If the light sensor will be sensible enough, I might use it for turning on the run light in the afternoon or evening.
The light sensor on the control panel is designed to give a good resolution around the brightness levels where customers would be interested in the door opening and closing. Because of this it will reach 100% well before what you might consider to be a bright midday level of sunshine. I wouldn’t advise using it for things outside of this range.
Unfortunately, even around dusk, the sensor is still not very sensible. Between 6.30 pm and 9 pm, the revel is at 1%, although my run light runs between sunset and 8 pm at 100%. Between 8 pm and 9 pm my lamp is slowly changing from 100% to 0%, still the sensor constantly stays at 1%.
Still, the sensor could be useful for some automations. I keep my rats away from the feeders and waterers using an electric fence energizer. This should only run when it is too dark for the chickens to eat or drink, of course, for their protection. The door status alone is not sufficient because a chicken might occasionally spend the night outside while I’m not home. Currently, I rely on the mathematical sunrise and sunset with a generous offset. With the sensor, I could more accurately determine when the electric fence energizer should be active. I’ve noticed that sometimes rats take advantage of the times when the energizer isn’t running but the chickens have already retreated.
For me, it’s not working to adjust the state of the door with this automation after manual operation to the toggle. This leads to needing two clicks on the dashboard to adjust the door state. It seems that the conditions:
- conditions:
- condition: state
entity_id: sensor.chicken_coop_door_state
state: open
or
- conditions:
- condition: state
entity_id: sensor.chicken_coop_door_state
state: closed
are never met (I checked in trace). I suspect this is because the automation is triggered multiple times while the door opens or closes. I couldn’t identify the exact reason, and changing the mode from single to always didn’t help.
I solved the problem by removing the control of the toggle from the automation. Now, the toggle is controlled by an additional automation that is triggered differently:
alias: Chicken Coop Door Toggle Sync
description: ""
triggers:
- trigger: state
entity_id:
- sensor.chicken_coop_door_state
to: closed
- trigger: state
entity_id:
- sensor.chicken_coop_door_state
to: open
conditions: []
actions:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.coop_door_toggle
enabled: true
- choose:
- conditions:
- condition: state
entity_id: sensor.chicken_coop_door_state
state: open
sequence:
- action: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.coop_door
- conditions:
- condition: state
entity_id: sensor.chicken_coop_door_state
state: closed
sequence:
- action: input_boolean.turn_off
target:
entity_id:
- input_boolean.coop_door
data: {}
enabled: true
- action: automation.turn_on
metadata: {}
data: {}
target:
entity_id: automation.coop_door_toggle
enabled: true
mode: single
Of course, it would be nicer to have everything in one automation. If it actually works for you with just one automation, I’d appreciate any ideas on what might be wrong for me.
Here is an alternative way to control the door by the dashboard with a tile:
Every time you click on the tile, the door toggles. I prefer this solution because it gives me also the information when the status of the door changed and a tile takes less space.
UPDATE:
I just found two typos in the code for the sensor “Chicken Coop Door Fault”. The original code from fishter was:
unkown → unknown (but I think this is not important for the functionality of the code)
Is there really a condition “endoftravel”? In OmletDaves list from Oct 16 this was part of the “general” condition.
BTW: I am writing an automation that will notify me, if any door fault happens in the evening. Even if the problem can be solved by itself (e.g. a chicken blocks the door for some time but finally moves away) fault can still be a hint that a chicken might be on the wrong side of the door at night.
Hey there! I’m assuming you guys don’t want to make the board configuration too public but I was considering flashing esphome to the esp32 on board and playing around - is any of that pinout information available? The API is great but I’m really looking for a totally local solution. Have used your door for years on 2 coops, just bought the upgraded control module and was happy to see an esp32 on it.