Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node internal state handling #363

Merged
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
75e7c04
handle_smart_sleep - refactor for better readability (#362)
gorbunovav May 30, 2021
dfc0047
handle_smart_sleep - don't update the sensor state, just send the mes…
gorbunovav May 30, 2021
18ad4a6
Gateway.set_child_value - don't update the sensor state for non-smart…
gorbunovav May 30, 2021
261f5e2
Sensor.set_child_value - split into two separate methods to set local…
gorbunovav May 30, 2021
0ca6307
Smart sleep - don't compare new value with the old one on send, the n…
gorbunovav May 30, 2021
83e7c70
Encapsulate sensor's smart sleep mode detection inside the Sensor cla…
gorbunovav May 30, 2021
532d78d
Set messsage handler - don't set the desired state for smart sleep no…
gorbunovav May 30, 2021
b225a8b
Clear desired state on current state update to avoid infinity sending…
gorbunovav May 31, 2021
1d14a1e
Gateway - add a method to create message to set sensor value, use it …
gorbunovav May 31, 2021
d8fe478
Gateway - add the `use_ack_when_set_values` constructor parameter for…
gorbunovav May 31, 2021
9f36aeb
Gateway.logic - rename variable to better reflect what is going on (#…
gorbunovav May 31, 2021
4b69ddb
Apply code formatting (#362)
gorbunovav May 31, 2021
9b4f724
Sensor - add method to get the desired child state, use it to handle …
gorbunovav May 31, 2021
e505f73
create_message_to_set_sensor_value - convert parameters to the requir…
gorbunovav May 31, 2021
50e05cb
Remove unused import (#362)
gorbunovav May 31, 2021
05a79c9
Update tests (#362)
gorbunovav May 31, 2021
4eea5b9
Fix existance checks (#362)
gorbunovav May 31, 2021
690eb09
Add unit tests for new `Sensor` class methods (#362)
gorbunovav May 31, 2021
1fbd0a4
Test that node is correctly marked as smart sleep upon heartbeat mess…
gorbunovav May 31, 2021
33deb7d
Update README with inforamtion about new `Gateway` parameter (#362)
gorbunovav May 31, 2021
572ee57
Tweak values typecast to avoid exceptions (#362)
gorbunovav Jun 1, 2021
ced505c
Fix typo
gorbunovav Jun 12, 2021
39479b5
Fix typos
gorbunovav Jun 12, 2021
a79f7ec
Tests - mysensors - extend `test_non_presented_child` case with attem…
gorbunovav Jun 12, 2021
da61e0f
Replace log messages with exceptions (#362)
gorbunovav Jun 12, 2021
23fe9e3
Linter fixes (#362)
gorbunovav Jun 12, 2021
1df2a3d
Revert "Gateway - add the `use_ack_when_set_values` constructor param…
gorbunovav Jul 5, 2021
1aa3173
Revert "Update README with inforamtion about new `Gateway` parameter …
gorbunovav Jul 5, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Gateway.logic - rename variable to better reflect what is going on (#362
)
gorbunovav committed May 31, 2021
commit 9f36aeb1084e1db630d0943f3cfec930649f8178
14 changes: 7 additions & 7 deletions mysensors/__init__.py
Original file line number Diff line number Diff line change
@@ -65,9 +65,9 @@ def logic(self, data):
msg.gateway = self
message_type = self.const.MessageType(msg.type)
handler = message_type.get_handler(self.handlers)
msg = handler(msg)
msg = self._route_message(msg)
return msg.encode() if msg else None
reply = handler(msg)
reply = self._route_message(reply)
return reply.encode() if reply else None

def alert(self, msg):
"""Tell anyone who wants to know that a sensor was updated."""
@@ -196,10 +196,10 @@ def set_child_value(self, sensor_id, child_id, value_type, value, **kwargs):

if sensor.is_smart_sleep_node:
sensor.set_child_desired_state(
child_id,
value_type,
child_id,
value_type,
value
)
)

return

@@ -209,7 +209,7 @@ def set_child_value(self, sensor_id, child_id, value_type, value, **kwargs):
value_type,
value,
**kwargs
)
)

if msg_to_send is None:
return