Skip to content

Refactor mysensors message handling#17214

Merged
MartinHjelmare merged 4 commits intohome-assistant:devfrom
MartinHjelmare:refactor-mysensors-msg-handling
Nov 4, 2018
Merged

Refactor mysensors message handling#17214
MartinHjelmare merged 4 commits intohome-assistant:devfrom
MartinHjelmare:refactor-mysensors-msg-handling

Conversation

@MartinHjelmare
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare commented Oct 7, 2018

Description:

  • Add handler module and register handlers per message type or message sub-type. This will allow easier extension of message handling in the future.
  • Move some common functions to a helpers module.
  • Fix inconsistent return.
  • Upgrade pymysensors to 0.18.0 to fix message modification.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

@MartinHjelmare
Copy link
Copy Markdown
Member Author

MartinHjelmare commented Oct 7, 2018

CC @inetAnt

This should allow you to more easily handle heartbeats. Register a handler of that internal message type in the handler module. Connect an additional callback in the base mysensors entity class and the device tracker platform for node updates.

@MartinHjelmare MartinHjelmare changed the title WIP: Refactor mysensors message handling Refactor mysensors message handling Oct 21, 2018
@MartinHjelmare MartinHjelmare force-pushed the refactor-mysensors-msg-handling branch from 4309771 to cf3c015 Compare October 21, 2018 14:14
@MartinHjelmare
Copy link
Copy Markdown
Member Author

MartinHjelmare commented Oct 21, 2018

@inetAnt I've now included node callbacks and a node update helper in the handler module. So handling hearbeats should be just registering a new handler and calling the node update handler helper, besides adding hearbeats to device state attributes.

This PR is now tested, so it's ready for review.

* Add handler module and register handlers per message type or message
  sub-type. This will allow easier extension of message handling in the
  future.
* Move some common functions to a helpers module.
* Fix bug in message modification.
@MartinHjelmare MartinHjelmare force-pushed the refactor-mysensors-msg-handling branch from cf3c015 to 2dfb015 Compare November 2, 2018 12:19
Copy link
Copy Markdown
Contributor

@amelchio amelchio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MartinHjelmare
Copy link
Copy Markdown
Member Author

Thanks!

@MartinHjelmare MartinHjelmare merged commit 9a6c229 into home-assistant:dev Nov 4, 2018
@ghost ghost removed the in progress label Nov 4, 2018
@balloob balloob mentioned this pull request Nov 29, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
@MartinHjelmare MartinHjelmare deleted the refactor-mysensors-msg-handling branch April 25, 2019 19:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants