Skip to content

Commit

Permalink
Fix ENERGY Home and IOptionalFeaturesFilteredMulticastRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-th committed Oct 25, 2023
1 parent 548c1a2 commit eafdc97
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 126 deletions.
4 changes: 1 addition & 3 deletions hmip_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,9 +811,7 @@ def main():
for p in group.profiles:
isActive = p.id == group.activeProfile.id
print(
"Index: {} - Id: {} - Name: {} - Active: {}".format(
p.index, p.id, p.name, isActive
)
f"Index: {p.index} - Id: {p.id} - Name: {p.name} - Active: {isActive} (Enabled: {p.enabled}, Visible: {p.visible})"
)

if args.group_shutter_level:
Expand Down
1 change: 1 addition & 0 deletions homematicip/base/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ class AutomationRuleType(AutoNameEnum):
class FunctionalHomeType(AutoNameEnum):
ACCESS_CONTROL = auto()
INDOOR_CLIMATE = auto()
ENERGY = auto()
LIGHT_AND_SHADOW = auto()
SECURITY_AND_ALARM = auto()
WEATHER_AND_ENVIRONMENT = auto()
Expand Down
4 changes: 3 additions & 1 deletion homematicip/base/functionalChannels.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def set_slats_level(self, slatsLevel=0.0, shutterLevel=None):
"""
if shutterLevel is None:
shutterLevel = self.shutterLevel

data = {
"channelIndex": self.index,
"deviceId": self.device.id,
Expand Down Expand Up @@ -1265,12 +1265,14 @@ def __init__(self, device, connection):
self.dutyCycleLevel = 0.0
self.accessPointPriority = 0
self.signalBrightness = 0
self.filteredMulticastRoutingEnabled = None

def from_json(self, js, groups: Iterable[Group]):
super().from_json(js, groups)
self.set_attr_from_dict("dutyCycleLevel", js)
self.set_attr_from_dict("accessPointPriority", js)
self.set_attr_from_dict("signalBrightness", js)
self.set_attr_from_dict("filteredMulticastRoutingEnabled", js)


class DeviceSabotageChannel(DeviceBaseChannel):
Expand Down
1 change: 1 addition & 0 deletions homematicip/class_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@

TYPE_FUNCTIONALHOME_MAP = {
FunctionalHomeType.INDOOR_CLIMATE: IndoorClimateHome,
FunctionalHomeType.ENERGY: EnergyHome,
FunctionalHomeType.LIGHT_AND_SHADOW: LightAndShadowHome,
FunctionalHomeType.SECURITY_AND_ALARM: SecurityAndAlarmHome,
FunctionalHomeType.WEATHER_AND_ENVIRONMENT: WeatherAndEnvironmentHome,
Expand Down
1 change: 1 addition & 0 deletions homematicip/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class Device(BaseDevice):
"IOptionalFeatureDisplayContrast": [],
"IOptionalFeatureMountingOrientation": ["mountingOrientation"],
"IOptionalFeatureControlsMountingOrientation": ["controlsMountingOrientation"],
"IOptionalFeatureFilteredMulticastRouter": ["filteredMulticastRoutingEnabled"],
}

def __init__(self, connection):
Expand Down
4 changes: 4 additions & 0 deletions homematicip/functionalHomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def from_json(self, js, groups: List[Group]):
)


class EnergyHome(FunctionalHome):
pass


class WeatherAndEnvironmentHome(FunctionalHome):
pass

Expand Down
241 changes: 123 additions & 118 deletions homematicip_demo/json_data/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@
"deviceUndervoltage": false,
"dutyCycle": false,
"dutyCycleLevel": 8.0,
"filteredMulticastRoutingEnabled": true,
"functionalChannelType": "ACCESS_CONTROLLER_CHANNEL",
"groupIndex": 0,
"groups": [],
Expand Down Expand Up @@ -488,6 +489,7 @@
"deviceUndervoltage": false,
"dutyCycle": false,
"dutyCycleLevel": 8.0,
"filteredMulticastRoutingEnabled": true,
"functionalChannelType": "ACCESS_CONTROLLER_CHANNEL",
"groupIndex": 0,
"groups": [],
Expand Down Expand Up @@ -10758,125 +10760,123 @@
"updateState": "UP_TO_DATE"
},
"3014F7110000000000ETRVCL": {
"automaticValveAdaptionNeeded": false,
"availableFirmwareVersion": "1.0.14",
"connectionType": "HMIP_RF",
"deviceArchetype": "HMIP",
"firmwareVersion": "1.0.14",
"firmwareVersionInteger": 65550,
"functionalChannels": {
"0": {
"busConfigMismatch": null,
"coProFaulty": false,
"coProRestartNeeded": false,
"coProUpdateFailure": null,
"configPending": false,
"controlsMountingOrientation": null,
"daliBusState": null,
"defaultLinkedGroup": [],
"deviceCommunicationError": null,
"deviceDriveError": null,
"deviceDriveModeError": null,
"deviceId": "3014F7110000000000ETRVCL",
"deviceOperationMode": null,
"deviceOverheated": false,
"deviceOverloaded": false,
"devicePowerFailureDetected": false,
"deviceUndervoltage": false,
"displayContrast": null,
"dutyCycle": false,
"functionalChannelType": "DEVICE_OPERATIONLOCK_WITH_SABOTAGE",
"groupIndex": 0,
"groups": [
"00000000-0000-0000-0000-000000000018"
],
"index": 0,
"label": "",
"lockJammed": null,
"lowBat": false,
"mountingOrientation": null,
"multicastRoutingEnabled": false,
"operationLockActive": false,
"particulateMatterSensorCommunicationError": null,
"particulateMatterSensorError": null,
"powerShortCircuit": null,
"profilePeriodLimitReached": null,
"routerModuleEnabled": false,
"routerModuleSupported": false,
"rssiDeviceValue": -52,
"rssiPeerValue": -53,
"sabotage": null,
"shortCircuitDataLine": null,
"supportedOptionalFeatures": {
"IFeatureBusConfigMismatch": false,
"IFeatureDeviceCoProError": false,
"IFeatureDeviceCoProRestart": false,
"IFeatureDeviceCoProUpdate": true,
"IFeatureDeviceCommunicationError": false,
"IFeatureDeviceDaliBusError": false,
"IFeatureDeviceDriveError": false,
"IFeatureDeviceDriveModeError": false,
"IFeatureDeviceIdentify": false,
"IFeatureDeviceOverheated": false,
"IFeatureDeviceOverloaded": false,
"IFeatureDeviceParticulateMatterSensorCommunicationError": false,
"IFeatureDeviceParticulateMatterSensorError": false,
"IFeatureDevicePowerFailure": false,
"IFeatureDeviceTemperatureHumiditySensorCommunicationError": false,
"IFeatureDeviceTemperatureHumiditySensorError": false,
"IFeatureDeviceTemperatureOutOfRange": false,
"IFeatureDeviceUndervoltage": false,
"IFeatureMulticastRouter": false,
"IFeaturePowerShortCircuit": false,
"IFeatureProfilePeriodLimit": false,
"IFeatureRssiValue": true,
"IFeatureShortCircuitDataLine": false,
"IOptionalFeatureDefaultLinkedGroup": false,
"IOptionalFeatureDeviceErrorLockJammed": false,
"IOptionalFeatureDeviceOperationMode": false,
"IOptionalFeatureDisplayContrast": false,
"IOptionalFeatureDutyCycle": true,
"IOptionalFeatureLowBat": true,
"IOptionalFeatureMountingOrientation": false
},
"temperatureHumiditySensorCommunicationError": null,
"temperatureHumiditySensorError": null,
"temperatureOutOfRange": false,
"unreach": false
},
"1": {
"channelRole": "HEATING_CONTROLLER",
"deviceId": "3014F7110000000000ETRVCL",
"functionalChannelType": "HEATING_THERMOSTAT_CHANNEL",
"groupIndex": 1,
"groups": [
"00000000-0000-0000-0000-000000000019",
"00000000-0000-0000-0000-000000000021"
],
"index": 1,
"label": "",
"setPointTemperature": 16.0,
"temperatureOffset": 0.0,
"valveActualTemperature": 24.9,
"valvePosition": 0.0,
"valveState": "ADAPTION_DONE"
}
"automaticValveAdaptionNeeded": false,
"availableFirmwareVersion": "1.0.14",
"connectionType": "HMIP_RF",
"deviceArchetype": "HMIP",
"firmwareVersion": "1.0.14",
"firmwareVersionInteger": 65550,
"functionalChannels": {
"0": {
"busConfigMismatch": null,
"coProFaulty": false,
"coProRestartNeeded": false,
"coProUpdateFailure": null,
"configPending": false,
"controlsMountingOrientation": null,
"daliBusState": null,
"defaultLinkedGroup": [],
"deviceCommunicationError": null,
"deviceDriveError": null,
"deviceDriveModeError": null,
"deviceId": "3014F7110000000000ETRVCL",
"deviceOperationMode": null,
"deviceOverheated": false,
"deviceOverloaded": false,
"devicePowerFailureDetected": false,
"deviceUndervoltage": false,
"displayContrast": null,
"dutyCycle": false,
"functionalChannelType": "DEVICE_OPERATIONLOCK_WITH_SABOTAGE",
"groupIndex": 0,
"groups": ["00000000-0000-0000-0000-000000000018"],
"index": 0,
"label": "",
"lockJammed": null,
"lowBat": false,
"mountingOrientation": null,
"multicastRoutingEnabled": false,
"operationLockActive": false,
"particulateMatterSensorCommunicationError": null,
"particulateMatterSensorError": null,
"powerShortCircuit": null,
"profilePeriodLimitReached": null,
"routerModuleEnabled": false,
"routerModuleSupported": false,
"rssiDeviceValue": -52,
"rssiPeerValue": -53,
"sabotage": null,
"shortCircuitDataLine": null,
"supportedOptionalFeatures": {
"IFeatureBusConfigMismatch": false,
"IFeatureDeviceCoProError": false,
"IFeatureDeviceCoProRestart": false,
"IFeatureDeviceCoProUpdate": true,
"IFeatureDeviceCommunicationError": false,
"IFeatureDeviceDaliBusError": false,
"IFeatureDeviceDriveError": false,
"IFeatureDeviceDriveModeError": false,
"IFeatureDeviceIdentify": false,
"IFeatureDeviceOverheated": false,
"IFeatureDeviceOverloaded": false,
"IFeatureDeviceParticulateMatterSensorCommunicationError": false,
"IFeatureDeviceParticulateMatterSensorError": false,
"IFeatureDevicePowerFailure": false,
"IFeatureDeviceTemperatureHumiditySensorCommunicationError": false,
"IFeatureDeviceTemperatureHumiditySensorError": false,
"IFeatureDeviceTemperatureOutOfRange": false,
"IFeatureDeviceUndervoltage": false,
"IFeatureMulticastRouter": false,
"IFeaturePowerShortCircuit": false,
"IFeatureProfilePeriodLimit": false,
"IFeatureRssiValue": true,
"IFeatureShortCircuitDataLine": false,
"IOptionalFeatureDefaultLinkedGroup": false,
"IOptionalFeatureDeviceErrorLockJammed": false,
"IOptionalFeatureDeviceOperationMode": false,
"IOptionalFeatureDisplayContrast": false,
"IOptionalFeatureDutyCycle": true,
"IOptionalFeatureLowBat": true,
"IOptionalFeatureMountingOrientation": false
},
"temperatureHumiditySensorCommunicationError": null,
"temperatureHumiditySensorError": null,
"temperatureOutOfRange": false,
"unreach": false
},
"homeId": "00000000-0000-0000-0000-000000000001",
"id": "3014F7110000000000ETRVCL",
"label": "Heizk\u00f6rperthermostat Schlafzimmer",
"lastStatusUpdate": 1687826867079,
"liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
"manuallyUpdateForced": false,
"manufacturerCode": 1,
"measuredAttributes": {},
"modelId": 469,
"modelType": "HmIP-eTRV-CL",
"oem": "eQ-3",
"permanentlyReachable": true,
"serializedGlobalTradeItemNumber": "3014F7110000000000ETRVCL",
"type": "HEATING_THERMOSTAT_COMPACT_PLUS",
"updateState": "UP_TO_DATE"
"1": {
"channelRole": "HEATING_CONTROLLER",
"deviceId": "3014F7110000000000ETRVCL",
"functionalChannelType": "HEATING_THERMOSTAT_CHANNEL",
"groupIndex": 1,
"groups": [
"00000000-0000-0000-0000-000000000019",
"00000000-0000-0000-0000-000000000021"
],
"index": 1,
"label": "",
"setPointTemperature": 16.0,
"temperatureOffset": 0.0,
"valveActualTemperature": 24.9,
"valvePosition": 0.0,
"valveState": "ADAPTION_DONE"
}
},
"homeId": "00000000-0000-0000-0000-000000000001",
"id": "3014F7110000000000ETRVCL",
"label": "Heizk\u00f6rperthermostat Schlafzimmer",
"lastStatusUpdate": 1687826867079,
"liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
"manuallyUpdateForced": false,
"manufacturerCode": 1,
"measuredAttributes": {},
"modelId": 469,
"modelType": "HmIP-eTRV-CL",
"oem": "eQ-3",
"permanentlyReachable": true,
"serializedGlobalTradeItemNumber": "3014F7110000000000ETRVCL",
"type": "HEATING_THERMOSTAT_COMPACT_PLUS",
"updateState": "UP_TO_DATE"
},
"3014F7110000000000DSDPCB": {
"availableFirmwareVersion": "1.0.6",
Expand Down Expand Up @@ -12857,6 +12857,11 @@
"optimumStartStopEnabled": false,
"solution": "INDOOR_CLIMATE"
},
"ENERGY": {
"active": false,
"functionalGroups": [],
"solution": "ENERGY"
},
"LIGHT_AND_SHADOW": {
"active": true,
"extendedLinkedShutterGroups": [],
Expand Down
15 changes: 11 additions & 4 deletions tests/test_functional_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
from homematicip.class_maps import TYPE_FUNCTIONALCHANNEL_MAP


def test_access_controller_channel(fake_home: Home):
with no_ssl_verification():
ch = fake_home.search_channel("3014F711A000000BAD0CAAAA", 0)
assert isinstance(ch, AccessControllerChannel)
assert ch.filteredMulticastRoutingEnabled == True


def test_acceleration_sensor_channel(fake_home: Home):
with no_ssl_verification():
ch = fake_home.search_channel("3014F7110000000000000031", 1)
Expand Down Expand Up @@ -117,17 +124,17 @@ def test_device_base_floor_heating_channel(fake_home: Home):

def test_device_operation_lock_channel(fake_home: Home):
with no_ssl_verification():
ch = fake_home.search_channel("3014F7110000000000000015",0)
ch = fake_home.search_channel("3014F7110000000000000015", 0)
assert isinstance(ch, DeviceOperationLockChannel)

ch.set_operation_lock(False)
fake_home.get_current_state()
ch = fake_home.search_channel("3014F7110000000000000015",0)
ch = fake_home.search_channel("3014F7110000000000000015", 0)
assert ch.operationLockActive is False

ch.set_operation_lock(True)
fake_home.get_current_state()
ch = fake_home.search_channel("3014F7110000000000000015",0)
ch = fake_home.search_channel("3014F7110000000000000015", 0)
assert ch.operationLockActive is True


Expand Down

0 comments on commit eafdc97

Please sign in to comment.