Skip to content
This repository was archived by the owner on Feb 4, 2024. It is now read-only.

Commit 17903fa

Browse files
danielperna84KnechtieyschroederGagaPeteSebastian Joseph
authored
0.1.73 (#406)
* Bump version * HmIPW-FALMOT-C12 (#396) * Add: HmIPW-FALMOT-C12 * Add: Missing valve channels in RF version * Fix HmIP-STHD and HmIP-STH (#395) * Switch implementation of HmIP-STHD and HmIP-STH to IPThermostatsWall2 The original implementation does not expose all features. They allow the same settings as HmIP-WTH-2. This is tested for HmIP-STHD, but HmIP-STH should work the same. * Remove IPThermostatWall implementation as it is no longer used * Add: Tilt support for shutters (#398) * HmIP-MIO16-PCB (#397) * Add: Support for HmIP-MIO16-PCB * Remove: Not working button code * Add HmIPW-STH (#400) Co-authored-by: Sebastian Joseph <[email protected]> * HM-ES-TX-WM with ES-IEC adapter (#401) Add two fields of "IEC_ENERGY_COUNTER" and two fields of "IEC_POWER" to PowermeterGas class. See also https://github.com/danielperna84/pyhomematic/issues/374. An additional pull requests for HomeAssistant (for unit definition) I will link later. * Add HmIPW-WTH #402 * Fix HmIP-STE2-PCB #399 * Add port-offset 40000 #393 * Lint * Lint * Minor thermostat improvement * Update changelog Co-authored-by: Philipp R <[email protected]> Co-authored-by: Yannic Schröder <[email protected]> Co-authored-by: GagaPete <[email protected]> Co-authored-by: Sebastian Joseph <[email protected]> Co-authored-by: Jan <[email protected]>
1 parent b771ab8 commit 17903fa

File tree

6 files changed

+171
-41
lines changed

6 files changed

+171
-41
lines changed

changelog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Version 0.1.73 (2021-06-06)
2+
- Add support for HmIPW-FALMOT-C12 @Knechtie
3+
- Fix HmIP-STHD and HmIP-STH @yschroeder
4+
- Add tilt-support for shutters @Knechtie
5+
- Add support vor HmIP-MIO16-PCB @Knechtie
6+
- Add HmIPW-STH @GagaPete
7+
- Fix HmIP-STE2-PCB @danielperna84
8+
- Add port-offset 40000 (Issue #393) @danielperna84
9+
- Minor thermostat improvement as provided by @neffs
10+
111
Version 0.1.72 (2021-03-14)
212
- Disable TLS-check in JSON-RPC (Issue #372) @danielperna84
313
- Improve some HmIP-remotes @SukramJ

pyhomematic/_hm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ def jsonRpcPost(self, host, jsonport, method, params={}, verify=False):
378378
LOG.debug("RPCFunctions.jsonRpcPost: API-Endpoint: %s" %
379379
apiendpoint)
380380
req = urllib.request.Request(apiendpoint, payload, headers)
381+
# pylint: disable=consider-using-with
381382
resp = urllib.request.urlopen(req, context=ctx)
382383
if resp.status == 200:
383384
try:
@@ -435,7 +436,9 @@ def addDeviceNames(self, remote):
435436
interface = False
436437
if response['error'] is None and response['result']:
437438
for i in response['result']:
438-
if i['port'] in [self.remotes[remote]['port'], self.remotes[remote]['port'] + 30000]:
439+
if i['port'] in [self.remotes[remote]['port'],
440+
self.remotes[remote]['port'] + 30000,
441+
self.remotes[remote]['port'] + 40000]:
439442
interface = i['name']
440443
break
441444
LOG.debug(
@@ -480,6 +483,7 @@ def addDeviceNames(self, remote):
480483
elif self.remotes[remote]['resolvenames'] == 'xml':
481484
LOG.warning("Resolving names with the XML-API addon will be disabled in a future release. Please switch to json.")
482485
try:
486+
# pylint: disable=consider-using-with
483487
response = urllib.request.urlopen(
484488
"http://%s%s" % (self.remotes[remote]['ip'], XML_API_URL), timeout=5)
485489
device_list = response.read().decode("ISO-8859-1")

pyhomematic/devicetypes/actors.py

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,12 +377,28 @@ def ELEMENT(self):
377377
return [2, 6, 10]
378378
return [1]
379379

380-
class IPWKeyBlindMulti(KeyBlind, HelperDeviceTemperature, HelperWired):
380+
class IPWKeyBlindMulti(KeyBlind, HelperActorBlindTilt,HelperDeviceTemperature, HelperWired):
381381
"""
382382
Multi-blind actor HmIPW-DRBL4
383383
"""
384384
def __init__(self, device_description, proxy, resolveparamsets=False):
385385
super().__init__(device_description, proxy, resolveparamsets)
386+
self._shutter_channels = []
387+
self._blind_channels = []
388+
389+
# Get Operation Mode for Input Channels
390+
for chan in self.ELEMENT:
391+
address_channel = "%s:%i" % (self._ADDRESS, chan -1)
392+
try:
393+
channel_paramset = self._proxy.getParamset(address_channel, "MASTER", 0)
394+
channel_operation_mode = channel_paramset.get("CHANNEL_OPERATION_MODE") if "CHANNEL_OPERATION_MODE" in channel_paramset else 1
395+
if channel_operation_mode == 0:
396+
self._blind_channels.append(chan)
397+
self.WRITENODE.pop("LEVEL_2", None)
398+
else:
399+
self._shutter_channels.append(chan)
400+
except Exception as err:
401+
LOG.error("IPWKeyBlindMulti: Failure to determine channel mode of IPWKeyBlindMulti %s %s", address_channel, err)
386402

387403
# init metadata
388404
self.ATTRIBUTENODE.update({"ACTIVITY_STATE": self.ELEMENT,
@@ -391,6 +407,18 @@ def __init__(self, device_description, proxy, resolveparamsets=False):
391407
self.ACTIONNODE.update({"STOP": self.ELEMENT})
392408
self.WRITENODE.update({"LEVEL": self.ELEMENT})
393409

410+
if len(self._shutter_channels) > 0:
411+
self.WRITENODE.update({"LEVEL_2": self._shutter_channels})
412+
self.SENSORNODE.update({"LEVEL_2": self._shutter_channels})
413+
414+
def close_slats(self, channel=None):
415+
"""Move the shutter up all the way."""
416+
self.set_cover_tilt_position(0.0, channel)
417+
418+
def open_slats(self, channel=None):
419+
"""Move the shutter down all the way."""
420+
self.set_cover_tilt_position(1.0, channel)
421+
394422
@property
395423
def ELEMENT(self):
396424
return [2, 6, 10, 14]
@@ -945,6 +973,51 @@ def set_color_temp(self, color_temp: float, channel=None):
945973

946974
return self.setValue(key="LEVEL", channel=self._temp_channel, value=color_temp)
947975

976+
977+
class IPMultiIOPCB(GenericSwitch, HelperRssiDevice, HelperRssiPeer):
978+
"""HmIP-MIO16-PCB"""
979+
980+
def __init__(self, device_description, proxy, resolveparamsets=False):
981+
982+
# Input channels (analog inputs 0-12V)
983+
self._aic = [1, 4, 7, 10]
984+
# Input channels (digital low active inputs)
985+
self._dic = [13, 14, 15, 16]
986+
# Output channels
987+
# CH18, CH22, CH26, CH30: relay outputs (24 V/0,5 A)
988+
# CH34, CH38, CH42, CH46: open collector outputs (30 V/0,2 A)
989+
self._doc = [18, 22, 26, 30, 34, 38, 42, 46]
990+
991+
super().__init__(device_description, proxy, resolveparamsets)
992+
993+
self._keypress_event_channels = []
994+
self._binarysensor_channels = []
995+
self._channel_operation_mode = 0
996+
997+
# Get Operation Mode for Input Channels
998+
for chan in self._dic:
999+
try:
1000+
self._channel_operation_mode = self._proxy.getParamset("%s:%i" % (self._ADDRESS, chan), "MASTER").get("CHANNEL_OPERATION_MODE", None)
1001+
1002+
if self._channel_operation_mode == 1:
1003+
self._keypress_event_channels.append(chan)
1004+
elif self._channel_operation_mode != 0:
1005+
self._binarysensor_channels.append(chan)
1006+
except Exception as err:
1007+
LOG.error("IPMultiIOPCB: Failure to determine input channel operations mode of IPMultiIOPCB %s:%i %s", self._ADDRESS, chan, err)
1008+
1009+
self.BINARYNODE.update({"STATE": self._binarysensor_channels})
1010+
self.SENSORNODE.update({"VOLTAGE": self._aic})
1011+
# button events not successfully implemented yet (SHORT_PRESS, LOMG_PRESS)
1012+
1013+
def get_voltage(self, channel=None):
1014+
"""Return analog input in V"""
1015+
return float(self.getSensorData("VOLTAGE", channel))
1016+
1017+
@property
1018+
def ELEMENT(self):
1019+
return self._doc
1020+
9481021
DEVICETYPES = {
9491022
"HM-LC-Bl1-SM": Blind,
9501023
"HM-LC-Bl1-SM-2": Blind,
@@ -1111,4 +1184,5 @@ def set_color_temp(self, color_temp: float, channel=None):
11111184
"HM-DW-WM": Dimmer,
11121185
"HM-LC-DW-WM": ColdWarmDimmer,
11131186
"HB-UNI-RGB-LED-CTRL": ColorEffectLight,
1187+
"HmIP-MIO16-PCB": IPMultiIOPCB,
11141188
}

pyhomematic/devicetypes/sensors.py

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ def __init__(self, device_description, proxy, resolveparamsets=False):
220220
self.SENSORNODE.update({"GAS_ENERGY_COUNTER": [1],
221221
"GAS_POWER": [1],
222222
"ENERGY_COUNTER": [1],
223-
"POWER": [1]})
223+
"POWER": [1],
224+
"IEC_ENERGY_COUNTER": [1,2],
225+
"IEC_POWER": [1,2]})
224226

225227
def get_gas_counter(self, channel=None):
226228
"""Return gas counter."""
@@ -238,6 +240,14 @@ def get_power(self, channel=None):
238240
"""Return power counter."""
239241
return float(self.getSensorData("POWER", channel))
240242

243+
def get_iec_energy(self, channel=None):
244+
"""Return iec energy counter."""
245+
return float(self.getSensorData("IEC_ENERGY_COUNTER", channel))
246+
247+
def get_iec_power(self, channel=None):
248+
"""Return iec power counter."""
249+
return float(self.getSensorData("IEC_POWER", channel))
250+
241251

242252
class Smoke(SensorHm, HelperBinaryState):
243253
"""Smoke alarm.
@@ -1048,7 +1058,23 @@ def get_level(self, channel=None):
10481058

10491059
@property
10501060
def ELEMENT(self):
1051-
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
1061+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
1062+
1063+
class ValveBoxW(SensorHmIPW):
1064+
"""Valve Box HmIPW-FALMOT-C12"""
1065+
1066+
def __init__(self, device_description, proxy, resolveparamsets=False):
1067+
super().__init__(device_description, proxy, resolveparamsets)
1068+
1069+
self.SENSORNODE.update({"LEVEL": self.ELEMENT})
1070+
1071+
def get_level(self, channel=None):
1072+
"""Return valve state from 0% to 99%"""
1073+
return float(self.getSensorData("LEVEL", channel))
1074+
1075+
@property
1076+
def ELEMENT(self):
1077+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
10521078

10531079
class IPLanRouter(HMSensor):
10541080
""" HmIP Lan Router HmIP-HAP"""
@@ -1073,8 +1099,8 @@ def __init__(self, device_description, proxy, resolveparamsets=False):
10731099
super().__init__(device_description, proxy, resolveparamsets)
10741100

10751101
# init metadata
1076-
self.SENSORNODE.update({"ACTUAL_TEMPERATURE ": self.ELEMENT,
1077-
"ACTUAL_TEMPERATURE_STATUS ": self.ELEMENT})
1102+
self.SENSORNODE.update({"ACTUAL_TEMPERATURE": self.ELEMENT,
1103+
"ACTUAL_TEMPERATURE_STATUS": self.ELEMENT})
10781104

10791105
@property
10801106
def ELEMENT(self):
@@ -1185,6 +1211,7 @@ def ELEMENT(self):
11851211
"HmIP-ASIR": IPAlarmSensor,
11861212
"HmIP-ASIR-2": IPAlarmSensor,
11871213
"HmIP-FALMOT-C12": ValveBox,
1214+
"HmIPW-FALMOT-C12": ValveBoxW,
11881215
"HmIP-SRD": IPRainSensor,
11891216
"HmIP-HAP": IPLanRouter,
11901217
"HB-WDS40-THP-O": WeatherStation,

0 commit comments

Comments
 (0)