updating configuration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
import fnmatch
|
||||
import globals
|
||||
|
||||
#
|
||||
# Fire sensors alarm notification
|
||||
@@ -10,7 +11,7 @@ import fnmatch
|
||||
# sensor - gorup of sensors to listen
|
||||
# ha_panel - alarm panel entity
|
||||
# notify - notify entity to send message
|
||||
#
|
||||
#
|
||||
# Release Notes
|
||||
#
|
||||
# Version 1.0:
|
||||
@@ -21,7 +22,7 @@ class FireSensorsReport(hass.Hass):
|
||||
if 'sensor_parts' not in self.args or 'notify' not in self.args:
|
||||
self.error("Please provide sensor_parts, ha_panel and notify in config!")
|
||||
return
|
||||
|
||||
|
||||
sensor_parts = self.args['sensor_parts']
|
||||
|
||||
all_sensors = self.get_state()
|
||||
@@ -29,7 +30,7 @@ class FireSensorsReport(hass.Hass):
|
||||
for part in sensor_parts:
|
||||
if fnmatch.fnmatch(entity_id, part):
|
||||
self.log(' [+] listening for security sensor {}'.format(entity_id))
|
||||
self.listen_state(self.sensor_trigger, entity_id)
|
||||
self.listen_state(self.sensor_trigger, entity_id)
|
||||
|
||||
def sensor_trigger(self, entity, attribute, old, new, kwargs):
|
||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||
@@ -45,4 +46,4 @@ class FireSensorsReport(hass.Hass):
|
||||
friendly_name = self.friendly_name(entity)
|
||||
entity = entity.replace('_', '-')
|
||||
message = "Сработал датчик пожарной сигнализации {} ({}) = {}-{}!".format(friendly_name, entity, old, new)
|
||||
self.notify(message, name = self.args['notify'])
|
||||
globals.send_telegram(self, message, target = self.args['notify'])
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
import fnmatch
|
||||
import globals
|
||||
|
||||
#
|
||||
# Security sensors alarm notification
|
||||
@@ -10,7 +11,7 @@ import fnmatch
|
||||
# sensor - gorup of sensors to listen
|
||||
# ha_panel - alarm panel entity
|
||||
# notify - notify entity to send message
|
||||
#
|
||||
#
|
||||
# Release Notes
|
||||
#
|
||||
# Version 1.0:
|
||||
@@ -21,7 +22,7 @@ class SecuritySensorsReport(hass.Hass):
|
||||
if 'sensor_parts' not in self.args or 'ha_panel' not in self.args or 'notify' not in self.args:
|
||||
self.error("Please provide sensor_parts, ha_panel and notify in config!")
|
||||
return
|
||||
|
||||
|
||||
sensor_parts = self.args['sensor_parts']
|
||||
|
||||
all_sensors = self.get_state()
|
||||
@@ -29,7 +30,7 @@ class SecuritySensorsReport(hass.Hass):
|
||||
for part in sensor_parts:
|
||||
if fnmatch.fnmatch(entity_id, part):
|
||||
self.log(' [+] listening for security sensor {}'.format(entity_id))
|
||||
self.listen_state(self.sensor_trigger, entity_id)
|
||||
self.listen_state(self.sensor_trigger, entity_id)
|
||||
|
||||
def sensor_trigger(self, entity, attribute, old, new, kwargs):
|
||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||
@@ -56,4 +57,4 @@ class SecuritySensorsReport(hass.Hass):
|
||||
friendly_name = self.friendly_name(entity)
|
||||
entity = entity.replace('_', '-')
|
||||
message = "В ваше отсутствие сработал датчик безопастности {} ({}) = {}->{}!".format(friendly_name, entity, old, new)
|
||||
self.notify(message, name = self.args['notify'])
|
||||
globals.send_telegram(self, message, target = self.args['notify'])
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import appdaemon.plugins.hass.hassapi as hass
|
||||
import globals
|
||||
|
||||
#
|
||||
# Water leak detector
|
||||
@@ -54,9 +55,9 @@ class WaterLeak(hass.Hass):
|
||||
self.call_service("mqtt/publish", topic = 'home/watercontrol/bath/valve/set', payload = 'close')
|
||||
|
||||
message = "ВНИМАНИЕ! В ваше отстутствие сработал датчик протечки воды ({})!!! Выключаю подачу воды.".format(self.friendly_name(entity_id))
|
||||
self.notify(message, name = self.args['notify'])
|
||||
globals.send_telegram(self, message, target = self.args['notify'])
|
||||
|
||||
message = "Состояние датчиков протечки:\n"
|
||||
for entity_id in self.sensors:
|
||||
message += '{} ({}) = {}\n'.format(self.friendly_name(entity_id), entity_id, self.get_state(entity_id))
|
||||
self.notify(message, name = self.args['notify'])
|
||||
globals.send_telegram(self, message, target = self.args['notify'])
|
||||
|
||||
Reference in New Issue
Block a user