比較提交

...

9 次程式碼提交

共有 13 個檔案被更改,包括 111380 行新增48541 行删除

查看文件

@ -1,4 +1,4 @@
# git helper Makefile: Version 2.5 (2025-08-11) # git helper Makefile: Version 2.6 (2025-08-11)
default: help default: help
.ONESHELL: .ONESHELL:
@ -73,9 +73,9 @@ init: print_head
if [[ $$OUT =~ "Successfully installed" ]]; then if [[ $$OUT =~ "Successfully installed" ]]; then
echo -e " * \033[1;32m$$req_mod installed.\e[0m" echo -e " * \033[1;32m$$req_mod installed.\e[0m"
elif [[ $$OUT =~ "already satisfied" ]]; then elif [[ $$OUT =~ "already satisfied" ]]; then
echo -e " * \033[1;36m$$req_mod already installed.\e[0m" echo -e " * \033[1;36m$$req_mod already available.\e[0m"
else else
echo -e " * \033[1;31m$$req_mod installation FAILED!\e[0m" echo -e " * \033[1;31m$$req_mod FAILED!\e[0m"
#echo $$OUT #echo $$OUT
fi fi
fi fi

查看文件

@ -8,5 +8,5 @@ COV3_CMD=venv/bin/coverage
coverage: coverage:
$(COV3_CMD) erase $(COV3_CMD) erase
$(COV3_CMD) run -a --branch --source=devdi,devices,function smart_brain.py $(COV3_CMD) run -a --branch --source=devdi,smart_devices,devices,function smart_brain.py
$(COV3_CMD) xml -o ../smart_brain_test/testresults/coverage.xml $(COV3_CMD) xml -o ../smart_brain_test/testresults/coverage.xml

檔案差異因為檔案過大而無法顯示 載入差異

檔案差異因為檔案過大而無法顯示 載入差異

未顯示二進位檔案。

查看文件

@ -1,6 +1,5 @@
import geo import geo
import logging import logging
from topics import *
DEBUG = False DEBUG = False
# #

2
devdi

@ -1 +1 @@
Subproject commit f0b994ef9c3a0526c4b699c491ccb478bc3847d0 Subproject commit 0e45aed92670510d7125b529a26d72f556a40924

查看文件

@ -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_pure_switch
from smart_devices.videv import videv_multistate from smart_devices.videv import videv_multistate
from smart_devices.videv import videv_audio_player from smart_devices.videv import videv_audio_player
from smart_devices.videv import videv_all_off
try: try:
from config import APP_NAME as ROOT_LOGGER_NAME from config import APP_NAME as ROOT_LOGGER_NAME
except ImportError: except ImportError:

查看文件

