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

Invertable Switch and BinarySensor #472

Merged
merged 2 commits into from Oct 22, 2020
Merged

Conversation

farmio
Copy link
Member

@farmio farmio commented Oct 20, 2020

Description

  • BinarySensor: added option to invert payloads
  • Switch: added option to invert payloads

Bugfix:

  • HA Switch entity: keep state without state_address. Previously after_update was called before the internal state of a Switch() was changed. So HA would read the old state, not the updated one. Moving the call to after_update from the RemoteValue to Switch.process_group_write() should fix this.

closes #442

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • The documentation has been adjusted accordingly
  • The changes generate no new warnings
  • Tests have been added that prove the fix is effective or that the feature works
  • The changes are documented in the changelog
  • The Homeassistant plugin has been adjusted in case of new config options

@@ -38,7 +38,7 @@ def __init__(
after_update_cb=after_update_cb,
passive_group_addresses=passive_group_addresses,
)
self.invert = invert
self.invert = bool(invert)
Copy link
Member Author

Choose a reason for hiding this comment

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

None would throw an error when trying to value ^ self.invert.

device_name=self.name,
after_update_cb=self.after_update,
Copy link
Member Author

Choose a reason for hiding this comment

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

after_update moved to process_group_write

@coveralls
Copy link

Coverage Status

Coverage increased (+0.006%) to 93.724% when pulling 13e741c on farmio:invertables into 73e6246 on XKNX:master.

@marvin-w marvin-w merged commit d8a499d into XKNX:master Oct 22, 2020
@marvin-w
Copy link
Member

LGTM

@farmio farmio deleted the invertables branch November 19, 2020 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch: Add invert function
3 participants