diff --git a/CHANGELOG.md b/CHANGELOG.md index d687e87..6c0fea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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:** @@ -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)) @@ -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)) + diff --git a/mysensors/__init__.py b/mysensors/__init__.py index 6c6f259..39e1c3d 100644 --- a/mysensors/__init__.py +++ b/mysensors/__init__.py @@ -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: @@ -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.""" diff --git a/mysensors/const_14.py b/mysensors/const_14.py index 241f1fb..11c985e 100644 --- a/mysensors/const_14.py +++ b/mysensors/const_14.py @@ -338,5 +338,5 @@ class Stream(IntEnum): Internal.I_LOG_MESSAGE: { 'log': 'debug'}, Internal.I_GATEWAY_READY: { - 'log': 'info'}, + 'log': 'info', 'fun': 'alert'}, } diff --git a/mysensors/const_20.py b/mysensors/const_20.py index a27b6cd..4101445 100644 --- a/mysensors/const_20.py +++ b/mysensors/const_20.py @@ -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: { diff --git a/mysensors/const_21.py b/mysensors/const_21.py index 7e08924..e2dd0dc 100644 --- a/mysensors/const_21.py +++ b/mysensors/const_21.py @@ -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': ''}}, }) diff --git a/mysensors/version.py b/mysensors/version.py index 477eb5d..b586693 100644 --- a/mysensors/version.py +++ b/mysensors/version.py @@ -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) diff --git a/requirements_pypi.txt b/requirements_pypi.txt index d6d47c6..d1f2cc7 100644 --- a/requirements_pypi.txt +++ b/requirements_pypi.txt @@ -1,4 +1,4 @@ -pygcgen==0.2.2 +pygcgen==0.2.3 setuptools>=38.6.0 twine>=1.11.0 wheel>=0.29.0 diff --git a/requirements_test.txt b/requirements_test.txt index 51a5f13..d6aa911 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -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 diff --git a/tests/test_mysensors.py b/tests/test_mysensors.py index 4d0b56c..dbbdfd7 100644 --- a/tests/test_mysensors.py +++ b/tests/test_mysensors.py @@ -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."""