From f0f36270e8b333f58c8dba496813e6de790b1612 Mon Sep 17 00:00:00 2001 From: nao-pon Date: Tue, 1 Oct 2024 21:53:17 +0900 Subject: [PATCH] Add Bathroom dryer --- pychonet/BathroomDryer.py | 75 +++++++++++++++++++++++++++++++++++ pychonet/__init__.py | 36 +++++++++-------- pychonet/lib/epc.py | 2 + pychonet/lib/epc_functions.py | 13 ++++++ 4 files changed, 109 insertions(+), 17 deletions(-) create mode 100644 pychonet/BathroomDryer.py diff --git a/pychonet/BathroomDryer.py b/pychonet/BathroomDryer.py new file mode 100644 index 0000000..e4262e3 --- /dev/null +++ b/pychonet/BathroomDryer.py @@ -0,0 +1,75 @@ +from pychonet.EchonetInstance import EchonetInstance +from pychonet.lib.epc_functions import ( + DICT_41_AUTO_8_LEVELS, + DICT_41_AUTO_STANDARD, + DICT_41_ON_OFF, + DICT_41_YES_NO, + _int, + _signed_int, +) + + +class BathroomDryer(EchonetInstance): + EOJGC = 0x02 + EOJCC = 0x73 + + EPC_FUNCTIONS = { + 0xB0: [ + _int, + { + 0x10: "ventilation", + 0x20: "prewarming", + 0x30: "heating", + 0x40: "drying", + 0x50: "circulation", + 0x60: "mistSauna", + 0x61: "waterMist", + 0x00: "stop", + }, + ], # "Operation setting", + 0xB1: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Ventilation operation setting", + 0xB2: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Bathroom pre-warmer operation setting", + 0xB3: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Bathroom heater operation setting", + 0xB4: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Bathroom dryer operation setting", + 0xB5: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Cool air circulator operation setting", + 0xB6: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Mist sauna operation setting", + 0xB7: [ + _int, + {**DICT_41_AUTO_STANDARD, **DICT_41_AUTO_8_LEVELS}, + ], # "Water mist operation setting", + 0xBA: _int, # "Measured relative bathroom humidity", + 0xBB: _signed_int, # "Measured bathroom temperature", + 0xC2: [_int, DICT_41_AUTO_8_LEVELS], # "Ventilation air flow rate setting", + 0xCF: [_int, DICT_41_ON_OFF], # "Filter cleaning reminder sign setting", + 0xE0: [_int, DICT_41_ON_OFF], # "Human body detection status", + # 0x90: "“ON timer-based reservation” setting 1", + # 0xE1: "“ON timer-based reservation” setting 2", + # 0x91: "ON timer setting (time)", + # 0x92: "ON timer setting (relative time)", + # 0x94: "“OFF timer-based reservation” setting", + # 0x95: "OFF timer setting (time)", + # 0x96: "OFF timer setting (relative time)", + } + + def __init__(self, host, api_connector=None, instance=0x1): + self._eojgc = self.EOJGC + self._eojcc = self.EOJCC + super().__init__(host, self._eojgc, self._eojcc, instance, api_connector) diff --git a/pychonet/__init__.py b/pychonet/__init__.py index d1f3147..a792fba 100644 --- a/pychonet/__init__.py +++ b/pychonet/__init__.py @@ -2,36 +2,37 @@ from pychonet.lib.eojx import EOJX_CLASS from .version import __version__ +from .AutomaticEntranceDoor import AutomaticEntranceDoor +from .BathroomDryer import BathroomDryer +from .CeilingFan import CeilingFan +from .DistributionPanelMeter import DistributionPanelMeter from .EchonetInstance import EchonetInstance from .ElectricBlind import ElectricBlind -from .ElectricShutter import ElectricShutter from .ElectricCurtain import ElectricCurtain -from .ElectricRainSlidingDoor import ElectricRainSlidingDoor +from .ElectricEnergyMeter import ElectricEnergyMeter from .ElectricGate import ElectricGate -from .ElectricWindow import ElectricWindow -from .AutomaticEntranceDoor import AutomaticEntranceDoor from .ElectricLock import ElectricLock +from .ElectricRainSlidingDoor import ElectricRainSlidingDoor +from .ElectricShutter import ElectricShutter from .ElectricVehicleCharger import ElectricVehicleCharger +from .ElectricWaterHeater import ElectricWaterHeater +from .ElectricWindow import ElectricWindow +from .FloorHeater import FloorHeater +from .FuelCell import FuelCell +from .GasMeter import GasMeter from .GeneralLighting import GeneralLighting -from .SingleFunctionLighting import SingleFunctionLighting -from .LightingSystem import LightingSystem from .HomeAirCleaner import HomeAirCleaner from .HomeAirConditioner import HomeAirConditioner from .HomeSolarPower import HomeSolarPower +from .HotWaterGenerator import HotWaterGenerator +from .HybridWaterHeater import HybridWaterHeater +from .LightingSystem import LightingSystem +from .LowVoltageSmartElectricEnergyMeter import LowVoltageSmartElectricEnergyMeter +from .Refrigerator import Refrigerator +from .SingleFunctionLighting import SingleFunctionLighting from .StorageBattery import StorageBattery from .TemperatureSensor import TemperatureSensor -from .DistributionPanelMeter import DistributionPanelMeter -from .LowVoltageSmartElectricEnergyMeter import LowVoltageSmartElectricEnergyMeter -from .HybridWaterHeater import HybridWaterHeater -from .HotWaterGenerator import HotWaterGenerator -from .FloorHeater import FloorHeater -from .FuelCell import FuelCell -from .GasMeter import GasMeter -from .ElectricEnergyMeter import ElectricEnergyMeter from .WaterFlowMeter import WaterFlowMeter -from .CeilingFan import CeilingFan -from .ElectricWaterHeater import ElectricWaterHeater -from .Refrigerator import Refrigerator def Factory(host, server, eojgc, eojcc, eojci=0x01): @@ -56,6 +57,7 @@ def Factory(host, server, eojgc, eojcc, eojci=0x01): f"{0x02}-{0x6B}": ElectricWaterHeater, f"{0x02}-{0x6F}": ElectricLock, f"{0x02}-{0x72}": HotWaterGenerator, + f"{0x02}-{0x73}": BathroomDryer, f"{0x02}-{0x79}": HomeSolarPower, f"{0x02}-{0x7B}": FloorHeater, f"{0x02}-{0x7C}": FuelCell, diff --git a/pychonet/lib/epc.py b/pychonet/lib/epc.py index 67679e0..f5831a2 100644 --- a/pychonet/lib/epc.py +++ b/pychonet/lib/epc.py @@ -689,6 +689,8 @@ 0xB3: "Bathroom heater operation setting", 0xB4: "Bathroom dryer operation setting", 0xB5: "Cool air circulator operation setting", + 0xB6: "Mist sauna operation setting", + 0xB7: "Water mist operation setting", 0xBA: "Measured relative bathroom humidity", 0xBB: "Measured bathroom temperature", 0xC2: "Ventilation air flow rate setting", diff --git a/pychonet/lib/epc_functions.py b/pychonet/lib/epc_functions.py index cbe7df4..a365a24 100644 --- a/pychonet/lib/epc_functions.py +++ b/pychonet/lib/epc_functions.py @@ -17,6 +17,7 @@ DICT_41_ON_OFF = {0x41: DATA_STATE_ON, 0x42: DATA_STATE_OFF} DICT_41_YES_NO = {0x41: "yes", 0x42: "no"} DICT_41_AUTO_NONAUTO = {0x41: "auto", 0x42: "non-auto"} +DICT_41_AUTO_STANDARD = {0x41: "auto", 0x42: "standard"} DICT_41_UNLOCK_LOCK = {0x42: DATA_STATE_UNLOCK, 0x41: DATA_STATE_LOCK} DICT_41_OPEN_CLOSED = {0x41: DATA_STATE_OPEN, 0x42: DATA_STATE_CLOSE} DICT_41_ENABLED_DISABLED = {0x41: "enabled", 0x42: "disabled"} @@ -59,6 +60,18 @@ 0x43: "temporarily_disabled", } +DICT_41_AUTO_8_LEVELS = { + 0x41: "auto", + 0x31: "level-1", + 0x32: "level-2", + 0x33: "level-3", + 0x34: "level-4", + 0x35: "level-5", + 0x36: "level-6", + 0x37: "level-7", + 0x38: "level-8", +} + def _swap_dict(d: dict): return {v: k for k, v in d.items()}