Skip to content

Commit

Permalink
Merge pull request #178 from MartinHjelmare/0.18.0
Browse files Browse the repository at this point in the history
0.18.0
  • Loading branch information
MartinHjelmare authored Oct 21, 2018
2 parents eb0b170 + 4167464 commit a139ab6
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 23 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
# Change Log

## [0.18.0](https://github.com/theolind/pymysensors/tree/0.18.0) (2018-10-21)
[Full Changelog](https://github.com/theolind/pymysensors/compare/0.17.0...0.18.0)

**Closed issues:**

- Usage [\#176](https://github.com/theolind/pymysensors/issues/176)

**Merged pull requests:**

- Fix modify existing message [\#177](https://github.com/theolind/pymysensors/pull/177) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Scheduled monthly dependency update for October [\#175](https://github.com/theolind/pymysensors/pull/175) ([pyup-bot](https://github.com/pyup-bot))
- Scheduled monthly dependency update for September [\#174](https://github.com/theolind/pymysensors/pull/174) ([pyup-bot](https://github.com/pyup-bot))
- Clean up ensure\_future [\#173](https://github.com/theolind/pymysensors/pull/173) ([MartinHjelmare](https://github.com/MartinHjelmare))

## [0.17.0](https://github.com/theolind/pymysensors/tree/0.17.0) (2018-08-12)
[Full Changelog](https://github.com/theolind/pymysensors/compare/0.16.0...0.17.0)

**Merged pull requests:**

- 0.17.0 [\#172](https://github.com/theolind/pymysensors/pull/172) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Cancel connection task for async gateways [\#171](https://github.com/theolind/pymysensors/pull/171) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Fix reraise msg decode ValueError [\#170](https://github.com/theolind/pymysensors/pull/170) ([MartinHjelmare](https://github.com/MartinHjelmare))
- Allow custom V\_VAR1-5 for any child type [\#169](https://github.com/theolind/pymysensors/pull/169) ([MartinHjelmare](https://github.com/MartinHjelmare))
Expand Down
9 changes: 1 addition & 8 deletions mysensors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
from functools import partial
from timeit import default_timer as timer

try:
from asyncio import ensure_future # pylint: disable=ungrouped-imports
except ImportError:
# Python 3.4.3 and earlier has this as async
ensure_future = getattr(asyncio, 'async')

import serial.threaded
import voluptuous as vol

Expand Down Expand Up @@ -387,8 +381,7 @@ def _create_scheduler(self, save_sensors):
def schedule_save():
"""Save sensors and schedule a new save."""
yield from self.loop.run_in_executor(None, save_sensors)
callback = partial(
ensure_future, schedule_save(), loop=self.loop)
callback = partial(self.loop.create_task, schedule_save())
task = self.loop.call_later(10.0, callback)
self._cancel_save = task.cancel
return schedule_save
Expand Down
2 changes: 1 addition & 1 deletion mysensors/gateway_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _check_connection(self):
self.server_address))
if (self.tcp_check_timer + self.reconnect_timeout) >= time.time():
return
msg = Message().copy(
msg = Message().modify(
child_id=255, type=self.const.MessageType.internal,
sub_type=self.const.Internal.I_VERSION)
self.add_job(msg.encode)
Expand Down
12 changes: 6 additions & 6 deletions mysensors/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def handle_set(msg):
msg.gateway.alert(msg)
# Check if reboot is true
if msg.gateway.sensors[msg.node_id].reboot:
return msg.modify(
return msg.copy(
child_id=SYSTEM_CHILD_ID,
type=msg.gateway.const.MessageType.internal, ack=0,
sub_type=msg.gateway.const.Internal.I_REBOOT, payload='')
Expand All @@ -88,7 +88,7 @@ def handle_req(msg):
value = msg.gateway.sensors[msg.node_id].children[
msg.child_id].values.get(msg.sub_type)
if value is not None:
return msg.modify(
return msg.copy(
type=msg.gateway.const.MessageType.set, payload=value)
return None

Expand Down Expand Up @@ -131,21 +131,21 @@ def handle_firmware_request(msg):
def handle_id_request(msg):
"""Process an internal id request message."""
node_id = msg.gateway.add_sensor()
return msg.modify(
return msg.copy(
ack=0, sub_type=msg.gateway.const.Internal['I_ID_RESPONSE'],
payload=node_id) if node_id is not None else None


@HANDLERS.register('I_CONFIG')
def handle_config(msg):
"""Process an internal config message."""
return msg.modify(ack=0, payload='M' if msg.gateway.metric else 'I')
return msg.copy(ack=0, payload='M' if msg.gateway.metric else 'I')


@HANDLERS.register('I_TIME')
def handle_time(msg):
"""Process an internal time request message."""
return msg.modify(ack=0, payload=calendar.timegm(time.localtime()))
return msg.copy(ack=0, payload=calendar.timegm(time.localtime()))


@HANDLERS.register('I_BATTERY_LEVEL')
Expand Down Expand Up @@ -209,7 +209,7 @@ def handle_gateway_ready_20(msg):
'n:%s c:%s t:%s s:%s p:%s', msg.node_id, msg.child_id, msg.type,
msg.sub_type, msg.payload)
msg.gateway.alert(msg)
return msg.modify(
return msg.copy(
node_id=255, ack=0,
sub_type=msg.gateway.const.Internal.I_DISCOVER, payload='')

Expand Down
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 = 17
MINOR_VERSION = 18
PATCH_VERSION = '0'
__version__ = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
crcmod==1.7
get-mac==0.2.1
get-mac==0.5.0
IntelHex==2.2.1
pyserial==3.4
pyserial-asyncio==0.4
Expand Down
6 changes: 3 additions & 3 deletions requirements_pypi.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pygcgen==0.2.4
setuptools==38.6.0
twine==1.11.0
wheel==0.31.0
setuptools==40.4.3
twine==1.12.1
wheel==0.32.0
6 changes: 3 additions & 3 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flake8==3.5.0
pylint==2.1.1
pytest==3.7.0
pytest-cov==2.5.1
pytest-timeout==1.3.1
pytest==3.8.1
pytest-cov==2.6.0
pytest-timeout==1.3.2
pydocstyle==2.1.1

0 comments on commit a139ab6

Please sign in to comment.