dynamic groups are slow =(
This commit is contained in:
@@ -4,3 +4,172 @@ uptime:
|
|||||||
friendly_name: Аптайм
|
friendly_name: Аптайм
|
||||||
device_type: sensor
|
device_type: sensor
|
||||||
entity_part: "uptime_"
|
entity_part: "uptime_"
|
||||||
|
|
||||||
|
control_tags:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: input_boolean
|
||||||
|
entity_part: "tag_"
|
||||||
|
|
||||||
|
sensor_tags:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: sensor
|
||||||
|
entity_part: "tag_"
|
||||||
|
|
||||||
|
light_control:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: input_boolean
|
||||||
|
entity_part: "_light_control"
|
||||||
|
|
||||||
|
report_control:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: input_boolean
|
||||||
|
entity_part: "_report"
|
||||||
|
|
||||||
|
automation_control:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: input_boolean
|
||||||
|
entities:
|
||||||
|
- input_boolean.presence_control
|
||||||
|
- input_boolean.water_control
|
||||||
|
- input_boolean.water_leak_control
|
||||||
|
- input_boolean.mainroom_climate_control
|
||||||
|
- switch.domofon_mode
|
||||||
|
|
||||||
|
door_sensors:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: binary_sensor
|
||||||
|
entity_part: "door_window_sensor_"
|
||||||
|
orderby: friendly_name
|
||||||
|
|
||||||
|
smoke_sensors:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: binary_sensor
|
||||||
|
entity_part: "smoke_sensor_"
|
||||||
|
|
||||||
|
water_leak_sensors:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: binary_sensor
|
||||||
|
entity_part: "water_leak_sensor_"
|
||||||
|
orderby: friendly_name
|
||||||
|
|
||||||
|
motion_sensors:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: binary_sensor
|
||||||
|
entity_part: "motion_sensor_"
|
||||||
|
orderby: friendly_name
|
||||||
|
|
||||||
|
presence_sensors:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: sensor
|
||||||
|
entities:
|
||||||
|
- sensor.presence_
|
||||||
|
- sensor.toilet_presence
|
||||||
|
|
||||||
|
epd_water_counters:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: sensor
|
||||||
|
entities:
|
||||||
|
- sensor.epd_balance
|
||||||
|
- sensor.counter_hot
|
||||||
|
- sensor.counter_cold
|
||||||
|
- sensor.counter_mosru_hot
|
||||||
|
- sensor.counter_mosru_cold
|
||||||
|
|
||||||
|
power_sensors:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
device_type: sensor
|
||||||
|
entities:
|
||||||
|
- sensor.power_mosenergosbyt_balance
|
||||||
|
- sensor.power_main_total
|
||||||
|
- sensor.power_mosenergosbyt_total
|
||||||
|
- sensor.power_total
|
||||||
|
- sensor.power_voltage
|
||||||
|
- sensor.power_current
|
||||||
|
- sensor.power_frequency
|
||||||
|
- sensor.power_active_power
|
||||||
|
- sensor.power_reactive_power
|
||||||
|
- sensor.power_power_factor
|
||||||
|
|
||||||
|
home_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
entities:
|
||||||
|
- alarm_control_panel.ha_alarm
|
||||||
|
- switch.water_valve
|
||||||
|
- vacuum.xiaomi_vacuum_cleaner
|
||||||
|
- switch.domofon_open
|
||||||
|
- switch.wifi_socket
|
||||||
|
|
||||||
|
room_livingroom_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
expand_group: True
|
||||||
|
entities:
|
||||||
|
- sensor.temperature_158d0001149b3c
|
||||||
|
- sensor.humidity_158d0001149b3c
|
||||||
|
- sensor.xiaomi_airpurifier_air_quality_pm25
|
||||||
|
- group.mainroom_light
|
||||||
|
- light.salt_lamp
|
||||||
|
- cover.curtain_158d0002b0c46a
|
||||||
|
- switch.plug_158d0001104a0c
|
||||||
|
- switch.plug_158d00010dd98d
|
||||||
|
- fan.xiaomi_miio_device
|
||||||
|
- climate.living_room
|
||||||
|
|
||||||
|
room_kitchen_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
expand_group: True
|
||||||
|
entities:
|
||||||
|
- group.kitchen_light
|
||||||
|
- switch.plug_158d0001a68b18
|
||||||
|
- switch.plug_158d0001a68c64
|
||||||
|
- switch.plug_158d0001a4cfb4
|
||||||
|
- switch.plug_158d00020f3a29
|
||||||
|
- switch.plug_158d0002924779
|
||||||
|
- switch.xiaomi_miio_switch
|
||||||
|
|
||||||
|
room_bath_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
entities:
|
||||||
|
- sensor.temperature_158d00012d9ad7
|
||||||
|
- sensor.humidity_158d00012d9ad7
|
||||||
|
- light.bath
|
||||||
|
- light.philips_led
|
||||||
|
- sensor.airfresher_remain
|
||||||
|
|
||||||
|
room_hall_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
entities:
|
||||||
|
- light.hall
|
||||||
|
|
||||||
|
room_balcony_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
expand_group: True
|
||||||
|
entities:
|
||||||
|
- sensor.temperature_158d000117d37a
|
||||||
|
- sensor.humidity_158d000117d37a
|
||||||
|
- group.balcony_light
|
||||||
|
- switch.plug_158d00026ea017
|
||||||
|
|
||||||
|
room_outside_entities:
|
||||||
|
module: groups
|
||||||
|
class: Groups
|
||||||
|
entities:
|
||||||
|
- sensor.temperature_158d000149c128
|
||||||
|
- sensor.humidity_158d000149c128
|
||||||
@@ -54,9 +54,10 @@ class WorkTime(hass.Hass):
|
|||||||
def run_timer(self):
|
def run_timer(self):
|
||||||
if self.arrive_time == None:
|
if self.arrive_time == None:
|
||||||
return
|
return
|
||||||
if self.notify_time<self.datetime():
|
timer_start = self.notify_time
|
||||||
self.notify_time=self.datetime()+datetime.timedelta(seconds=self.notify_every_seconds)
|
if timer_start<self.datetime():
|
||||||
self.timers.append(self.run_every(self.timer_tick, self.notify_time, self.notify_every_seconds))
|
timer_start=self.datetime()+datetime.timedelta(seconds=self.notify_every_seconds)
|
||||||
|
self.timers.append(self.run_every(self.timer_tick, timer_start, self.notify_every_seconds))
|
||||||
|
|
||||||
def leave_event(self, event_id, event_args, kwargs):
|
def leave_event(self, event_id, event_args, kwargs):
|
||||||
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
if 'constraint' in self.args and not self.constrain_input_boolean(self.args['constraint']):
|
||||||
@@ -78,6 +79,7 @@ class WorkTime(hass.Hass):
|
|||||||
self.log("Monster leave work at {} - {}".format(self.arrive_time, self.datetime))
|
self.log("Monster leave work at {} - {}".format(self.arrive_time, self.datetime))
|
||||||
message = "Рабочий день окончен ({}-{}). Приятной дороги домой.{}".format(self.format_time(self.arrive_time), self.format_time(self.datetime()), travelTime)
|
message = "Рабочий день окончен ({}-{}). Приятной дороги домой.{}".format(self.format_time(self.arrive_time), self.format_time(self.datetime()), travelTime)
|
||||||
self.notify(message, name = self.args['notify'])
|
self.notify(message, name = self.args['notify'])
|
||||||
|
# self.reset_timer_tick(None)
|
||||||
|
|
||||||
def timer_tick(self, args) -> None:
|
def timer_tick(self, args) -> None:
|
||||||
self.log('timer tick')
|
self.log('timer tick')
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ entity_config:
|
|||||||
light.yeelight_mono1_34ce0087ff33:
|
light.yeelight_mono1_34ce0087ff33:
|
||||||
name: "Люстра"
|
name: "Люстра"
|
||||||
room: "Гостиная"
|
room: "Гостиная"
|
||||||
|
light.salt_lamp:
|
||||||
|
name: "Соляная лампа"
|
||||||
|
room: "Гостиная"
|
||||||
switch.wifi_socket:
|
switch.wifi_socket:
|
||||||
name: "Гирлянда"
|
name: "Гирлянда"
|
||||||
room: "Гостиная"
|
room: "Гостиная"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
payload_not_available: "false"
|
payload_not_available: "false"
|
||||||
state_topic: "home/noolite/ch0/power"
|
state_topic: "home/noolite/ch0/power"
|
||||||
command_topic: "home/noolite/ch0/power/set"
|
command_topic: "home/noolite/ch0/power/set"
|
||||||
|
on_command_type: first
|
||||||
payload_on: "on"
|
payload_on: "on"
|
||||||
payload_off: "off"
|
payload_off: "off"
|
||||||
brightness_state_topic: "home/noolite/ch0/brightness"
|
brightness_state_topic: "home/noolite/ch0/brightness"
|
||||||
|
|||||||
+110
-126
@@ -1,19 +1,13 @@
|
|||||||
|
|
||||||
#custom cards
|
# This file was automatically generated by lovelace_migrate.py
|
||||||
resources:
|
# https://github.com/dale3h/python-lovelace
|
||||||
- url: /community_plugin/auto-entities/auto-entities.js
|
|
||||||
type: module
|
|
||||||
- url: /community_plugin/lovelace-auto-entities/auto-entities.js
|
|
||||||
type: module
|
|
||||||
|
|
||||||
title: Home
|
title: Home
|
||||||
views:
|
views:
|
||||||
- title: "Статус"
|
- title: "Статус"
|
||||||
icon: mdi:home
|
icon: mdi:home
|
||||||
cards:
|
cards:
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Дом"
|
title: "Дом"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
@@ -22,28 +16,7 @@ views:
|
|||||||
- vacuum.xiaomi_vacuum_cleaner
|
- vacuum.xiaomi_vacuum_cleaner
|
||||||
- switch.domofon_open
|
- switch.domofon_open
|
||||||
- switch.wifi_socket
|
- switch.wifi_socket
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Ванная"
|
|
||||||
show_header_toggle: false
|
|
||||||
entities:
|
|
||||||
- sensor.temperature_158d00012d9ad7
|
|
||||||
- sensor.humidity_158d00012d9ad7
|
|
||||||
- light.bath
|
|
||||||
- light.philips_led
|
|
||||||
- sensor.airfresher_remain
|
|
||||||
- type: custom:auto-entities
|
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Улица"
|
|
||||||
show_header_toggle: false
|
|
||||||
entities:
|
|
||||||
- sensor.temperature_158d000149c128
|
|
||||||
- sensor.humidity_158d000149c128
|
|
||||||
- type: custom:auto-entities
|
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Гостиная"
|
title: "Гостиная"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
@@ -61,9 +34,7 @@ views:
|
|||||||
- switch.plug_158d00010dd98d
|
- switch.plug_158d00010dd98d
|
||||||
- fan.xiaomi_miio_device
|
- fan.xiaomi_miio_device
|
||||||
- climate.living_room
|
- climate.living_room
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Кухня"
|
title: "Кухня"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
@@ -75,16 +46,21 @@ views:
|
|||||||
- switch.plug_158d00020f3a29
|
- switch.plug_158d00020f3a29
|
||||||
- switch.plug_158d0002924779
|
- switch.plug_158d0002924779
|
||||||
- switch.xiaomi_miio_switch
|
- switch.xiaomi_miio_switch
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
title: "Ванная"
|
||||||
type: entities
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- sensor.temperature_158d00012d9ad7
|
||||||
|
- sensor.humidity_158d00012d9ad7
|
||||||
|
- light.bath
|
||||||
|
- light.philips_led
|
||||||
|
- sensor.airfresher_remain
|
||||||
|
- type: entities
|
||||||
title: "Прихожая"
|
title: "Прихожая"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
- light.hall
|
- light.hall
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Балкон"
|
title: "Балкон"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
@@ -93,83 +69,83 @@ views:
|
|||||||
- sensor.temperature_158d000117d37a
|
- sensor.temperature_158d000117d37a
|
||||||
- sensor.humidity_158d000117d37a
|
- sensor.humidity_158d000117d37a
|
||||||
- switch.plug_158d00026ea017
|
- switch.plug_158d00026ea017
|
||||||
|
- type: entities
|
||||||
|
title: "Улица"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- sensor.temperature_158d000149c128
|
||||||
|
- sensor.humidity_158d000149c128
|
||||||
- title: "Датчики"
|
- title: "Датчики"
|
||||||
icon: mdi:nfc
|
icon: mdi:nfc
|
||||||
cards:
|
cards:
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Движение"
|
title: "Движение"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
filter:
|
entities:
|
||||||
include:
|
- binary_sensor.motion_sensor_158d0000e7c7ad
|
||||||
- entity_id: "/sensor.motion_sensor_.*/"
|
- binary_sensor.motion_sensor_158d0002044548
|
||||||
sort:
|
- binary_sensor.motion_sensor_158d0000fbc664
|
||||||
method: name
|
- binary_sensor.motion_sensor_158d0001535c97
|
||||||
- type: custom:auto-entities
|
- binary_sensor.motion_sensor_158d0000f9546b
|
||||||
card:
|
- binary_sensor.motion_sensor_158d000165fed5
|
||||||
type: entities
|
- binary_sensor.motion_sensor_158d0001537e21
|
||||||
|
- binary_sensor.motion_sensor_158d0000f6b2fa
|
||||||
|
- binary_sensor.motion_sensor_158d0001e50ce4
|
||||||
|
- binary_sensor.motion_sensor_158d0001e80f0d
|
||||||
|
- type: entities
|
||||||
title: "Протечка"
|
title: "Протечка"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
filter:
|
entities:
|
||||||
include:
|
- binary_sensor.water_leak_sensor_158d0001d594fa
|
||||||
- entity_id: "/sensor.water_leak_sensor_.*/"
|
- binary_sensor.water_leak_sensor_158d0001c34960
|
||||||
sort:
|
- binary_sensor.water_leak_sensor_158d0002150c07
|
||||||
method: name
|
- binary_sensor.water_leak_sensor_158d0002112b98
|
||||||
- type: custom:auto-entities
|
- binary_sensor.water_leak_sensor_158d0002113158
|
||||||
card:
|
- binary_sensor.water_leak_sensor_158d00023a48f0
|
||||||
type: entities
|
- type: entities
|
||||||
title: "Датчики дыма"
|
title: "Датчики дыма"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
filter:
|
entities:
|
||||||
include:
|
- binary_sensor.smoke_sensor_158d00023115ad
|
||||||
- entity_id: "/sensor.smoke_sensor_.*/"
|
- type: entities
|
||||||
sort:
|
|
||||||
method: name
|
|
||||||
- type: custom:auto-entities
|
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Двери"
|
title: "Двери"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
filter:
|
entities:
|
||||||
include:
|
- binary_sensor.door_window_sensor_158d0001130141
|
||||||
- entity_id: "/sensor.door_window_sensor_.*/"
|
- binary_sensor.door_window_sensor_158d000111a469
|
||||||
sort:
|
- binary_sensor.door_window_sensor_158d00010f7e19
|
||||||
method: name
|
- binary_sensor.door_window_sensor_158d0002254373
|
||||||
- type: custom:auto-entities
|
- binary_sensor.door_window_sensor_158d0001b77b1b
|
||||||
card:
|
- binary_sensor.door_window_sensor_158d0001c0e46d
|
||||||
type: entities
|
- binary_sensor.door_window_sensor_158d0001e74660
|
||||||
|
- binary_sensor.door_window_sensor_158d0001b711ec
|
||||||
|
- type: entities
|
||||||
title: "Счетчики воды"
|
title: "Счетчики воды"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
- sensor.epd_balance
|
- sensor.epd_balance
|
||||||
- sensor.counter_hot
|
|
||||||
- sensor.counter_cold
|
- sensor.counter_cold
|
||||||
- sensor.counter_mosru_hot
|
- sensor.counter_hot
|
||||||
- sensor.counter_mosru_cold
|
- sensor.counter_mosru_cold
|
||||||
- type: custom:auto-entities
|
- sensor.counter_mosru_hot
|
||||||
card:
|
- type: entities
|
||||||
type: entities
|
|
||||||
title: "Метки"
|
title: "Метки"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
filter:
|
entities:
|
||||||
include:
|
- sensor.tag_mamik_band
|
||||||
- entity_id: "/sensor.tag_.*/"
|
- sensor.tag_monster_nut
|
||||||
- type: custom:auto-entities
|
- sensor.tag_nut_blue
|
||||||
card:
|
- sensor.tag_nut_white
|
||||||
type: entities
|
- sensor.tag_nut_guest
|
||||||
|
- type: entities
|
||||||
title: "Пристутствие"
|
title: "Пристутствие"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
|
- sensor.presence_hall
|
||||||
|
- sensor.presence_kitchen
|
||||||
|
- sensor.presence_balcony
|
||||||
- sensor.toilet_presence
|
- sensor.toilet_presence
|
||||||
filter:
|
- type: entities
|
||||||
include:
|
|
||||||
- entity_id: "/sensor.presence_.*/"
|
|
||||||
sort:
|
|
||||||
method: name
|
|
||||||
- type: custom:auto-entities
|
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Электропитание"
|
title: "Электропитание"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
@@ -196,13 +172,15 @@ views:
|
|||||||
icon: mdi:alarm
|
icon: mdi:alarm
|
||||||
cards:
|
cards:
|
||||||
- type: entities
|
- type: entities
|
||||||
title: "Будильник (будни)"
|
title: "Будильник (бу\
|
||||||
|
дни)"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
- input_boolean.alarmclock_weekdays
|
- input_boolean.alarmclock_weekdays
|
||||||
- input_datetime.alarmclock_weekdays
|
- input_datetime.alarmclock_weekdays
|
||||||
- type: entities
|
- type: entities
|
||||||
title: "Будильник (выходные)"
|
title: "Будильник (вы\
|
||||||
|
ходные)"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
- input_boolean.alarmclock_weekend
|
- input_boolean.alarmclock_weekend
|
||||||
@@ -340,18 +318,19 @@ views:
|
|||||||
- title: "Настройки"
|
- title: "Настройки"
|
||||||
icon: mdi:settings
|
icon: mdi:settings
|
||||||
cards:
|
cards:
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
title: "Контроль све\
|
||||||
type: entities
|
та"
|
||||||
title: "Контроль света"
|
show_header_toggle: true
|
||||||
show_header_toggle: false
|
entities:
|
||||||
filter:
|
- input_boolean.mainroom_light_control
|
||||||
include:
|
- input_boolean.hall_light_control
|
||||||
- entity_id: "/input_boolean..*_light_control/"
|
- input_boolean.bath_light_control
|
||||||
- type: custom:auto-entities
|
- input_boolean.kitchen_light_control
|
||||||
card:
|
- input_boolean.balcony_light_control
|
||||||
type: entities
|
- type: entities
|
||||||
title: "Настройки автоматики"
|
title: "Настройки ав\
|
||||||
|
томатики"
|
||||||
show_header_toggle: true
|
show_header_toggle: true
|
||||||
entities:
|
entities:
|
||||||
- input_boolean.presence_control
|
- input_boolean.presence_control
|
||||||
@@ -359,30 +338,35 @@ views:
|
|||||||
- input_boolean.water_leak_control
|
- input_boolean.water_leak_control
|
||||||
- input_boolean.mainroom_climate_control
|
- input_boolean.mainroom_climate_control
|
||||||
- switch.domofon_mode
|
- switch.domofon_mode
|
||||||
- type: custom:auto-entities
|
- type: entities
|
||||||
card:
|
|
||||||
type: entities
|
|
||||||
title: "Настройки отчетов"
|
title: "Настройки отчетов"
|
||||||
show_header_toggle: true
|
show_header_toggle: true
|
||||||
filter:
|
entities:
|
||||||
include:
|
- input_boolean.security_sensors_report
|
||||||
- entity_id: "/input_boolean..*_report/"
|
- input_boolean.battery_report
|
||||||
- type: custom:auto-entities
|
- input_boolean.water_counters_report
|
||||||
card:
|
- input_boolean.work_presence_report
|
||||||
type: entities
|
- input_boolean.lock_report
|
||||||
|
- type: entities
|
||||||
title: "Метки"
|
title: "Метки"
|
||||||
show_header_toggle: true
|
show_header_toggle: true
|
||||||
filter:
|
entities:
|
||||||
include:
|
- input_boolean.tag_mamik_band
|
||||||
- entity_id: "/input_boolean.tag_.*/"
|
- input_boolean.tag_monster_nut
|
||||||
- type: custom:auto-entities
|
- input_boolean.tag_nut_blue
|
||||||
card:
|
- input_boolean.tag_nut_white
|
||||||
type: entities
|
- input_boolean.tag_nut_guest
|
||||||
|
- type: entities
|
||||||
title: "Аптайм"
|
title: "Аптайм"
|
||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
filter:
|
entities:
|
||||||
include:
|
- sensor.uptime_airfresher
|
||||||
- entity_id: "/sensor.uptime_.*/"
|
- sensor.uptime_bath
|
||||||
|
- sensor.uptime_domofon
|
||||||
|
- sensor.uptime_kitchen_led
|
||||||
|
- sensor.uptime_nest
|
||||||
|
- sensor.uptime_bathlight
|
||||||
|
- sensor.uptime_kitchen
|
||||||
- title: "Информация"
|
- title: "Информация"
|
||||||
icon: mdi:monitor-multiple
|
icon: mdi:monitor-multiple
|
||||||
cards:
|
cards:
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import noolite
|
import noolite
|
||||||
|
import queue
|
||||||
|
import threading
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -23,7 +25,29 @@ config = {
|
|||||||
|
|
||||||
Homie = homie.Homie(config)
|
Homie = homie.Homie(config)
|
||||||
nodes = {}
|
nodes = {}
|
||||||
n = noolite.NooLite()
|
q = queue.Queue()
|
||||||
|
t = None
|
||||||
|
|
||||||
|
def queuee_worker():
|
||||||
|
n = noolite.NooLite()
|
||||||
|
while True:
|
||||||
|
item = q.get()
|
||||||
|
if item is None:
|
||||||
|
break
|
||||||
|
command = item.get('command', None)
|
||||||
|
channel = item.get('channel', None)
|
||||||
|
args = item.get('args', None)
|
||||||
|
if command == 'on':
|
||||||
|
n.on(channel)
|
||||||
|
elif command == 'off':
|
||||||
|
n.off(channel)
|
||||||
|
elif command == 'set':
|
||||||
|
n.set(channel, args)
|
||||||
|
elif command == 'bind':
|
||||||
|
n.bind(channel)
|
||||||
|
elif command == 'quit':
|
||||||
|
q.task_done()
|
||||||
|
time.sleep(0.3)
|
||||||
|
|
||||||
def brightnessHandler(mqttc, obj, msg):
|
def brightnessHandler(mqttc, obj, msg):
|
||||||
try:
|
try:
|
||||||
@@ -41,7 +65,7 @@ def brightnessHandler(mqttc, obj, msg):
|
|||||||
brightness = int(payload)
|
brightness = int(payload)
|
||||||
ch_num = int(channel.replace('ch',''))
|
ch_num = int(channel.replace('ch',''))
|
||||||
logger.info("[{}] brightness: {}".format(channel, brightness))
|
logger.info("[{}] brightness: {}".format(channel, brightness))
|
||||||
n.set(ch_num, brightness)
|
q.put({'command':'set', 'channel':ch_num,'args':brightness})
|
||||||
node.setProperty("brightness").send(brightness)
|
node.setProperty("brightness").send(brightness)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Something gone wrong in brightnessHandler: {}!".format(e))
|
logger.error("Something gone wrong in brightnessHandler: {}!".format(e))
|
||||||
@@ -57,7 +81,7 @@ def bindHandler(mqttc, obj, msg):
|
|||||||
return true
|
return true
|
||||||
node = nodes[channel]
|
node = nodes[channel]
|
||||||
ch_num = int(channel.replace('ch',''))
|
ch_num = int(channel.replace('ch',''))
|
||||||
n.bind(ch_num)
|
q.put({'command':'bind', 'channel':ch_num})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Something gone wrong in bindHandler: {}!".format(e))
|
logger.error("Something gone wrong in bindHandler: {}!".format(e))
|
||||||
|
|
||||||
@@ -74,11 +98,11 @@ def powerHandler(mqttc, obj, msg):
|
|||||||
ch_num = int(channel.replace('ch',''))
|
ch_num = int(channel.replace('ch',''))
|
||||||
if payload == 'on' or payload == 'true':
|
if payload == 'on' or payload == 'true':
|
||||||
logger.info("[{}] Power: on".format(channel))
|
logger.info("[{}] Power: on".format(channel))
|
||||||
n.on(ch_num)
|
q.put({'command':'on', 'channel':ch_num})
|
||||||
node.setProperty("power").send("on")
|
node.setProperty("power").send("on")
|
||||||
else:
|
else:
|
||||||
logger.info("[{}] Power: off".format(channel))
|
logger.info("[{}] Power: off".format(channel))
|
||||||
n.off(ch_num)
|
q.put({'command':'off', 'channel':ch_num})
|
||||||
node.setProperty("power").send("off")
|
node.setProperty("power").send("off")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Something gone wrong in powerHandler: {}!".format(e))
|
logger.error("Something gone wrong in powerHandler: {}!".format(e))
|
||||||
@@ -102,6 +126,8 @@ def main():
|
|||||||
nodes[nodeName]=node
|
nodes[nodeName]=node
|
||||||
|
|
||||||
Homie.setup()
|
Homie.setup()
|
||||||
|
t = threading.Thread(target=queuee_worker)
|
||||||
|
t.start()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -110,4 +136,6 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
main()
|
main()
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
|
q.put({'command':'quit'})
|
||||||
|
t.join()
|
||||||
logger.info("Quitting.")
|
logger.info("Quitting.")
|
||||||
Reference in New Issue
Block a user