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

Commit

Permalink
Merge pull request #130 from danielperna84/devel
Browse files Browse the repository at this point in the history
0.1.41
  • Loading branch information
danielperna84 authored Apr 10, 2018
2 parents be4c102 + 5337fd3 commit 2d41f48
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.1.41 (2018-04-10)
- Added HmIP-SWDO-I @smoldaner
- Added HmIP-SWO-PR @pascalhahn

Version 0.1.40 (2018-03-20)
- Added HmIP-SMO-A @danielperna84
- Added HmIP-STHO(-A) @danielperna84
Expand Down
60 changes: 60 additions & 0 deletions pyhomematic/devicetypes/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,64 @@ def is_raining(self, channel=None):
return bool(self.getBinaryData("RAINING", channel))


class IPWeatherSensor(HMSensor, HMBinarySensor):
"""HomeMatic IP Weather sensor."""

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

# init metadata
self.SENSORNODE.update({"ACTUAL_TEMPERATURE": [1],
"HUMIDITY": [1],
"RAIN_COUNTER": [1],
"WIND_SPEED": [1],
"WIND_DIR": [1],
"WIND_DIR_RANGE": [1],
"SUNSHINEDURATION": [1],
"ILLUMINATION": [1]})
self.BINARYNODE.update({"RAINING": [1]})
self.ATTRIBUTENODE.update({"LOW_BAT": [0],
"ERROR_CODE": [0],
"OPERATING_VOLTAGE": [0],
"TEMPERATURE_OUT_OF_RANGE": [0]})

def get_temperature(self, channel=None):
return float(self.getSensorData("ACTUAL_TEMPERATURE", channel))

def get_humidity(self, channel=None):
return int(self.getSensorData("HUMIDITY", channel))

def get_rain_counter(self, channel=None):
return float(self.getSensorData("RAIN_COUNTER", channel))

def get_wind_speed(self, channel=None):
return float(self.getSensorData("WIND_SPEED", channel))

def get_wind_direction(self, channel=None):
return int(self.getSensorData("WIND_DIR", channel))

def get_wind_direction_range(self, channel=None):
return int(self.getSensorData("WIND_DIR_RANGE", channel))

def get_sunshineduration(self, channel=None):
return int(self.getSensorData("SUNSHINEDURATION", channel))

def get_brightness(self, channel=None):
return int(self.getSensorData("ILLUMINATION", channel))

def get_operating_voltage(self, channel=None):
return float(self.getAttributeData("OPERATING_VOLTAGE", channel))

def is_raining(self, channel=None):
return bool(self.getBinaryData("RAINING", channel))

def is_low_batt(self, channel=None):
return bool(self.getAttributeData("LOW_BAT", channel))

def is_temperature_out_of_range(self, channel=None):
return bool(self.getAttributeData("TEMPERATURE_OUT_OF_RANGE", channel))


class WeatherStation(HMSensor):
"""Weather station."""

Expand Down Expand Up @@ -521,6 +579,7 @@ def get_air_pressure(self, channel=None):
"HM-SCI-3-FM": IPShutterContact,
"HMIP-SWDO": IPShutterContact,
"HmIP-SWDO": IPShutterContact,
"HmIP-SWDO-I": IPShutterContact,
"HmIP-SRH": RotaryHandleSensor,
"HM-Sec-RHS": RotaryHandleSensor,
"ZEL STG RM FDK": RotaryHandleSensor,
Expand Down Expand Up @@ -567,6 +626,7 @@ def get_air_pressure(self, channel=None):
"KS888": WeatherSensor,
"KS550Tech": WeatherSensor,
"KS550LC": WeatherSensor,
"HmIP-SWO-PR": IPWeatherSensor,
"WS550": WeatherStation,
"WS888": WeatherStation,
"WS550Tech": WeatherStation,
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.40'
VERSION = '0.1.41'

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

Expand Down
7 changes: 4 additions & 3 deletions tests/test_pyhomematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

logging.basicConfig(level=logging.INFO)
LOG = logging.getLogger(__name__)
STARTUP_DELAY = 2
DEFAULT_IP = "127.0.0.1"
DEFAULT_PORT = 2001
DEFAULT_INTERFACE_CLIENT = "test"
Expand Down Expand Up @@ -70,7 +71,7 @@ def test_0_pyhomematic_noinit(self):
}
)
client.start()
time.sleep(2)
time.sleep(STARTUP_DELAY)
servicemessages = client.getServiceMessages(DEFAULT_REMOTE)
self.assertEqual(len(servicemessages), 1)
self.assertEqual(servicemessages[0][0], 'VCU0000001:1')
Expand All @@ -90,7 +91,7 @@ def test_1_pyhomematic_init(self):
}
)
client.start()
time.sleep(2)
time.sleep(STARTUP_DELAY)
servicemessages = client.getServiceMessages(DEFAULT_REMOTE)
self.assertEqual(len(servicemessages), 1)
self.assertEqual(servicemessages[0][0], 'VCU0000001:1')
Expand Down Expand Up @@ -123,7 +124,7 @@ def setUp(self):
}
)
self.client.start()
time.sleep(2)
time.sleep(STARTUP_DELAY)

def tearDown(self):
LOG.debug("TestPyhomematicDevices.tearDown")
Expand Down

0 comments on commit 2d41f48

Please sign in to comment.