@ -2,15 +2,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
import config import config
from devdi import rooms as devdi_rooms
from devdi.topic import STOP_EXECUTION_TOPIC from devdi.topic import STOP_EXECUTION_TOPIC
import devices
from function.garden import garden from function.garden import garden
from function.stairway import stairway from function.stairway import stairway
from function.ground_floor_west import ground_floor_west from function.ground_floor_west import ground_floor_west
from function.first_floor_west import first_floor_west from function.first_floor_west import first_floor_west
from function.first_floor_east import first_floor_east from function.first_floor_east import first_floor_east
from function.rooms import room_collection from function.rooms import room_collection
from smart_devices.videv import all_off, videv_pure_switch
import json import json
import logging import logging
import mqtt import mqtt
@ -22,9 +21,10 @@ except ImportError:
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__) logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
class all_functions(room_collection): class all_functions(room_collection, devdi_rooms.collection):
def __init__(self, mqtt_client: mqtt.mqtt_client): def __init__(self, mqtt_client: mqtt.mqtt_client):
super().__init__(mqtt_client) super().__init__(mqtt_client)
devdi_rooms.collection.__init__(self, mqtt_client)
# #
self.run = True self.run = True
if config.DEBUG: if config.DEBUG:
@ -72,7 +72,7 @@ class all_functions(room_collection):
def init_off_functionality(self): def init_off_functionality(self):
# ALL OFF - Virtual device # ALL OFF - Virtual device
self.videv_all_off = all_off(self.mqtt_client, config.TOPIC_ALL_OFF_VIDEV, self) self.videv_all_off.connect_room_collection(self)
# ALL OFF - Long push stairway # ALL OFF - Long push stairway
self.stw.stairway.switch_main_light.add_callback(self.stw.stairway.switch_main_light.KEY_LONGPUSH_0, self.stw.stairway.switch_main_light.add_callback(self.stw.stairway.switch_main_light.KEY_LONGPUSH_0,
@ -85,7 +85,8 @@ class all_functions(room_collection):
self.ffe.floor.switch_main_light.add_callback(self.ffe.floor.switch_main_light.KEY_LONGPUSH_0, True, self.ffe.all_off) 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 # FFE ALL OFF - Long push input device
self.ffe.sleep.input_device.add_callback(devices.tradfri_button.KEY_ACTION, devices.tradfri_button.ACTION_RIGHT_LONG, self.ffe.all_off) 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)
# FFW ALL OFF - Long push ffw_floor # FFW ALL OFF - Long push ffw_floor
self.ffw.floor.switch_main_light.add_callback(self.ffw.floor.switch_main_light.KEY_LONGPUSH_0, self.ffw.floor.switch_main_light.add_callback(self.ffw.floor.switch_main_light.KEY_LONGPUSH_0,
@ -93,9 +94,6 @@ class all_functions(room_collection):
self.ffw.floor.switch_main_light.add_callback(self.ffw.floor.switch_main_light.KEY_LONGPUSH_0, True, self.ffw.all_off) 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): 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.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.ffw.summer_mode)
self.videv_summer_mode.add_callback(self.videv_summer_mode.KEY_STATE, None, self.ffe.summer_mode) self.videv_summer_mode.add_callback(self.videv_summer_mode.KEY_STATE, None, self.ffe.summer_mode)

查看文件

@ -13,6 +13,8 @@ logger = logging.getLogger(ROOT_LOGGER_NAME).getChild(__name__)
class room(object): class room(object):
ADD_TO_VIDEV_ALL_OFF = None
def __init__(self, mqtt_client): def __init__(self, mqtt_client):
self.mqtt_client = mqtt_client self.mqtt_client = mqtt_client
@ -20,7 +22,7 @@ class room(object):
logger.info("Switching all off \"%s\"", type(self).__name__) logger.info("Switching all off \"%s\"", type(self).__name__)
for name, obj in inspect.getmembers(self): for name, obj in inspect.getmembers(self):
try: try:
if obj.__module__.startswith('devices'): if obj.__module__.startswith('smart_devices'):
obj.all_off() obj.all_off()
except AttributeError: except AttributeError:
pass # not a module or has no method all_off pass # not a module or has no method all_off
@ -33,7 +35,7 @@ class room(object):
class room_collection(object): class room_collection(object):
ALLOWED_CLASSES = ("room", "room_collection") ADD_TO_VIDEV_ALL_OFF = None
def __init__(self, mqtt_client): def __init__(self, mqtt_client):
self.mqtt_client = mqtt_client self.mqtt_client = mqtt_client
@ -49,6 +51,8 @@ class room_collection(object):
sub.all_off() sub.all_off()
except AttributeError: except AttributeError:
pass # don't mind, if sub has no method all_off 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): 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__) logger.info("Changing to %s \"%s\"", "summer mode" if data else "winter_mode", type(self).__name__)
@ -56,7 +60,7 @@ class room_collection(object):
# attribute name is not private # attribute name is not private
if not sub_name.startswith("__"): if not sub_name.startswith("__"):
sub = getattr(self, sub_name) sub = getattr(self, sub_name)
if sub.__class__.__bases__[0].__name__ in self.ALLOWED_CLASSES: if isinstance(sub, (room, room_collection)):
sub.summer_mode(data) sub.summer_mode(data)
def all_devices(self, object_to_analyse=None, depth=0): def all_devices(self, object_to_analyse=None, depth=0):

查看文件

@ -12,7 +12,7 @@ logger = report.default_logging_config()
VERS_MAJOR = 1 VERS_MAJOR = 1
VERS_MINOR = 4 VERS_MINOR = 4
VERS_PATCH = 0 VERS_PATCH = 3
INFO_TOPIC = "__info__" INFO_TOPIC = "__info__"
INFO_DATA = { INFO_DATA = {

@ -1 +1 @@
Subproject commit 6f57eebee5341b2c7bd50a05dc08aafb590aa3e7 Subproject commit c75c0cfacd48e9d51817f128539f96487cef2f98

查看文件

@ -1,5 +0,0 @@
#
# TOPICS
#
TOPIC_ALL_OFF_VIDEV = "videv/off"
TOPIC_ALL_SUMMER_WINTER_MODE = "videv/summer_mode"