domofon moved to esphome
This commit is contained in:
@@ -29,7 +29,14 @@ class Intercom(hass.Hass):
|
||||
self.ringtone = self.args['ringtone']
|
||||
self.listen_event(self.domofon_call, "domofon_call")
|
||||
self.listen_event(self.receive_telegram_callback, 'telegram_callback')
|
||||
# self.domofon_call(None, None, None)
|
||||
self.listen_state(self.sensor_trigger, self.args['sensor'])
|
||||
|
||||
def sensor_trigger(self, entity, attribute, old, new, kwargs):
|
||||
if new != "off":
|
||||
return
|
||||
self.log("domofon_call")
|
||||
self.domofon_call(None, None, None)
|
||||
|
||||
|
||||
def domofon_call(self, event_id, event_args, kwargs):
|
||||
self.log("domofon_call")
|
||||
|
||||
@@ -5,6 +5,7 @@ intercom:
|
||||
module: intercom
|
||||
class: Intercom
|
||||
notify: telegram
|
||||
sensor: binary_sensor.domofon_incoming_call
|
||||
gw_mac: !secret aqara1_mac
|
||||
chat_id: !secret telegram_group_chat
|
||||
global_dependencies:
|
||||
|
||||
@@ -19,9 +19,9 @@ watchdog_wemos_uptime:
|
||||
module: watchdog
|
||||
constraint: input_boolean.watchdog_report
|
||||
entities:
|
||||
# - sensor.uptime_airfresher
|
||||
- sensor.airfresher_uptime
|
||||
- sensor.uptime_bath
|
||||
- sensor.uptime_domofon
|
||||
- sensor.domofon_uptime
|
||||
- sensor.uptime_kitchen_led
|
||||
- sensor.uptime_nest
|
||||
- sensor.uptime_salt_lamp
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
esphome:
|
||||
name: domofon
|
||||
platform: ESP8266
|
||||
board: d1_mini
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_24_name
|
||||
password: !secret wifi_24_pass
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Domofon Fallback Hotspot"
|
||||
password: !secret esphome_captive_pass
|
||||
|
||||
captive_portal:
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
password: !secret esphome_pass
|
||||
|
||||
ota:
|
||||
password: !secret esphome_pass
|
||||
|
||||
logger:
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: 14
|
||||
mode: INPUT_PULLUP
|
||||
inverted: true
|
||||
name: "Domofon incoming call"
|
||||
id: incoming_call
|
||||
device_class: lock
|
||||
on_press:
|
||||
then:
|
||||
- script.execute: state_call
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: Domofon Uptime
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: 13
|
||||
inverted: yes
|
||||
id: trubka
|
||||
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: 12
|
||||
inverted: yes
|
||||
id: door
|
||||
|
||||
# Automatically open door switch
|
||||
- platform: template
|
||||
name: "Domofon automatically open"
|
||||
id: auto_open
|
||||
icon: "mdi:door-open"
|
||||
optimistic: true
|
||||
restore_state: true
|
||||
on_turn_on:
|
||||
- switch.turn_off: auto_open_once
|
||||
|
||||
# Automatically open door once switch
|
||||
- platform: template
|
||||
name: "Domofon automatically open once"
|
||||
id: auto_open_once
|
||||
icon: "mdi:door-open"
|
||||
optimistic: true
|
||||
restore_state: true
|
||||
on_turn_on:
|
||||
- switch.turn_off: auto_open
|
||||
|
||||
- platform: template
|
||||
name: "Domofon force open"
|
||||
id: open_force
|
||||
icon: "mdi:door-open"
|
||||
turn_on_action:
|
||||
- script.execute: call_accept
|
||||
|
||||
- platform: template
|
||||
id: domofon_call_emulation
|
||||
name: "Domofon call emulation"
|
||||
turn_on_action:
|
||||
- script.execute: state_call
|
||||
|
||||
script:
|
||||
# Accept incoming call
|
||||
- id: call_accept
|
||||
then:
|
||||
- logger.log: "Accept call"
|
||||
- delay: 1000ms #mandatory 1s delay between hang-on - bacause system goes to error otherwise
|
||||
- switch.turn_on: trubka
|
||||
- delay: 200ms
|
||||
- switch.turn_on: door
|
||||
- delay: 200ms
|
||||
- switch.turn_off: door
|
||||
- delay: 100ms
|
||||
- switch.turn_off: trubka
|
||||
- delay: 200ms
|
||||
|
||||
# Call state
|
||||
- id: state_call
|
||||
then:
|
||||
- logger.log: "Set state 'Incoming call'"
|
||||
- if:
|
||||
condition:
|
||||
switch.is_on: auto_open
|
||||
then:
|
||||
script.execute: call_accept
|
||||
- if:
|
||||
condition:
|
||||
switch.is_on: auto_open_once
|
||||
then:
|
||||
- script.execute: call_accept
|
||||
- delay: 1s
|
||||
- switch.turn_off: auto_open_once
|
||||
@@ -1,7 +0,0 @@
|
||||
- platform: mqtt
|
||||
name: domofon_mode
|
||||
state_topic: "home/domofon/domofon/mode"
|
||||
command_topic: "home/domofon/domofon/mode/set"
|
||||
payload_on: "1"
|
||||
payload_off: "2"
|
||||
retain: true
|
||||
@@ -1,7 +0,0 @@
|
||||
- platform: mqtt
|
||||
name: domofon_open
|
||||
state_topic: "home/domofon/domofon/open"
|
||||
command_topic: "home/domofon/domofon/open/set"
|
||||
payload_on: "1"
|
||||
payload_off: "2"
|
||||
retain: false
|
||||
@@ -14,7 +14,7 @@ views:
|
||||
- alarm_control_panel.ha_alarm
|
||||
- switch.water_valve
|
||||
- vacuum.xiaomi_vacuum_cleaner
|
||||
- switch.domofon_open
|
||||
- switch.domofon_force_open
|
||||
- switch.wifi_socket
|
||||
- type: entities
|
||||
title: "Гостиная"
|
||||
@@ -345,7 +345,8 @@ views:
|
||||
- input_boolean.water_control
|
||||
- input_boolean.water_leak_control
|
||||
- input_boolean.mainroom_climate_control
|
||||
- switch.domofon_mode
|
||||
- switch.domofon_automatically_open
|
||||
- switch.domofon_automatically_open_once
|
||||
- type: entities
|
||||
title: "Настройки отчетов"
|
||||
show_header_toggle: true
|
||||
@@ -369,9 +370,9 @@ views:
|
||||
title: "Аптайм"
|
||||
show_header_toggle: false
|
||||
entities:
|
||||
- sensor.uptime_airfresher
|
||||
- sensor.airfresher_uptime
|
||||
- sensor.uptime_bath
|
||||
- sensor.uptime_domofon
|
||||
- sensor.domofon_uptime
|
||||
- sensor.uptime_kitchen_led
|
||||
- sensor.uptime_nest
|
||||
- sensor.uptime_bathlight
|
||||
|
||||
Reference in New Issue
Block a user