From 0bb13e203b4d87f6a022a090aa9187b95fb6ec7b Mon Sep 17 00:00:00 2001 From: monster Date: Wed, 30 Jan 2019 22:03:39 +0300 Subject: [PATCH] updating configuration --- appdaemon/docker/Dockerfile | 4 +-- appdaemon/settings/apps/doorbells/doorbell.py | 2 +- .../apps/light/kitchen_led_controller.yaml | 11 ------ appdaemon/settings/apps/notifiers/battery.py | 2 +- appdaemon/settings/apps/notifiers/watchdog.py | 13 ++++++- .../settings/apps/notifiers/watchdog.yaml | 5 ++- appdaemon/settings/apps/sensors/mosru.yaml | 1 + appdaemon/settings/apps/timers/airfresher.py | 26 ++++++++++---- appdaemon/settings/apps/timers/curtain.py | 34 ++++++++++++++++++ appdaemon/settings/apps/timers/curtain.yaml | 8 +++++ hass/settings/alexa_media.pickle | Bin 0 -> 2529 bytes hass/settings/configuration.yaml | 5 +++ .../configuration/automation/homekit.yaml | 2 +- .../configuration/camera/synology.yaml | 2 +- .../configuration/customize/cover.yaml | 2 ++ hass/settings/configuration/group/_views.yaml | 2 +- .../group/hidden/light/kitchen_light.yaml | 2 +- .../configuration/group/home/mainroom.yaml | 1 + .../configuration/homekit/homekit.yaml | 1 + .../settings/configuration/light/balcony.yaml | 4 +-- .../configuration/media_player/alexa.yaml | 6 ++++ .../switch/kitchen_mini_light.yaml | 12 +++---- .../configuration/tts/yandex_tts.yaml | 2 +- hass/settings/custom_components | 1 + hass/settings/mysensors1.pickle | Bin 446 -> 485 bytes hass/settings/secrets.yaml.sample | 12 +++++-- 26 files changed, 121 insertions(+), 39 deletions(-) create mode 100644 appdaemon/settings/apps/timers/curtain.py create mode 100644 appdaemon/settings/apps/timers/curtain.yaml create mode 100644 hass/settings/alexa_media.pickle create mode 100644 hass/settings/configuration/customize/cover.yaml create mode 100644 hass/settings/configuration/media_player/alexa.yaml create mode 160000 hass/settings/custom_components diff --git a/appdaemon/docker/Dockerfile b/appdaemon/docker/Dockerfile index 1056435..24d45ce 100644 --- a/appdaemon/docker/Dockerfile +++ b/appdaemon/docker/Dockerfile @@ -2,6 +2,6 @@ ARG VERSION FROM acockburn/appdaemon:${VERSION} RUN pip3 install \ - emp_mos_api \ + emp_mos_api==0.10 \ sqlalchemy \ - mysqlclient \ No newline at end of file + mysqlclient diff --git a/appdaemon/settings/apps/doorbells/doorbell.py b/appdaemon/settings/apps/doorbells/doorbell.py index e3c07af..259d642 100644 --- a/appdaemon/settings/apps/doorbells/doorbell.py +++ b/appdaemon/settings/apps/doorbells/doorbell.py @@ -41,7 +41,7 @@ class Doorbell(hass.Hass): def send_image(self): - self.call_service("camera/snapshot", entity_id="camera.entrance", filename="/config/www/camera_image.jpg") + self.call_service("camera/snapshot", entity_id="camera.enterance", filename="/config/www/camera_image.jpg") extra_data = {'photo': {'file':'/config/www/camera_image.jpg', 'capture': 'Фото звонившего.'}} self.notify("Фото звонившего", name = self.args['notify'], data=extra_data) diff --git a/appdaemon/settings/apps/light/kitchen_led_controller.yaml b/appdaemon/settings/apps/light/kitchen_led_controller.yaml index e7dcfc1..e7b22f5 100644 --- a/appdaemon/settings/apps/light/kitchen_led_controller.yaml +++ b/appdaemon/settings/apps/light/kitchen_led_controller.yaml @@ -8,14 +8,3 @@ kitchen_led_controller: topic: home/kitchen-led/kitchen-led/state/set global_dependencies: - globals - -################################# -# LIGHT BUTTONS # -################################# -kitchen_mini_light_controller: - module: kitchen_led_controller - class: KitchenLedController - watch_entity: light.kitchen - topic: home/plug/kitchen-mini-light/status/set - global_dependencies: - - globals diff --git a/appdaemon/settings/apps/notifiers/battery.py b/appdaemon/settings/apps/notifiers/battery.py index 435cfe0..a3113c5 100644 --- a/appdaemon/settings/apps/notifiers/battery.py +++ b/appdaemon/settings/apps/notifiers/battery.py @@ -38,7 +38,7 @@ class Battery(hass.Hass): if "battery_level" in devices[device]["attributes"]: battery = devices[device]["attributes"]["battery_level"] if battery != None: - if battery < self.args["threshold"]: + if battery < self.args["threshold"] and battery != 0: low.append(device) values[device] = battery diff --git a/appdaemon/settings/apps/notifiers/watchdog.py b/appdaemon/settings/apps/notifiers/watchdog.py index 7bf963b..7243027 100644 --- a/appdaemon/settings/apps/notifiers/watchdog.py +++ b/appdaemon/settings/apps/notifiers/watchdog.py @@ -2,6 +2,7 @@ import appdaemon.plugins.hass.hassapi as hass from datetime import timedelta import datetime import globals +import requests # # App to monitor entity update time. @@ -40,4 +41,14 @@ class Watchdog(hass.Hass): friendly_name = self.friendly_name(entity) message = "Датчик {} ({}) не обновлялся в течении {} секунд.".format(friendly_name, entity, self.args['timeout']) - self.notify(message, name = "telegram") \ No newline at end of file + self.notify(message, name = "telegram") + self.reboot_sensor() + + def reboot_sensor(self): + if 'reboot' in self.args and self.args['reboot']: + host = self.args['host'] + headers = {'Content-Type': 'application/json; charset=utf-8', 'Referer': 'http://{}/others.html'.format(host), 'X-Requested-With': 'XMLHttpRequest'} + data = 'msg={"CID":20003,"PL":{}}' + response = requests.post('http://{}/cmd'.format(host), headers=headers, data=data, auth=('admin', self.args['password'])) + json = response.json() + self.log("reboot status: {}".format(json)) diff --git a/appdaemon/settings/apps/notifiers/watchdog.yaml b/appdaemon/settings/apps/notifiers/watchdog.yaml index 06455b2..dba0375 100644 --- a/appdaemon/settings/apps/notifiers/watchdog.yaml +++ b/appdaemon/settings/apps/notifiers/watchdog.yaml @@ -7,5 +7,8 @@ watchdog_sensor_power_active_power: entity: sensor.power_active_power update_interval: 60 timeout: 360 + reboot: True + host: !secret modbus_host + password: !secret modbus_admin_pass global_dependencies: - - globals \ No newline at end of file + - globals diff --git a/appdaemon/settings/apps/sensors/mosru.yaml b/appdaemon/settings/apps/sensors/mosru.yaml index 7a4e35f..db49d9a 100644 --- a/appdaemon/settings/apps/sensors/mosru.yaml +++ b/appdaemon/settings/apps/sensors/mosru.yaml @@ -1,3 +1,4 @@ + ################################# # MOS.RU DATA RETRIEVER # ################################# diff --git a/appdaemon/settings/apps/timers/airfresher.py b/appdaemon/settings/apps/timers/airfresher.py index d8acfc7..69507a8 100644 --- a/appdaemon/settings/apps/timers/airfresher.py +++ b/appdaemon/settings/apps/timers/airfresher.py @@ -17,6 +17,8 @@ import datetime class AirFresher(hass.Hass): timers = [] fresh_times = 0 + fresh_every_mins = 10 + last_fresh_date = None def initialize(self): self.listen_state(self.light_change, 'group.bath_light') @@ -27,20 +29,32 @@ class AirFresher(hass.Hass): self.cancel_timers() if (old == "off" and new == "on"): - self.log('Start freshing timer.') - self.fresh_times = 0 - newtime = self.datetime()+datetime.timedelta(minutes=5) - self.timers.append(self.run_every(self.timer_tick, newtime, 3*60)) + if self.last_fresh_date != None: + diff = (self.datetime()-self.last_fresh_date).seconds / 60 # * 24 * 60 * 60 + if (diff < self.fresh_every_mins): + self.log("time passed from last fresh: {}".format(diff)) + self.log('Already dreshed in {} mins.'.format(self.fresh_every_mins)) + return + self.start_timer() - def timer_tick(self, args) -> None: - self.fresh() + def start_timer(self) -> None: + self.log('Start freshing timer.') + self.last_fresh_date = self.datetime() + self.fresh_times = 0 + newtime = self.datetime()+datetime.timedelta(seconds=5) + self.timers.append(self.run_every(self.timer_tick, newtime, 4*60)) def cancel_timers(self) -> None: for timer in self.timers: self.cancel_timer(timer) timers = [] + def timer_tick(self, args) -> None: + self.fresh() + def fresh(self): + self.log("current timer: {}".format(self.last_fresh_date)) + self.fresh_times = self.fresh_times + 1 if (self.fresh_times > 5): self.log('Fresh max times is reached. Canceling timer.') diff --git a/appdaemon/settings/apps/timers/curtain.py b/appdaemon/settings/apps/timers/curtain.py new file mode 100644 index 0000000..87238d4 --- /dev/null +++ b/appdaemon/settings/apps/timers/curtain.py @@ -0,0 +1,34 @@ +import appdaemon.plugins.hass.hassapi as hass +import globals +# +# Entity timer +# Turn on and off this entities +# +# Args: +# +# None +# +# Release Notes +# +# Version 1.0: +# Initial Version + +class Curtain(hass.Hass): + def initialize(self): + if not globals.check_args(self, ["on_time", "off_time"]): + return + on_time = self.parse_time(self.args["on_time"]) + off_time = self.parse_time(self.args["off_time"]) + + self.on_timer = self.run_daily(self.on_timer_tick, on_time) + self.off_timer = self.run_daily(self.off_timer_tick, off_time) + + def on_timer_tick(self, kwargs): + self.log('on_timer') + if 'entity' in self.args: + self.call_service("cover/open_cover", entity_id = self.args['entity']) + + def off_timer_tick(self, kwargs): + self.log('off_timer') + if 'entity' in self.args: + self.call_service("cover/close_cover", entity_id = self.args['entity']) diff --git a/appdaemon/settings/apps/timers/curtain.yaml b/appdaemon/settings/apps/timers/curtain.yaml new file mode 100644 index 0000000..628ae3e --- /dev/null +++ b/appdaemon/settings/apps/timers/curtain.yaml @@ -0,0 +1,8 @@ +curtain_timer: + module: curtain + class: Curtain + on_time: "07:45:00" + off_time: "21:00:00" + entity: cover.curtain_158d0002b0c46a + global_dependencies: + - globals \ No newline at end of file diff --git a/hass/settings/alexa_media.pickle b/hass/settings/alexa_media.pickle new file mode 100644 index 0000000000000000000000000000000000000000..8938182351ebf13e3aa2d6a7dce2f923ecc36e31 GIT binary patch literal 2529 zcmZ{mNt4?|6vqcbNEjeM!k(~XflLxSqs5XfAb{mn9$Q{z%VrU6Np{QD)>^z3u7aBl zS5DmccwG1fRMC<>NoF#0v)z# zUj?p?uB_u)-cY4DmO)oH@(t{cK1qU8fUi7>d_|OB!!BrOy0T@Y(Edh#9oziCGt@xQ z919pWdUYe;d}`cPRziEKd&bZJ15-z@t>t&0hS>gT@9P`+%~Rf8;cLfx@~u-2Uk?<+ zHUa~fcy-eR9(rRVUw>2xYQGN+mQfz02 zZj@JlHhu^Pv3R@f`{?ZzdPja0#~cC+EFBy7z(Vh?(0lR=*m#8AU!e~U#wN777! zV$&4MkclM0q*#_lcj5}J;|1uhC||=F(Qn0fbrp9+*U-I<{4%!gbpGtQJ$)W4v~@p| zc7Gjfy|X`UM1T&~+a)92AHeswYvPY*k{_<)HGN$T@$5g^#B-?6UBlCT^u_O&wZH!P zZ7()z2A)+RKA(0Y z5g1rj8b;bDSBN=)Sa0~rxlt^<9WO|cDUL}IREjlG3f>jry$yU`vNXKEh6ihicMl(~ z;iC;a*%M4`;GqbQL`ZBPrs6QwE0`)A7+NAeL0`r^U#-yBCp@S9k1*)&O~ zm;`P#k!DHs&4onYo=5acr1Dv!?=Vq(u6I)#I1}AQnV5=Sq3n(dW-!OUnBz`&>?ZqG zt85W`Fj-o4f8K5sEw)1B!&1LOHaOBGHVx(#io`iiHm~4xYH&SItw>j6RloJpd0ginP5gjZ;ks-56eG0xxkR?7rS@QX0Z^FoFNuiMk zbsw~QnjzJs_DF2Gb8}d13kzOy6+<><700E7o6AcKtad6@mR__Lt(-*_hW$~Ew(Dp~I3mFVMa#FB zO+aR?giP37y&TkS7V)a;@e6y-77T%zlt;#7p7#Wx`CZ@5*QVY4ak7>$1ZX>%R5RB~ z@NQyaaKcpVbhGQ2gQ>K#zZjtk3L&ZsLH3x#uDAE$NBFFIUhm{U5ILiR)l z+WjV&YKqhs=u(?+TB*viAW(88U*Z>;sV}+BY+s^`q((XOqMK&Say>QRTvWes9vWxn zVI5sb=gvbje&es z3z6mXkk36(z0=737&&@4Ro@$; z?_<;-R_MnaYWzIKuAeY-^hA?Mnx+^!$