Closed ageorgios closed 7 years ago
That is weird. The command to turn the TV on checks the state of the TV first and only tries to change it if the state is not in the desired condition.
I see a possible problem in the logic, and maybe you can play around with this and report back:
in the Power.ts file on line 30, we're checking for ===
rather than ==
. Maybe try printing the values of on
and isOn
to see if they are actually equal or just equivalent.
So, here's where this causes a problem: If the if
condition on line 30 fails, we'll fall into the else block on line 32. The ternary operator on line 33 is setting the new state based on the current state of the device (isOn
), but it should be setting it based on the desired state (on
).
I'm not sure what your comfort level is with modifying the typescript files and recompiling. Should be able to find it in the compiled javascript without too much trouble, though. Let me know how it goes.
I replaced === with == and seems it works ok with the automation! I will do further tests to check it out!
Thanks!
Reopening this until i get it fixed and released. feel free to submit a PR if you’d like.
Published a new release that should take care of your issue: https://github.com/jbree/homebridge-cec-accessory/releases/tag/v0.2.0
The issue is this:
when the TV is off and homekit state is off, if a test automation is triggered that needs the tv off, then the TV is turned ON.
maybe this is a different command for the set state?