Hello,
I would like to add some intelligence to the old very funny working doorbell. This means that I will add an ESP8266 to this doorbell which will only activate the doorbell when my little son is not asleep. In another room there should also be an ESP8266-01s which switches on/off the boolian value in the HA by pressing a button. When the bell is switched off, only the LED spotlight next to it should blink.
In the future, the status of the bell can also be done automatically over time by HA. In addition my ClockTwo clock in the living room should start blinking wildly and a notification should come to the cell phone, but that can follow later.
The ESP8266 should get the boolian value automatically from the HA and react accordingly.
Here is the ESPHome code of the doorbell:
esphome:
name: esphome-web-1047d6
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
sensor:
- platform: homeassistant
name: "door_bell_enable"
entity_id: sensor.door_bell_state_change
id: door_bell_enable_switch
binary_sensor:
platform: gpio
name: "Klingel"
pin:
number: D1
inverted: False
filters:
- delayed_off: 4s
on_press:
then:
- if:
condition:
- lambda: 'return id(door_bell_enable_switch).state == bool(true);'
then:
- switch.turn_on: out_d1_dong
- repeat:
count: 12
then:
- switch.turn_on: out_d3_light
- delay: 250ms
switch:
- platform: gpio
pin: D0
id: out_d1_dong
name: "Doorbell power"
icon: "mdi:gate"
on_turn_on:
- delay: 500ms
- switch.turn_off: out_d1_dong
- platform: gpio
pin: D3
id: out_d3_light
name: "Doorbell light"
#icon: "mdi:gate"
on_turn_on:
- delay: 50ms
- switch.turn_off: out_d3_light
wifi:
...
captive_portal:
This is my Home Assistant configuration.yaml:
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
template:
- platform: template
sensors:
door_bell_state_change:
value_template: '{{ states.input_number.doorbell_state.state | int }}'
I added an helper variable to the automation HA automation:
Name:
doorbell_state
I added this via GUI. with: a boolean siwtch
The doorbell ESP does not get any data from the HA and I don’t know why.
What is working:
The doorbell esp8266 is connected to HA and I can switch on/off the doorbell via the HA gui.
Also, I made a automation script which can manipulate the HA doorbell_state helper file by pressing a button on an other ESP8266-01s device.
So something is working but not the enable/disable part from HA.
If someone can help me it would be great.
I bet there is just a very small and stupid error I can’t see right now.
thanks