Порівняти коміти
No commits in common. "master" and "v1.4.0" have entirely different histories.
6
Makefile
6
Makefile
@ -1,4 +1,4 @@
|
||||
# git helper Makefile: Version 2.6 (2025-08-11)
|
||||
# git helper Makefile: Version 2.5 (2025-08-11)
|
||||
default: help
|
||||
|
||||
.ONESHELL:
|
||||
@ -73,9 +73,9 @@ init: print_head
|
||||
if [[ $$OUT =~ "Successfully installed" ]]; then
|
||||
echo -e " * \033[1;32m$$req_mod installed.\e[0m"
|
||||
elif [[ $$OUT =~ "already satisfied" ]]; then
|
||||
echo -e " * \033[1;36m$$req_mod already available.\e[0m"
|
||||
echo -e " * \033[1;36m$$req_mod already installed.\e[0m"
|
||||
else
|
||||
echo -e " * \033[1;31m$$req_mod FAILED!\e[0m"
|
||||
echo -e " * \033[1;31m$$req_mod installation FAILED!\e[0m"
|
||||
#echo $$OUT
|
||||
fi
|
||||
fi
|
||||
|
@ -8,5 +8,5 @@ COV3_CMD=venv/bin/coverage
|
||||
|
||||
coverage:
|
||||
$(COV3_CMD) erase
|
||||
$(COV3_CMD) run -a --branch --source=devdi,smart_devices,devices,function smart_brain.py
|
||||
$(COV3_CMD) run -a --branch --source=devdi,devices,function smart_brain.py
|
||||
$(COV3_CMD) xml -o ../smart_brain_test/testresults/coverage.xml
|
||||
|
Різницю між файлами не показано, бо вона завелика
Завантажити різницю
150763
_testresults_/testrun.json
150763
_testresults_/testrun.json
Різницю між файлами не показано, бо вона завелика
Завантажити різницю
Бінарний файл не відображається.
@ -1,5 +1,6 @@
|
||||
import geo
|
||||
import logging
|
||||
from topics import *
|
||||
|
||||
DEBUG = False
|
||||
#
|
||||
|
2
devdi
2
devdi
@ -1 +1 @@
|
||||
Subproject commit 0e45aed92670510d7125b529a26d72f556a40924
|
||||
Subproject commit f0b994ef9c3a0526c4b699c491ccb478bc3847d0
|
@ -28,7 +28,7 @@ from smart_devices.videv import videv_heating as videv_hea
|
||||
from smart_devices.videv import videv_pure_switch
|
||||
from smart_devices.videv import videv_multistate
|
||||
from smart_devices.videv import videv_audio_player
|
||||
from smart_devices.videv import videv_all_off
|
||||
|
||||
try:
|
||||
from config import APP_NAME as ROOT_LOGGER_NAME
|
||||
except ImportError:
|
||||
|
@ -2,14 +2,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
import config
|
||||
from devdi import rooms as devdi_rooms
|
||||
from devdi.topic import STOP_EXECUTION_TOPIC
|
||||
import devices
|
||||
from function.garden import garden
|
||||
from function.stairway import stairway
|
||||
from function.ground_floor_west import ground_floor_west
|
||||
from function.first_floor_west import first_floor_west
|
||||
from function.first_floor_east import first_floor_east
|
||||
from function.rooms import room_collection
|
||||
from smart_devices.videv import all_off, videv_pure_switch
|
||||
import json
|
||||
import logging
|
||||
import mqtt
|
||||
@ -21,10 +22,9 @@ except ImportError:
|
||||
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
|
||||
|
||||
class all_functions(room_collection, devdi_rooms.collection):
|
||||
class all_functions(room_collection):
|
||||
def __init__(self, mqtt_client: mqtt.mqtt_client):
|
||||
super().__init__(mqtt_client)
|
||||
devdi_rooms.collection.__init__(self, mqtt_client)
|
||||
#
|
||||
self.run = True
|
||||
if config.DEBUG:
|
||||
@ -72,7 +72,7 @@ class all_functions(room_collection, devdi_rooms.collection):
|
||||
|
||||
def init_off_functionality(self):
|
||||
# ALL OFF - Virtual device
|
||||
self.videv_all_off.connect_room_collection(self)
|
||||
self.videv_all_off = all_off(self.mqtt_client, config.TOPIC_ALL_OFF_VIDEV, self)
|
||||
|
||||
# ALL OFF - Long push stairway
|
||||
self.stw.stairway.switch_main_light.add_callback(self.stw.stairway.switch_main_light.KEY_LONGPUSH_0,
|
||||
@ -85,8 +85,7 @@ class all_functions(room_collection, devdi_rooms.collection):
|
||||
self.ffe.floor.switch_main_light.add_callback(self.ffe.floor.switch_main_light.KEY_LONGPUSH_0, True, self.ffe.all_off)
|
||||
|
||||
# FFE ALL OFF - Long push input device
|
||||
self.ffe.sleep.input_device.add_callback(self.ffe.sleep.input_device.KEY_ACTION,
|
||||
self.ffe.sleep.input_device.ACTION_RIGHT_LONG, self.ffe.all_off)
|
||||
self.ffe.sleep.input_device.add_callback(devices.tradfri_button.KEY_ACTION, devices.tradfri_button.ACTION_RIGHT_LONG, self.ffe.all_off)
|
||||
|
||||
# FFW ALL OFF - Long push ffw_floor
|
||||
self.ffw.floor.switch_main_light.add_callback(self.ffw.floor.switch_main_light.KEY_LONGPUSH_0,
|
||||
@ -94,6 +93,9 @@ class all_functions(room_collection, devdi_rooms.collection):
|
||||
self.ffw.floor.switch_main_light.add_callback(self.ffw.floor.switch_main_light.KEY_LONGPUSH_0, True, self.ffw.all_off)
|
||||
|
||||
def init_sumer_winter_mode(self):
|
||||
# ALL summer/winter mode
|
||||
self.videv_summer_mode = videv_pure_switch(self.mqtt_client, config.TOPIC_ALL_SUMMER_WINTER_MODE)
|
||||
|
||||
self.videv_summer_mode.add_callback(self.videv_summer_mode.KEY_STATE, None, self.gfw.summer_mode)
|
||||
self.videv_summer_mode.add_callback(self.videv_summer_mode.KEY_STATE, None, self.ffw.summer_mode)
|
||||
self.videv_summer_mode.add_callback(self.videv_summer_mode.KEY_STATE, None, self.ffe.summer_mode)
|
||||
|
@ -13,8 +13,6 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
|
||||
|
||||
|
||||
class room(object):
|
||||
ADD_TO_VIDEV_ALL_OFF = None
|
||||
|
||||
def __init__(self, mqtt_client):
|
||||
self.mqtt_client = mqtt_client
|
||||
|
||||
@ -22,7 +20,7 @@ class room(object):
|
||||
logger.info("Switching all off \"%s\"", type(self).__name__)
|
||||
for name, obj in inspect.getmembers(self):
|
||||
try:
|
||||
if obj.__module__.startswith('smart_devices'):
|
||||
if obj.__module__.startswith('devices'):
|
||||
obj.all_off()
|
||||
except AttributeError:
|
||||
pass # not a module or has no method all_off
|
||||
@ -35,7 +33,7 @@ class room(object):
|
||||
|
||||
|
||||
class room_collection(object):
|
||||
ADD_TO_VIDEV_ALL_OFF = None
|
||||
ALLOWED_CLASSES = ("room", "room_collection")
|
||||
|
||||
def __init__(self, mqtt_client):
|
||||
self.mqtt_client = mqtt_client
|
||||
@ -51,8 +49,6 @@ class room_collection(object):
|
||||
sub.all_off()
|
||||
except AttributeError:
|
||||
pass # don't mind, if sub has no method all_off
|
||||
except:
|
||||
logger.error("Failed to switch off %s (%s)", repr(sub_name), type(sub).__name__)
|
||||
|
||||
def summer_mode(self, device=None, key=None, data=None):
|
||||
logger.info("Changing to %s \"%s\"", "summer mode" if data else "winter_mode", type(self).__name__)
|
||||
@ -60,7 +56,7 @@ class room_collection(object):
|
||||
# attribute name is not private
|
||||
if not sub_name.startswith("__"):
|
||||
sub = getattr(self, sub_name)
|
||||
if isinstance(sub, (room, room_collection)):
|
||||
if sub.__class__.__bases__[0].__name__ in self.ALLOWED_CLASSES:
|
||||
sub.summer_mode(data)
|
||||
|
||||
def all_devices(self, object_to_analyse=None, depth=0):
|
||||
|
@ -12,7 +12,7 @@ logger = report.default_logging_config()
|
||||
|
||||
VERS_MAJOR = 1
|
||||
VERS_MINOR = 4
|
||||
VERS_PATCH = 3
|
||||
VERS_PATCH = 0
|
||||
|
||||
INFO_TOPIC = "__info__"
|
||||
INFO_DATA = {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit c75c0cfacd48e9d51817f128539f96487cef2f98
|
||||
Subproject commit 6f57eebee5341b2c7bd50a05dc08aafb590aa3e7
|
5
topics.py
Normal file
5
topics.py
Normal file
@ -0,0 +1,5 @@
|
||||
#
|
||||
# TOPICS
|
||||
#
|
||||
TOPIC_ALL_OFF_VIDEV = "videv/off"
|
||||
TOPIC_ALL_SUMMER_WINTER_MODE = "videv/summer_mode"
|
Завантаження…
x
Посилання в новій задачі
Block a user