-
Notifications
You must be signed in to change notification settings - Fork 43
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
allow configuring the resume dim operating flag #411
Conversation
Still working on testing this locally, I'll update the PR once that's done |
Hmm, I have never seen this setting before. Do I have this right? If Resume_Dim is enabled, then turning the device on from off will cause it to turn on to the level last used prior to off? Basically it kind of allows for a "dynamic local on level"? Does this also work if the device is turned on via command, (if so, that may require a bit of additional coding to save the last on state)? What you have pushed so far looks like the right way to handle the setting of the flags. As for unit tests of what you are adding, you can look at the unit test here for simple tests related to setting device flags. If you get farther along into tracking the on_level state check out the test here for guidance. This one gets more complicated, but it tests the various permutations. |
yup, that's exactly it - you can enable it manually by turning the dimmer off then pressing the set button. bit 2 (0-based) indicates if it's on or off in the get-flags response I'm testing it out on my dimmers currently and running into an issue with the checksum for some reason:
I'm going to keep looking into that later today, but figured I'd post in case you had pointers that might help debug.
Thanks! I'll check out those and add some unit tests.
It works when using a scene without a level - i.e. enable resume_dim on a light, set your dimmer to some arbitrary level, turn the dimmer off, then send a command to enable scene 1 without a level specified. It'll return to the arbitrary level you had it set to. Once I've added tests for the current stuff and figured out the error from above, I'll look into updating the on_level logic as well |
* dev: Fix Various Flake Warnings Update Changelog add files created by tests to gitignore fix issue with hassio initial config setup
Hmm, the device is responding with a NAK. The log you posted didn't contain the output message, I think you have to at least set to INFO if not DEBUG to see those. However, the response back is the correct cmd1 value. I would want to check to see what the outgoing cmd2 value looks like. From your code, it should only be 0x04 or 0x05. If the outgoing is correct, then maybe this is a sign that the device expects this to be an extended message and not a standard length message. Insteon documentation isn't always accurate, and they may have updated things since that document you found was released. You can look here for an example of an extended length set_operating_flags command. Basically, the extended bytes are all zeros. |
ooof, that looks like it was the issue. apparently one of the changes from I2 -> I2CS was apparently requiring a checksum for setting operating flags. The command table I linked above is from 2007 before I2CS was released and so didn't have that info in it :-( However, that seems to fix my issue. It also explains why I was never able to get the keypadlinc 6-key/8-key config flag to work when I tried to play around with that |
4bba776
to
950deab
Compare
I'll try my hand at the |
do you prefer managing the changelog, or should I be updating that in PRs? the contribution guide doesn't specify |
It doesn't matter to me. At times, it may be necessary to fix merge conflicts in the changelog file if there are multiple PRs. If you update the changelog you at least get the control your destiny and you are not subject to the whim of my poor grammer. |
Another feature to add. It does not have to be done in this PR:
So that when |
Oh, I see your comment about |
So this works in the sense that the command is successfully sent to my device and is ack'd by the device. However, I can't seem to get it to do anything. After setting the flag to true, I tried:
I also tried
Is there some step I am missing? Perhaps this device doesn't actually support this? It is a: |
hmm, both of those work on my I'd expect it to work on yours, even with the earlier firmware version as it was documented in command tables from 2007. When you run |
Some logs
It looks like while the device is ACKing this, the flags are not changing. |
lol, ahh the Insteon fun. I found the glitch:
Turns out my device with firmware |
And it does work as expected on the device. |
that's..... fun |
Agree, I suspect this is true for all the set-flags that are set using the This doesn't have to be done now, it can be added to the list of issues that we can get to whenever. |
does your switch happen to be an |
Good call, it does report as i2. |
I confirmed this works on i2cs devices. I will create a new issue to address non-i2cs devices. |
Proposed change
This exposes the ability to configure the "Resume Dim" operating flag. It configures the device to use the previous on level instead of the value of the
on_level
flag as the default level for a normal on command.Additional Information
I'm unfamiliar with the code base, so still going through and making sure I've updated documentation where appropriate. I'm also unsure how to add unit tests for a change like this.
The command values were pulled from http://cache.insteon.com/pdf/INSTEON_Command_Tables_20070925a.pdf
Checklist
If user exposed functionality or configuration variables are added/changed: