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

Commit

Permalink
0.1.72 (#389)
Browse files Browse the repository at this point in the history
* Add support for Bosch Smart Home ETRV's (#371)

The ETRV's of Bosch Smart Home use a different device identification

* jsonRpcPost SSL #372

* Bump version

* Refactor #372

* Add HmIP-HAP (Lan-Router for CCU) (#375)

Starting with CCU3 version 3.53.26 HmIP-HAP (Access Point) can be used as LAN-Router.

* Fix HmIP-SRD has no low_bat (#377)

* add HB-WDS40-THP-O as weatherstation sensor (#378)

Co-authored-by: Mike Gersbacher <[email protected]>

* Fix press_long event for IP Key Dimmer devices (#379)

* Fix press_short, press_long event for IP Switch devices (#380)

* Fix press_short, press_long event for IP Switch devices

* Fix lint error

* Allow only some devices for PRESS_SHORT/LONG event and use correct channels

* Add support for HmIP-eTRV-C-2 (#388)

Closes #387

* Update changelog

* LOW_BAT for HmIP-PCBS-BAT #386

* Support HmIP-STE2-PCB #383

* Final changelog

Co-authored-by: Nico Müller <[email protected]>
Co-authored-by: dfigus <[email protected]>
Co-authored-by: SukramJ <[email protected]>
Co-authored-by: SuperMasterPhoenix <[email protected]>
Co-authored-by: Mike Gersbacher <[email protected]>
Co-authored-by: chriss158 <[email protected]>
Co-authored-by: Dan Klaffenbach <[email protected]>
  • Loading branch information
8 people authored Mar 14, 2021
1 parent 0e4cf8b commit b771ab8
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 9 deletions.
14 changes: 13 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
Verson 0.1.71 (2021-01-01)
Version 0.1.72 (2021-03-14)
- Disable TLS-check in JSON-RPC (Issue #372) @danielperna84
- Improve some HmIP-remotes @SukramJ
- Support Bosch ETRVs @niecore
- Support HmIP-eTRV-C-2 @klada
- Fix press-events von HmIP devices @chiss158
- Support HB-WDS40-THP-O @SuperMasterPhoenix
- Remove low_bat for HmIP-SRD @SujramJ
- Support HmIP-HAP @dfigus
- Add low_bat for HmIP-PCBS-BAT @danielperna84
- Support for HmIP-STE2-PCB @danielperna84

Version 0.1.71 (2021-01-01)
- Improve naming of covers @weissm
- Add support for HmIP-DRSI1 (Issue #353) @lukasriegel
- Add support for HmIP-WRCC2 @Remko76
Expand Down
9 changes: 7 additions & 2 deletions pyhomematic/_hm.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,22 +358,27 @@ def readdedDevice(self, interface_id, addresses):
self.systemcallback('readdedDevice', interface_id, addresses)
return True

def jsonRpcPost(self, host, jsonport, method, params={}):
def jsonRpcPost(self, host, jsonport, method, params={}, verify=False):
LOG.debug("RPCFunctions.jsonRpcPost: Method: %s" % method)
try:
payload = json.dumps(
{"method": method, "params": params, "jsonrpc": "1.1", "id": 0}).encode('utf-8')

headers = {"Content-Type": 'application/json',
"Content-Length": len(payload)}
ctx = None
if jsonport == 443:
apiendpoint = "https://%s:%s%s" % (host, jsonport, JSONRPC_URL)
if not verify:
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
else:
apiendpoint = "http://%s:%s%s" % (host, jsonport, JSONRPC_URL)
LOG.debug("RPCFunctions.jsonRpcPost: API-Endpoint: %s" %
apiendpoint)
req = urllib.request.Request(apiendpoint, payload, headers)
resp = urllib.request.urlopen(req)
resp = urllib.request.urlopen(req, context=ctx)
if resp.status == 200:
try:
return json.loads(resp.read().decode('utf-8'))
Expand Down
29 changes: 26 additions & 3 deletions pyhomematic/devicetypes/actors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pyhomematic.devicetypes.helper import (
HelperWorking, HelperActorState, HelperActorLevel, HelperActorBlindTilt, HelperActionOnTime,
HelperActionPress, HelperEventRemote, HelperWired, HelperRssiPeer, HelperRssiDevice, HelperDeviceTemperature,
HelperInhibit)
HelperInhibit, HelperLowBatIP)

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -185,7 +185,7 @@ def __init__(self, device_description, proxy, resolveparamsets=False):

# init metadata
self.EVENTNODE.update({"PRESS_SHORT": [1, 2],
"PRESS_LONG_RELEASE": [1, 2]})
"PRESS_LONG": [1, 2]})

@property
def ELEMENT(self):
Expand Down Expand Up @@ -531,6 +531,20 @@ class IPSwitch(GenericSwitch, HelperActionOnTime):
"""
Switch turning attached device on or off.
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)

channels = []
if "HMIP-PS" in self.TYPE.upper() or "HmIP-PCBS" in self.TYPE or "HmIP-DRSI1" in self.TYPE or "HmIP-FSI16" in self.TYPE:
channels = [1]
elif "HmIP-MOD-OC8" in self.TYPE:
channels = [1,2,3,4,5,6,7,8]
elif "HmIP-DRSI4" in self.TYPE:
channels = [1,2,3,4]

if channels:
self.EVENTNODE.update({"PRESS_SHORT": channels,
"PRESS_LONG": channels})

@property
def ELEMENT(self):
Expand All @@ -548,6 +562,15 @@ def ELEMENT(self):
return [3]


class IPSwitchBattery(GenericSwitch, HelperActionOnTime, HelperLowBatIP):
"""
Battery powered switch turning attached device on or off.
"""
@property
def ELEMENT(self):
return [3]


class IPKeySwitch(IPSwitch, HMEvent, HelperActionPress):
"""
Switch turning plugged in device on or off and measuring energy consumption.
Expand Down Expand Up @@ -1053,7 +1076,7 @@ def set_color_temp(self, color_temp: float, channel=None):
"HmIP-PS-UK": IPSwitch,
"HmIP-PCBS": IPSwitch,
"HmIP-PCBS2": IPSwitch,
"HmIP-PCBS-BAT": IPSwitch,
"HmIP-PCBS-BAT": IPSwitchBattery,
"HmIP-PMFS": IPSwitch,
"HmIP-MOD-OC8": IPSwitch,
"HmIP-DRSI1": IPSwitch,
Expand Down
49 changes: 47 additions & 2 deletions pyhomematic/devicetypes/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ class SensorHmIPNoVoltage(HMSensor, HelperRssiDevice, HelperLowBatIP):
- but no voltage of batteries"""


class SensorHmIPNoLowbat(HMSensor, HelperRssiDevice, HelperOperatingVoltageIP):
"""Homematic IP sensors always have
- strength of the signal received by the CCU (HelperRssiDevice).
Be aware that HMIP devices have a reversed understanding of PEER
and DEVICE compared to standard HM devices.
- strength of the signal received by the device (HelperRssiPeer).
Be aware that standard HMIP devices have a reversed understanding of PEER
and DEVICE compared to standard HM devices.
- but no low battery status (HelperLowBatIP)
- voltage of the batteries (HelperOperatingVoltageIP)"""


class SensorHmIPNoBattery(HMSensor, HelperRssiDevice):
"""Some Homematic IP sensors have
- strength of the signal received by the CCU (HelperRssiDevice).
Expand All @@ -77,7 +89,7 @@ class SensorHmIPNoBattery(HMSensor, HelperRssiDevice):
- strength of the signal received by the device (HelperRssiPeer).
Be aware that standard HMIP devices have a reversed understanding of PEER
and DEVICE compared to standard HM devices.
- low battery status (HelperLowBatIP)
- but no low battery status (HelperLowBatIP)
- but no voltage of batteries"""


Expand Down Expand Up @@ -795,7 +807,7 @@ def is_temperature_out_of_range(self, channel=None):
return bool(self.getAttributeData("TEMPERATURE_OUT_OF_RANGE", channel))


class IPRainSensor(SensorHmIP):
class IPRainSensor(SensorHmIPNoLowbat):
"""HomeMatic IP Rain sensor HmIP-SRD."""

def __init__(self, device_description, proxy, resolveparamsets=False):
Expand Down Expand Up @@ -1038,6 +1050,36 @@ def get_level(self, channel=None):
def ELEMENT(self):
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

class IPLanRouter(HMSensor):
""" HmIP Lan Router HmIP-HAP"""

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

self.SENSORNODE.update({"CARRIER_SENSE_LEVEL": [0],
"DUTY_CYCLE_LEVEL": [0]})
self.BINARYNODE.update({"DUTY_CYCLE": [0]})

def get_duty_cycle_level(self, channel=None):
return float(self.getSensorData("DUTY_CYCLE_LEVEL", channel))

def get_carrier_sense_level(self, channel=None):
return float(self.getSensorData("CARRIER_SENSE_LEVEL", channel))

class TempModuleSTE2(SensorHmIP):
"""HmIP-STE2-PCB."""

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})

@property
def ELEMENT(self):
return [1, 2, 3]

DEVICETYPES = {
"HM-Sec-SC": ShutterContact,
"HM-Sec-SC-2": ShutterContact,
Expand Down Expand Up @@ -1144,4 +1186,7 @@ def ELEMENT(self):
"HmIP-ASIR-2": IPAlarmSensor,
"HmIP-FALMOT-C12": ValveBox,
"HmIP-SRD": IPRainSensor,
"HmIP-HAP": IPLanRouter,
"HB-WDS40-THP-O": WeatherStation,
"HmIP-STE2-PCB": TempModuleSTE2
}
3 changes: 3 additions & 0 deletions pyhomematic/devicetypes/thermostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ def turnoff(self):
"HmIP-eTRV-B-UK": IPThermostat,
"HmIP-eTRV-B1": IPThermostat,
"HmIP-eTRV-C": IPThermostat,
"HmIP-eTRV-C-2": IPThermostat,
"Thermostat AA": IPThermostat,
"Thermostat AA GB": IPThermostat,
"HmIP-STHD": IPThermostatWall,
"HmIP-STH": IPThermostatWall,
"HmIP-WTH-2": IPThermostatWall2,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def readme():

PACKAGE_NAME = 'pyhomematic'
HERE = os.path.abspath(os.path.dirname(__file__))
VERSION = '0.1.71'
VERSION = '0.1.72'

PACKAGES = find_packages(exclude=['dist', 'build', 'tests'])

Expand Down

0 comments on commit b771ab8

Please sign in to comment.