fbacker / broadlink-mqtt-bridge

Bridge Broadlink RM Devices with MQTT and API for e.g. OpenHAB
41 stars 14 forks source link

GUI doesn't support Multiple Broadlink Devices #34

Closed NovaGL closed 4 years ago

NovaGL commented 4 years ago

Device IDs are not working on the GUI.

I enter them and they are ignored.

However if I do the same thing using MQTT it works. Can you please look into this?

This also applies to POST commands which I assume is what the GUI is using

POST http://localhost:3000/api/play

BODY

{"topic":"broadlink/room/aircon", "message":"off","device":"xxx"}
fbacker commented 4 years ago

I can't simulate the issue. In your example your are sending to a device with the id 'xxx'. A device with an id like that is not possible. Please look in the Devices list to find a propper id.

If you are using a correct id. Make sure you are running the latest version. I've now added the version at the top of the page.

NovaGL commented 4 years ago

Of course I'm using the right Id's. I just didn't want to share them.

I'll try the latest version and retest. I can provide the IDs but I thought it might be private

fbacker commented 4 years ago

The id is just a mash of the Mac address. Hope the new release solves the issue. On 11 Jan 2020, 22:06 +0100, NovaGL notifications@github.com, wrote:

Of course I'm using the right Id's. I just didn't want to share them. I'll try the latest version and retest. I can provide the IDs but I thought it might be private — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

NovaGL commented 4 years ago

Still doesn't work. MQTT works though, just not the website The device section is getting ignored.

So when I do it. I send the MQTT msg to the following topic

broadlink/study/aircon:c1111111abb1

With a body of "ON"

The GUI is excluding the device and simply sending the MQTT msg to

broadlink/study/aircon

Can this please be fixed?

fbacker commented 4 years ago

Can you please provide some more log info. It don't fully understand. So sending MQTT client messages work. Using the GUI doesn't work?

When using the GUI you select the device independent, It should not be included in the topic.

Select a command, getting topic, action. Then I select the device so device id is used. Web browser network show the data sent

topic: broadlink/heater/livingroom/temperature
message: 22
device: 780f7717ea86

image

The log shows to prepare (validate and put in que). Then sending it thru the device.

2020-02-02 12:51:53 [info]:     Prepare topic: broadlink/heater/livingroom/temperature, message: 22 
2020-02-02 12:51:53 [info]:     Send command topic: broadlink/heater/livingroom/temperature, message: 22, file: heater/livingroom/temperature/22, device: 780f7717ea86 
combatistor commented 4 years ago

One comment here, everytime I use the GUI, even if I specify one device (I have 2 broadlink devices detected), in the logs I can see:

2020-02-02 13:54:42 [info]:     Prepare topic: broadlink/light/nec, message: power_off 
2020-02-02 13:48:30 [info]:     Send command topic: broadlink/light/nec, message: power_off, file: light/nec/power_off, device: ************ (device 1) 
2020-02-02 13:48:30 [info]:     Send command topic: broadlink/light/nec, message: power_off, file: light/nec/power_off, device: ************ (device 2)  

It seems from the gui it kind of broadcast to all the devices (I can verify because both broadlink LEDs blink when sending a command)

Broadcast

NovaGL commented 4 years ago

Thanks for verifying @combatistor

@fbacker please see the logs mentioned above.

Can you explain why it works for me when I put the device ID in the topic?

fbacker commented 4 years ago

I pipe the web gui to mqtt client (so if other services are interrested they will get same command as maybe openhab uses). In the more devices rewrite I forgot to set the device as extra parameter to the topic.

Please upgrade and see if it works. Version 2.1.3

combatistor commented 4 years ago

The upgrade worked as expected, no errors while executing the script! It seems fine for me now, only one message is sent to the correct device. One more thing, is it possible to get the local time in the logs? I get the UTC time but can you adjust according to the location? One more thing, is it possible to rename the broadlink devices? (Just in the GUI) like broadlink living room, broadlink kitchen and the possibility to sort them by IP address? Thank you very much !

NovaGL commented 4 years ago

This version broke for me

GUI says

broadlink/study/aircon Message: off

Log says

2020-02-05 09:50:20 [info]:     Prepare topic: broadlink/study/aircon, message: 16 

2020-02-05 09:50:20 [warn]:     Failed to find file: /srv/openhab2-conf/broadlink-mqtt-bridge/commands/study/aircon/16.bin 

Same for temp. MQTT still works, it's like something is not mapped correctly.

fbacker commented 4 years ago

Sorry, my quick fixes breaks things a little too much nowadays. :( Noticed that openhab 2.5.1 mqtt numbers are sent as float, thought I did a fix for that.

upgrade to 2.1.5, should solve the break.

fbacker commented 4 years ago

@combatistor please add feature request in a new issue so I can flag it. Due to limited time I'll need to sort features.

NovaGL commented 4 years ago

@fbacker Any update on failed to find file

fbacker commented 4 years ago

Upgrade to latest and try again @NovaGL

fbacker commented 4 years ago

I've removed the try to convert to int function. Sending a number from openhab use instead formatBeforePublish="%.0f" on mqtt type.

NovaGL commented 4 years ago

Looks good so far. I'll open it again if it stops working.