eschava / broadlink-mqtt

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

Could not open socket with RM Mini #10

Closed areeb111 closed 7 years ago

areeb111 commented 7 years ago

Hello, I am using Python 2.7, also set the device_type to 'rm' and using the MAC and hostname lookup.

I have checked the port it's not used

#./mqtt.py
[2017-04-27 18:34:35,601] DEBUG Connected to RM2 Broadlink device at ('192.168.11.203', 80)
Traceback (most recent call last):
  File "./mqtt.py", line 237, in <module>
    mqttc.connect(cf.get('mqtt_broker', 'localhost'), int(cf.get('mqtt_port', '1883')), 60)
  File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line 700, in connect
    return self.reconnect()
  File "/usr/lib/python2.7/site-packages/paho/mqtt/client.py", line 822, in reconnect
    sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
  File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
    raise err
socket.error: [Errno 111] Connection refused

Any help please ?

eschava commented 7 years ago

There are two TCP connections and you should separate them:

I see that connection to Broadlink device was successful but to MQTT broker was not Do you have MQTT broker run in your local network and mqtt_broker points to the host where it is run?