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

Make broadlink switch restore its state #23829

Merged

Conversation

akloeckner
Copy link
Contributor

Breaking Change:

This could break behavior for people relying on the switch to always start up in off state.

Description:

Especially if we have a "toggle" switch (with same on/off commands), it is very useful to restore the state in home assistant. We can then guess the current state and actually switch the device on or off. This should also work after a HA restart. Which it didn't so far...

I copied the method to do so from pilight switch to broadlink switch.

Related issue (if applicable): none.

Pull request with documentation for home-assistant.io (if applicable): none

Example entry for configuration.yaml (if applicable):

switch:
- platform: broadlink
  host: !secret rmmini_host
  mac:  !secret rmmini_mac
  switches:
    receiver:
      friendly_name: "Receiver an/aus"
      command_on:    'JgBgAAABKJIVERQRFRAVNRU0FjQVEBY0FRAVEBYQFRAWEBUQFRAVERU0FhAVNBU1FDUWEBQRFDUVERU0FhAVEBURFDUUNhQRFAAFpAABKUcVAAw===='
      command_off:   'JgBgAAABKJIVERQRFRAVNRU0FjQVEBY0FRAVEBYQFRAWEBUQFRAVERU0FhAVNBU1FDUWEBQRFDUVERU0FhAVEBURFDUUNhQRFAAFpAABKUcVAAw===='

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

Method copied from pilight switch
@ghost
Copy link

ghost commented May 12, 2019

Hey there @Danielhiversen, mind taking a look at this pull request as its been labeled with a integration (broadlink) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

@Danielhiversen Danielhiversen merged commit e687848 into home-assistant:dev May 12, 2019
@akloeckner akloeckner deleted the RestoreEntity-BroadlinkSwitch branch May 12, 2019 17:32
@balloob balloob mentioned this pull request Jun 4, 2019
alandtse pushed a commit to alandtse/home-assistant that referenced this pull request Oct 12, 2019
* Make broadlink switch restore its state

Method copied from pilight switch

* style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants