bwssytems/ha-bridge

Dimming device to specific value always adds 1 to the brightness

Raynman77 opened this issue · 5 comments

Whenever I set the brightness with Alexa, 1 is always added to the specified brightness of 3 making the returned value 4. And then every specified value following that adds 1 to the specified brightness. Is this a bug?

Hmm, will need to look at that.

Hmm, will need to look at that.

When I say that the returned value is 4, I'm referring to the value that Alexa sets the brightness to. So, for example, if I say "Alexa, set the bridge to 3", she sets the brightness level to 3 then 4, if this helps at all. I've never looked through any of the logs to try and drill down on what's happening, but it looks like the bridge sends the command and it is processed as 3 and then Alexa adds 1 to that damn near instantly when viewed in the Echo android app. Meaning, I watch the slider set to 3 for the brightness level slider, but about 500 ms later she adds 1% more to the 3%.

That is quite different. I'll test that on my Echos and see what happens.

Hi,

I had the same problem and as I used ha bridge to control my blinds they never closed completely because of the extra 1% ;-)
For me following workaround did the trick:
Just use ${intensity.math(X/2.54)} instead of $(intensity.percent)

Hope this works for you as well!

I'm also seeing some discrepancy - I particularly noticed it as I'm trying to use it to control a TV app channel.

So setting my 'light' to 54% should actually just be setting my TV to channel 54. I therefore noticed when it instead changes to channel 53 or 55 😄!

This mostly works, but was seeing an off-by-one. So on a webhook I captured both $(intensity.percent) and $(intensity.byte).

Here's a few samples:

Request from Alexa -> percent/raw received
100% -> 100 / 254 (ok)
50% -> 50 / 128 (ok)
5% -> 4 / 16 (wrong)
3% -> 4 / 9 (wrong)
2% -> 2 / 6 (ok)

I tried dividing the raw value by 254 myself, but that doesn't give me the right result either (in my examples, that works for 3% (rounding down), but not 5%.

Workaround is easy enough for me (essentially capture a mapping of raw value to actual percentage I asked for), but I'm curious if this is an issue on the Alexa side, or the bridge side.