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

Commit

Permalink
0.1.73 (#406)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
6 people authored Jun 6, 2021
1 parent b771ab8 commit 17903fa
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 41 deletions.
10 changes: 10 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Version 0.1.73 (2021-06-06)
- Add support for HmIPW-FALMOT-C12 @Knechtie
- Fix HmIP-STHD and HmIP-STH @yschroeder
- Add tilt-support for shutters @Knechtie
- Add support vor HmIP-MIO16-PCB @Knechtie
- Add HmIPW-STH @GagaPete
- Fix HmIP-STE2-PCB @danielperna84
- Add port-offset 40000 (Issue #393) @danielperna84
- Minor thermostat improvement as provided by @neffs

Version 0.1.72 (2021-03-14)
- Disable TLS-check in JSON-RPC (Issue #372) @danielperna84
- Improve some HmIP-remotes @SukramJ
Expand Down
6 changes: 5 additions & 1 deletion pyhomematic/_hm.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ def jsonRpcPost(self, host, jsonport, method, params={}, verify=False):
LOG.debug("RPCFunctions.jsonRpcPost: API-Endpoint: %s" %
apiendpoint)
req = urllib.request.Request(apiendpoint, payload, headers)
# pylint: disable=consider-using-with
resp = urllib.request.urlopen(req, context=ctx)
if resp.status == 200:
try:
Expand Down Expand Up @@ -435,7 +436,9 @@ def addDeviceNames(self, remote):
interface = False
if response['error'] is None and response['result']:
for i in response['result']:
if i['port'] in [self.remotes[remote]['port'], self.remotes[remote]['port'] + 30000]:
if i['port'] in [self.remotes[remote]['port'],
self.remotes[remote]['port'] + 30000,
self.remotes[remote]['port'] + 40000]:
interface = i['name']
break
LOG.debug(
Expand Down Expand Up @@ -480,6 +483,7 @@ def addDeviceNames(self, remote):
elif self.remotes[remote]['resolvenames'] == 'xml':
LOG.warning("Resolving names with the XML-API addon will be disabled in a future release. Please switch to json.")
try:
# pylint: disable=consider-using-with
response = urllib.request.urlopen(
"http://%s%s" % (self.remotes[remote]['ip'], XML_API_URL), timeout=5)
device_list = response.read().decode("ISO-8859-1")
Expand Down
76 changes: 75 additions & 1 deletion pyhomematic/devicetypes/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,28 @@ def ELEMENT(self):
return [2, 6, 10]
return [1]

class IPWKeyBlindMulti(KeyBlind, HelperDeviceTemperature, HelperWired):
class IPWKeyBlindMulti(KeyBlind, HelperActorBlindTilt,HelperDeviceTemperature, HelperWired):
"""
Multi-blind actor HmIPW-DRBL4
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
self._shutter_channels = []
self._blind_channels = []

# Get Operation Mode for Input Channels
for chan in self.ELEMENT:
address_channel = "%s:%i" % (self._ADDRESS, chan -1)
try:
channel_paramset = self._proxy.getParamset(address_channel, "MASTER", 0)
channel_operation_mode = channel_paramset.get("CHANNEL_OPERATION_MODE") if "CHANNEL_OPERATION_MODE" in channel_paramset else 1
if channel_operation_mode == 0:
self._blind_channels.append(chan)
self.WRITENODE.pop("LEVEL_2", None)
else:
self._shutter_channels.append(chan)
except Exception as err:
LOG.error("IPWKeyBlindMulti: Failure to determine channel mode of IPWKeyBlindMulti %s %s", address_channel, err)

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

if len(self._shutter_channels) > 0:
self.WRITENODE.update({"LEVEL_2": self._shutter_channels})
self.SENSORNODE.update({"LEVEL_2": self._shutter_channels})

def close_slats(self, channel=None):
"""Move the shutter up all the way."""
self.set_cover_tilt_position(0.0, channel)

def open_slats(self, channel=None):
"""Move the shutter down all the way."""
self.set_cover_tilt_position(1.0, channel)

@property
def ELEMENT(self):
return [2, 6, 10, 14]
Expand Down Expand Up @@ -945,6 +973,51 @@ def set_color_temp(self, color_temp: float, channel=None):

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


class IPMultiIOPCB(GenericSwitch, HelperRssiDevice, HelperRssiPeer):
"""HmIP-MIO16-PCB"""

def __init__(self, device_description, proxy, resolveparamsets=False):

# Input channels (analog inputs 0-12V)
self._aic = [1, 4, 7, 10]
# Input channels (digital low active inputs)
self._dic = [13, 14, 15, 16]
# Output channels
# CH18, CH22, CH26, CH30: relay outputs (24 V/0,5 A)
# CH34, CH38, CH42, CH46: open collector outputs (30 V/0,2 A)
self._doc = [18, 22, 26, 30, 34, 38, 42, 46]

super().__init__(device_description, proxy, resolveparamsets)

self._keypress_event_channels = []
self._binarysensor_channels = []
self._channel_operation_mode = 0

# Get Operation Mode for Input Channels
for chan in self._dic:
try:
self._channel_operation_mode = self._proxy.getParamset("%s:%i" % (self._ADDRESS, chan), "MASTER").get("CHANNEL_OPERATION_MODE", None)

if self._channel_operation_mode == 1:
self._keypress_event_channels.append(chan)
elif self._channel_operation_mode != 0:
self._binarysensor_channels.append(chan)
except Exception as err:
LOG.error("IPMultiIOPCB: Failure to determine input channel operations mode of IPMultiIOPCB %s:%i %s", self._ADDRESS, chan, err)

self.BINARYNODE.update({"STATE": self._binarysensor_channels})
self.SENSORNODE.update({"VOLTAGE": self._aic})
# button events not successfully implemented yet (SHORT_PRESS, LOMG_PRESS)

def get_voltage(self, channel=None):
"""Return analog input in V"""
return float(self.getSensorData("VOLTAGE", channel))

@property
def ELEMENT(self):
return self._doc

DEVICETYPES = {
"HM-LC-Bl1-SM": Blind,
"HM-LC-Bl1-SM-2": Blind,
Expand Down Expand Up @@ -1111,4 +1184,5 @@ def set_color_temp(self, color_temp: float, channel=None):
"HM-DW-WM": Dimmer,
"HM-LC-DW-WM": ColdWarmDimmer,
"HB-UNI-RGB-LED-CTRL": ColorEffectLight,
"HmIP-MIO16-PCB": IPMultiIOPCB,
}
35 changes: 31 additions & 4 deletions pyhomematic/devicetypes/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ def __init__(self, device_description, proxy, resolveparamsets=False):
self.SENSORNODE.update({"GAS_ENERGY_COUNTER": [1],
"GAS_POWER": [1],
"ENERGY_COUNTER": [1],
"POWER": [1]})
"POWER": [1],
"IEC_ENERGY_COUNTER": [1,2],
"IEC_POWER": [1,2]})

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

def get_iec_energy(self, channel=None):
"""Return iec energy counter."""
return float(self.getSensorData("IEC_ENERGY_COUNTER", channel))

def get_iec_power(self, channel=None):
"""Return iec power counter."""
return float(self.getSensorData("IEC_POWER", channel))


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

@property
def ELEMENT(self):
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

class ValveBoxW(SensorHmIPW):
"""Valve Box HmIPW-FALMOT-C12"""

def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)

self.SENSORNODE.update({"LEVEL": self.ELEMENT})

def get_level(self, channel=None):
"""Return valve state from 0% to 99%"""
return float(self.getSensorData("LEVEL", channel))

@property
def ELEMENT(self):
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

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

# init metadata
self.SENSORNODE.update({"ACTUAL_TEMPERATURE ": self.ELEMENT,
"ACTUAL_TEMPERATURE_STATUS ": self.ELEMENT})
self.SENSORNODE.update({"ACTUAL_TEMPERATURE": self.ELEMENT,
"ACTUAL_TEMPERATURE_STATUS": self.ELEMENT})

@property
def ELEMENT(self):
Expand Down Expand Up @@ -1185,6 +1211,7 @@ def ELEMENT(self):
"HmIP-ASIR": IPAlarmSensor,
"HmIP-ASIR-2": IPAlarmSensor,
"HmIP-FALMOT-C12": ValveBox,
"HmIPW-FALMOT-C12": ValveBoxW,
"HmIP-SRD": IPRainSensor,
"HmIP-HAP": IPLanRouter,
"HB-WDS40-THP-O": WeatherStation,
Expand Down
Loading

0 comments on commit 17903fa

Please sign in to comment.