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

Add support for config flow option #14

Merged
merged 1 commit into from
Sep 18, 2020
Merged

Add support for config flow option #14

merged 1 commit into from
Sep 18, 2020

Conversation

postlund
Copy link
Collaborator

This brings generic support for options to all platforms. It basically triggers the same steps as when adding a new device (with the configured entities). A few things to note:

  • Not supported for YAML configs. This is basically because the YAML config overwrites what's stored in the config entry every time Home Assistant is restarted, so this kinda loses the point.
  • It is not possible to change device id or id for any of the platforms. The ids are used to derive unique identifiers and allowing to change them will seriously mess things up. You basically create new devices and entities when doing so.
  • Changes are not reflected until Home Assistant is restarted for now. I will change this, but it requires some refactoring.
  • DPS values supported by a device is cached in the config entry, so the same choices are available in the options dialog. If DPS values are not present in the config entry, a list with choice from 1-255 is generated. This should be backwards compatible.

This change needs some serious testing, so please make sure to test this before merging!

@postlund
Copy link
Collaborator Author

I'm almost done with discovery support in the config flow, but I need this change for that. Maybe someone can try it out so we can merge it?

@rospogrigio
Copy link
Owner

rospogrigio commented Sep 18, 2020

I've started testing this PR (please resolve the conflicts, BTW), but it does not do anything. Does not import from YAML, does not display Entities... I believe there is some kind of syntax error somewhere.
Also something I wanted to ask: in my development environment, when there is some python syntax error in the code (like undefined constants, or bad indentation) I don't get any output, it just stops the execution. Is there some way to have some verbose info in these cases? I launch HA with hass -v . Thanks!

@postlund
Copy link
Collaborator Author

I think an import was lost along the way. I fixed the conflict and added the import so it should work now. Feel free to test. But remember that it won't be useful at all for devices added via YAML.

If an import for an integration fails it will not be loaded, so that's probably what happened. This is printed to console, at least for me, with no additional configuration.

@rospogrigio
Copy link
Owner

Yes, just would like to close these PRs so that we can move on with the development, and you asked for testing this.
Now the import works, entities work as expected, but I tried to add a cover using the config flow and it fails at the final step, with no errors logged.
image

@postlund
Copy link
Collaborator Author

Anything in the log?

@rospogrigio
Copy link
Owner

Nope. As I wrote, my output is pretty silent when there are certain types of errors... would really love to figure out why.

@postlund
Copy link
Collaborator Author

I have made a few bug fixes, should work now!

@rospogrigio rospogrigio merged commit 5507652 into rospogrigio:master Sep 18, 2020
@rospogrigio
Copy link
Owner

Seems to be working fine, merging this!

PaulCavill pushed a commit to PaulCavill/localtuya that referenced this pull request May 9, 2024
* change category

* abort process if ID Configured

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

Successfully merging this pull request may close these issues.

2 participants