eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
221 stars 60 forks source link

Cannot connect to MQTT server on RM4PRO #102

Closed helen-fornazier closed 2 years ago

helen-fornazier commented 2 years ago

Hi! First of all, thanks for this project!

I'm trying to make it work for RM4PRO, it finds the device in the network, but it seems it doesn't find the broaker (see below), any ideas why?

Another question is: where can I find the mqtt API docs of Broadlink? So I can help to debug this. I couldn't find anywhere. Did you reverse engineered?

[2022-02-05 10:36:09,649] DEBUG Connected to 'RM4PRO' Broadlink device at '192.168.1.107' (MAC a0:43:b0:31:ca:45) and started listening to MQTT commands at 'broadlink/#' 
/home/koike/mug/controllar/broadlink-mqtt/mqtt.py:626: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
  logging.warn("Cannot connect to MQTT server, will try to reconnect in 5 seconds")
[2022-02-05 10:36:09,656] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:14,659] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:19,663] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:24,667] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:29,673] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:34,675] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:39,679] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:44,685] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:49,691] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:54,695] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:36:59,701] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:04,707] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:09,711] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:14,715] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:19,719] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:24,723] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:29,727] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:34,731] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:39,735] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:44,738] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:49,743] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:54,746] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:37:59,750] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:38:04,756] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:38:09,760] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:38:09,775] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
[2022-02-05 10:38:14,762] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
[2022-02-05 10:38:19,766] WARNING Cannot connect to MQTT server, will try to reconnect in 5 seconds
helen-fornazier commented 2 years ago

I just figured I know nothing about mqtt heh

I solved this part by installing a broaker server on my notebook:

sudo apt-get install mosquitto

and now I need to send commands to broadlink/# right? (I'm still figuring how to do this).

Do you mind if I update the readme after I figure this out? For people like me who are not familiar with mqtt?

helen-fornazier commented 2 years ago

Aha, I just figured I need to listen in one terminal with mosquitto_sub -t "broadlink/#" and send commands through another terminal like mosquitto_pub -m "replay" -t "broadlink/tv/samsung/power"

Problem solved (sorry to bother). I'll send a PR to the README