bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 199 forks source link

Setting Color with ${color.rgbx} don't work #1267

Closed devel6236 closed 2 years ago

devel6236 commented 3 years ago

ha-bridge Version 5.4.0 I use ${color.rgbx} under color Items of the device

If I try to set the color over Alexa it doesn't work. If I say Blue color is set to FFFFFF, Green color is set to FFFFFF....

When I set the color with the "Test Color" Button in the ha-bridge GUI it works, after that it works also via Alexa until next reboot. This problem is reproducible.

log for color green:

12-15-2020 16:44:04.818 DEBUG executing HUE api request to send message to MQTT broker: "{\"clientId\":\"HABRIDGE\",\"topic\":\"cmnd/Luftbefeuchter/COLOR\",\"message\":\"${color.rgbx}\",\"qos\":\"1\",\"retain\":\"false\"}" com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 16:44:04.818 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/COLOR","message":"${color.rgbx}","qos":"1","retain":"false"}>>, not done: false com.bwssystems.HABridge.hue.DeviceDataDecode
12-15-2020 16:44:04.819 INFO Hue = 21845.0, Sat = 254.0, Bri = 254.0 com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 16:44:04.819 DEBUG Color change with HSB New: Hue: 21845, Sat: 254, Bri: 254. Resulting RGB Values: 255 255 255 com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 16:44:04.819 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/COLOR","message":"FFFFFF","qos":"1","retain":"false"}>>, not done: true com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 16:44:04.820 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/COLOR","message":"FFFFFF","qos":"1","retain":"false"}>>, not done: false com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 16:44:04.820 DEBUG publishing message: HABRIDGE - cmnd/Luftbefeuchter/COLOR - FFFFFF - count: 0
bwssytems commented 3 years ago

If you could set debug for the HueMulator class to see what the Alexa sends on the first tries that are not request that would help. Thanks

JsChiSurf commented 3 years ago

FWIIW, I have the identical behavior in that the color will not start working until after I first test via the 'test color' button, and from that point forward, requesting via Alexa works. However, the rgb values received via Alexa, in my case, seem completely random. I am at work, but when I get home, can try and get some logs as well.

devel6236 commented 3 years ago

including Debug-Log HueMulator for color blue

