From e5d73db0958745edddb87c1ae2ce651aa40602e6 Mon Sep 17 00:00:00 2001 From: monster Date: Tue, 5 Feb 2019 00:41:50 +0300 Subject: [PATCH] updating configuration --- Makefile | 2 ++ .../apps/light/kitchen_led_controller.py | 15 ++++++------- .../apps/light/kitchen_led_controller.yaml | 8 +++++++ appdaemon/settings/apps/timers/airfresher.py | 2 +- docker-compose.yml | 13 ++++++++++++ .../group/hidden/light/bath_light.yaml | 1 - zigbee2mqtt/host/100-zigbee.rules | 1 + zigbee2mqtt/host/add-udev-rule.sh | 3 +++ .../settings/configuration.yaml.sample | 21 +++++++++++++++++++ zigbee2mqtt/settings/state.json | 1 + 10 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 zigbee2mqtt/host/100-zigbee.rules create mode 100755 zigbee2mqtt/host/add-udev-rule.sh create mode 100644 zigbee2mqtt/settings/configuration.yaml.sample create mode 100644 zigbee2mqtt/settings/state.json diff --git a/Makefile b/Makefile index f65a1af..e447b1e 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,8 @@ update_secrets_sample: @find . -name *.env | xargs -I{} cp {} {}.sample @find . -name *.env.sample | xargs -I{} sed -i "s/\=.*/\=xxxxxxxxx/g" {} + @cat zigbee2mqtt/settings/configuration.yaml | sed "s/\:.*/\: xxxxxxxxx/g" > zigbee2mqtt/settings/configuration.yaml.sample #mask passwords + commit: update_secrets_sample git add . git commit -m "$(call ARGS,\"updating configuration\")" diff --git a/appdaemon/settings/apps/light/kitchen_led_controller.py b/appdaemon/settings/apps/light/kitchen_led_controller.py index 8d248a4..1523b20 100644 --- a/appdaemon/settings/apps/light/kitchen_led_controller.py +++ b/appdaemon/settings/apps/light/kitchen_led_controller.py @@ -4,15 +4,16 @@ import globals class KitchenLedController(hass.Hass): listen_event_handle_list = [] def initialize(self): - if not globals.check_args(self,['watch_entity', 'topic']): + if not globals.check_args(self,['watch_entity']): return self.listen_event_handle_list.append(self.listen_state(self.entity_changed, self.args['watch_entity'])) def entity_changed(self, entity, attribute, old, new, kwargs): - stete = "off" - if new == "off": - stete = "off" - if new == "on": - stete = "on" - self.call_service("mqtt/publish", topic = self.args['topic'], payload = stete) + if 'topic' in self.args: + self.call_service("mqtt/publish", topic = self.args['topic'], payload = new) + if 'control_entity' in self.args: + if new == "on": + self.turn_on(self.args['control_entity']) + if new == "off": + self.turn_off(self.args['control_entity']) \ No newline at end of file diff --git a/appdaemon/settings/apps/light/kitchen_led_controller.yaml b/appdaemon/settings/apps/light/kitchen_led_controller.yaml index e7b22f5..d298aa2 100644 --- a/appdaemon/settings/apps/light/kitchen_led_controller.yaml +++ b/appdaemon/settings/apps/light/kitchen_led_controller.yaml @@ -8,3 +8,11 @@ kitchen_led_controller: topic: home/kitchen-led/kitchen-led/state/set global_dependencies: - globals + +bath_led_controller: + module: kitchen_led_controller + class: KitchenLedController + watch_entity: light.bath + control_entity: light.philips_led + global_dependencies: + - globals \ No newline at end of file diff --git a/appdaemon/settings/apps/timers/airfresher.py b/appdaemon/settings/apps/timers/airfresher.py index 69507a8..488b0a0 100644 --- a/appdaemon/settings/apps/timers/airfresher.py +++ b/appdaemon/settings/apps/timers/airfresher.py @@ -17,7 +17,7 @@ import datetime class AirFresher(hass.Hass): timers = [] fresh_times = 0 - fresh_every_mins = 10 + fresh_every_mins = 15 last_fresh_date = None def initialize(self): diff --git a/docker-compose.yml b/docker-compose.yml index 2bb45ff..349d8ba 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -123,6 +123,19 @@ services: options: max-size: 50m + zigbee2mqtt: + image: koenkk/zigbee2mqtt:latest-dev + container_name: zigbee2mqtt + volumes: + - ./zigbee2mqtt/settings:/app/data + devices: + - /dev/zigbee:/dev/ttyACM0 + privileged: true + restart: always + logging: + driver: json-file + options: + max-size: 50m ########################### # GRAFANA # ########################### diff --git a/hass/settings/configuration/group/hidden/light/bath_light.yaml b/hass/settings/configuration/group/hidden/light/bath_light.yaml index c598bf8..e1fe650 100644 --- a/hass/settings/configuration/group/hidden/light/bath_light.yaml +++ b/hass/settings/configuration/group/hidden/light/bath_light.yaml @@ -3,4 +3,3 @@ bath_light: control: hidden entities: - light.bath - - light.philips_led \ No newline at end of file diff --git a/zigbee2mqtt/host/100-zigbee.rules b/zigbee2mqtt/host/100-zigbee.rules new file mode 100644 index 0000000..17d520d --- /dev/null +++ b/zigbee2mqtt/host/100-zigbee.rules @@ -0,0 +1 @@ +SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="zigbee" diff --git a/zigbee2mqtt/host/add-udev-rule.sh b/zigbee2mqtt/host/add-udev-rule.sh new file mode 100755 index 0000000..6db063d --- /dev/null +++ b/zigbee2mqtt/host/add-udev-rule.sh @@ -0,0 +1,3 @@ +#!/bin/bash +sudo cp 100-zigbee.rules /etc/udev/rules.d/ +sudo udevadm trigger diff --git a/zigbee2mqtt/settings/configuration.yaml.sample b/zigbee2mqtt/settings/configuration.yaml.sample new file mode 100644 index 0000000..2167305 --- /dev/null +++ b/zigbee2mqtt/settings/configuration.yaml.sample @@ -0,0 +1,21 @@ +# Home Assistant integration (MQTT discovery) +homeassistant: xxxxxxxxx + +# allow new devices to join +permit_join: xxxxxxxxx + +# MQTT settings +mqtt: xxxxxxxxx + # MQTT base topic for zigbee2mqtt MQTT messages + base_topic: xxxxxxxxx + # MQTT server URL + server: xxxxxxxxx + # MQTT server authentication, uncomment if required: xxxxxxxxx + user: xxxxxxxxx + password: xxxxxxxxx + +# Serial settings +serial: xxxxxxxxx + # Location of CC2531 USB sniffer + port: xxxxxxxxx + diff --git a/zigbee2mqtt/settings/state.json b/zigbee2mqtt/settings/state.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/zigbee2mqtt/settings/state.json @@ -0,0 +1 @@ +{} \ No newline at end of file