Skip to content

Commit

Permalink
Merge pull request #147 from MartinHjelmare/0.14
Browse files Browse the repository at this point in the history
0.14.0
  • Loading branch information
MartinHjelmare authored May 10, 2018
2 parents 4ee8b70 + 3346860 commit d4315ad
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 13 deletions.
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# Change Log

# [0.13.0](https://github.com/theolind/pymysensors/tree/0.13.0) (2018-04-02)
[Full Changelog](https://github.com/theolind/pymysensors/compare/0.12.1...0.13.0)
# [0.14.0](https://github.com/theolind/pymysensors/tree/0.14.0) (2018-05-10)
[Full Changelog](https://github.com/theolind/pymysensors/compare/0.13...0.14.0)

**Merged pull requests:**

- Fix node presentation after id request [\#146](https://github.com/theolind/pymysensors/pull/146) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Scheduled monthly dependency update for May [\#145](https://github.com/theolind/pymysensors/pull/145) ([pyup-bot](https://github.com/pyup-bot))
- Call event callback when gateway is ready [\#144](https://github.com/theolind/pymysensors/pull/144) ([MartinHjelmare](https://github.com/MartinHjelmare))

# [0.13](https://github.com/theolind/pymysensors/tree/0.13) (2018-04-02)
[Full Changelog](https://github.com/theolind/pymysensors/compare/0.12.1...0.13)

**Breaking Changes:**

Expand All @@ -14,6 +23,7 @@

**Merged pull requests:**

- 0.13 [\#138](https://github.com/theolind/pymysensors/pull/138) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Add pyup config file [\#137](https://github.com/theolind/pymysensors/pull/137) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Update changelog generator to use python package [\#136](https://github.com/theolind/pymysensors/pull/136) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Upgrade requirements packages [\#134](https://github.com/theolind/pymysensors/pull/134) ([MartinHjelmare](https://github.com/MartinHjelmare))
Expand Down Expand Up @@ -257,3 +267,4 @@
- Add setup.py [\#4](https://github.com/theolind/pymysensors/pull/4) ([balloob](https://github.com/balloob))
- Fix ValueError issue when decoding a message. [\#2](https://github.com/theolind/pymysensors/pull/2) ([andythigpen](https://github.com/andythigpen))
- Improvements [\#1](https://github.com/theolind/pymysensors/pull/1) ([andythigpen](https://github.com/andythigpen))

7 changes: 3 additions & 4 deletions mysensors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def _handle_presentation(self, msg):
# this is a presentation of the sensor platform
sensorid = self.add_sensor(msg.node_id)
if sensorid is None:
if msg.node_id in self.sensors:
self.sensors[msg.node_id].reboot = False
return None
self.sensors[msg.node_id].type = msg.sub_type
self.sensors[msg.node_id].protocol_version = msg.payload
# Set reboot to False after a node reboot.
self.sensors[msg.node_id].reboot = False
self.alert(msg)
return msg
else:
Expand Down Expand Up @@ -233,8 +233,7 @@ def add_sensor(self, sensorid=None):
sensorid = self._get_next_id()
if sensorid is not None and sensorid not in self.sensors:
self.sensors[sensorid] = Sensor(sensorid)
return sensorid
return None
return sensorid if sensorid in self.sensors else None

def is_sensor(self, sensorid, child_id=None):
"""Return True if a sensor and its child exist."""
Expand Down
2 changes: 1 addition & 1 deletion mysensors/const_14.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,5 @@ class Stream(IntEnum):
Internal.I_LOG_MESSAGE: {
'log': 'debug'},
Internal.I_GATEWAY_READY: {
'log': 'info'},
'log': 'info', 'fun': 'alert'},
}
2 changes: 1 addition & 1 deletion mysensors/const_20.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def validate_gps(value):
HANDLE_INTERNAL = dict(HANDLE_INTERNAL)
HANDLE_INTERNAL.update({
Internal.I_GATEWAY_READY: {
'log': 'info', 'msg': {
'log': 'info', 'fun': 'alert', 'msg': {
'node_id': 255, 'ack': 0, 'sub_type': Internal.I_DISCOVER,
'payload': ''}},
Internal.I_HEARTBEAT_RESPONSE: {
Expand Down
2 changes: 1 addition & 1 deletion mysensors/const_21.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Internal(IntEnum):
HANDLE_INTERNAL = dict(HANDLE_INTERNAL)
HANDLE_INTERNAL.update({
Internal.I_GATEWAY_READY: {
'log': 'info', 'msg': {
'log': 'info', 'fun': 'alert', 'msg': {
'node_id': 255, 'ack': 0, 'sub_type': Internal.I_DISCOVER_REQUEST,
'payload': ''}},
})
2 changes: 1 addition & 1 deletion mysensors/version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Store version constants."""
MAJOR_VERSION = 0
MINOR_VERSION = 13
MINOR_VERSION = 14
PATCH_VERSION = '0'
__version__ = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
2 changes: 1 addition & 1 deletion requirements_pypi.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pygcgen==0.2.2
pygcgen==0.2.3
setuptools>=38.6.0
twine>=1.11.0
wheel>=0.29.0
4 changes: 2 additions & 2 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flake8==3.5.0
pylint==1.8.3
pytest==3.5.0
pylint==1.8.4
pytest==3.5.1
pytest-cov==2.5.1
pytest-timeout==1.2.1
pydocstyle==2.1.1
11 changes: 11 additions & 0 deletions tests/test_mysensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,17 @@ def test_set_rgbw(self):
sensor.children[0].values[self.gateway.const.SetReq.V_RGBW],
'ffffffff')

def test_id_request_presentation(self):
"""Test id request with subsequent presentation."""
ret = self.gateway.logic('255;255;3;0;3;\n')
self.assertEqual(ret, '255;255;3;0;4;1\n')
self.assertIn(1, self.gateway.sensors)
self.gateway.logic('1;255;0;0;17;1.5.0\n')
self.assertEqual(
self.gateway.sensors[1].type,
self.gateway.const.Presentation.S_ARDUINO_NODE)
self.assertEqual(self.gateway.sensors[1].protocol_version, '1.5.0')


class TestGateway20(TestGateway):
"""Use protocol_version 2.0."""
Expand Down

0 comments on commit d4315ad

Please sign in to comment.