12-15-2020 19:08:54.934 DEBUG HueMulator PUT called on api/* with request <<</api/b56a460139704039b50e72071393375d/lights/534/state>>>, and body <<<{"on":true,"hue":43690,"sat":254}>>> com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:54.935 DEBUG hue state change requested: b56a460139704039b50e72071393375d from 192.168.100.19 body: {"on":true,"hue":43690,"sat":254} com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:54.935 DEBUG validateWhitelistUser: found a user com.bwssystems.HABridge.BridgeSecurity
12-15-2020 19:08:54.936 DEBUG hue/sat request - Hue: 43690, Sat: 254, Bri: 254 com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:54.936 DEBUG Calling on-off as requested. com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:54.936 DEBUG Decode Json for url items: [{"item":"{\"clientId\":\"HABRIDGE\",\"topic\":\"cmnd/Luftbefeuchter/POWER\",\"message\":\"ON\",\"qos\":\"1\",\"retain\":\"false\"}","type":"mqttMessage"}] com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:54.936 DEBUG Calling Home device handler for type : mqttMessage com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:54.936 DEBUG executing HUE api request to send message to MQTT broker: "{\"clientId\":\"HABRIDGE\",\"topic\":\"cmnd/Luftbefeuchter/POWER\",\"message\":\"ON\",\"qos\":\"1\",\"retain\":\"false\"}" com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 19:08:54.937 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/POWER","message":"ON","qos":"1","retain":"false"}>>, not done: false com.bwssystems.HABridge.hue.DeviceDataDecode
12-15-2020 19:08:54.937 INFO Hue = 43690.0, Sat = 254.0, Bri = 254.0 com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:54.937 DEBUG Color change with HSB New: Hue: 43690, Sat: 254, Bri: 254. Resulting RGB Values: 255 255 255 com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:54.937 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/POWER","message":"ON","qos":"1","retain":"false"}>>, not done: false com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:54.938 DEBUG publishing message: HABRIDGE - cmnd/Luftbefeuchter/POWER - ON - count: 0 com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 19:08:54.938 DEBUG Retrieved a MQTT hanlder for name: HABRIDGE com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 19:08:54.940 DEBUG Calling color as requested. com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:55.090 DEBUG Decode Json for url items: [{"item":"{\"clientId\":\"HABRIDGE\",\"topic\":\"cmnd/Luftbefeuchter/COLOR\",\"message\":\"${color.rgbx}\",\"qos\":\"1\",\"retain\":\"false\"}","type":"mqttMessage"}] com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:55.091 DEBUG Calling Home device handler for type : mqttMessage com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:55.091 DEBUG executing HUE api request to send message to MQTT broker: "{\"clientId\":\"HABRIDGE\",\"topic\":\"cmnd/Luftbefeuchter/COLOR\",\"message\":\"${color.rgbx}\",\"qos\":\"1\",\"retain\":\"false\"}" com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 19:08:55.092 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/COLOR","message":"${color.rgbx}","qos":"1","retain":"false"}>>, not done: false com.bwssystems.HABridge.hue.DeviceDataDecode
12-15-2020 19:08:55.092 INFO Hue = 43690.0, Sat = 254.0, Bri = 254.0 com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:55.092 DEBUG Color change with HSB New: Hue: 43690, Sat: 254, Bri: 254. Resulting RGB Values: 255 255 255 com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:55.093 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/COLOR","message":"FFFFFF","qos":"1","retain":"false"}>>, not done: true com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:55.093 DEBUG Request <<{"clientId":"HABRIDGE","topic":"cmnd/Luftbefeuchter/COLOR","message":"FFFFFF","qos":"1","retain":"false"}>>, not done: false com.bwssystems.HABridge.hue.ColorDecode
12-15-2020 19:08:55.093 DEBUG publishing message: HABRIDGE - cmnd/Luftbefeuchter/COLOR - FFFFFF - count: 0 com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 19:08:55.093 DEBUG Retrieved a MQTT hanlder for name: HABRIDGE com.bwssystems.HABridge.plugins.mqtt.MQTTHome
12-15-2020 19:08:55.128 DEBUG HueMulator GET called on api/* with request <<</api/b56a460139704039b50e72071393375d/lights/534>>>, and body <<<>>> com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:55.130 DEBUG hue light requested: 534 for user: b56a460139704039b50e72071393375d from 192.168.100.19 com.bwssystems.HABridge.hue.HueMulator
12-15-2020 19:08:55.131 DEBUG validateWhitelistUser: found a user com.bwssystems.HABridge.BridgeSecurity
12-15-2020 19:08:55.132 DEBUG found device named: Luftbefeuchter com.bwssystems.HABridge.hue.HueMulator
bwssytems commented 3 years ago

Interesting as if you convert what the Alexa sent in an external converter you get FFFFFF. So, trying to understand why Alexa sends that?

bwssytems commented 3 years ago

Well, intersting enough, if I set the Brightness value to 50, it ends up being 0000FF, which is correct. It must be if the brightness is not set properly, it will be 254 or 100% and that kills the color conversion... This is a bug.

FY: Alexa must be getting state first and adjusting based on the brightness value for the device. That would be why it helps to set from the GUI first.

Sharky84 commented 1 year ago

Hi, I still have this bug in 5.4.1-release. Also the color.rx,color.gx,color.bx are always set on FF each, when I request Alexa to set the color. Doing it in the Web-UI of HA-Bridge it is working. Can you please help? I love the project and have been using it for a long time yet. I thought that it should have been fixed in 5.4.1 because the topic was closed, but as I can see only the 9-digit problem was solved. Build it with maven still the same error.

Greetings Michael

AndreasGaus commented 10 months ago

Hi, I still have this bug in 5.4.1-release. Also the color.rx,color.gx,color.bx are always set on FF each, when I request Alexa to set the color. Doing it in the Web-UI of HA-Bridge it is working. Can you please help? I love the project and have been using it for a long time yet. I thought that it should have been fixed in 5.4.1 because the topic was closed, but as I can see only the 9-digit problem was solved. Build it with maven still the same error.

Greetings Michael

Same issue, here, Michael. Would really be nice if the HA-Bridge guys can fix this issue.