I seem to have been googling this all day and I’m getting nowhere so perhaps somebody can help. I’m new to Home Assistant but have been using Pilight successfully for a number of months. I was very happy to see it listed as a component and so I have been trying to set it up.
Note: I have home assistant set up on on Pi and Pilight on another.
homeassistant.components.pilight: Unable to connect to 192.168.0.32 on port 5001: timed out
I can successfully talk to the Pilight API using Curl or Fiddler but HA doesn’t want to connect.
I took a look at the Pilight library used by HA and simplified the issue down to the following lines of code:
import socket
host = '192.168.0.32'
port = 5001
client_identification_sender = {"action": "identify"}
receive_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
receive_socket.settimeout(1)
receive_socket.connect((host, port))
receive_socket.send(json.dumps(client_identification_sender).encode())
answer_1 = json.loads(receive_socket.recv(1024).decode()) #This is the line that errors
So it appears to be the receiving of the reply data that is timing out and not the initial connection. I have tried extending the timeout and still get the issue.
Note: I am running the latest public builds of Home Assistant and Pilight.
I’ve been trying to set up pilight for quite some time as well and I got it working in a way.
I think port 5001 in by default for web GUI, you have to add "port": 5000 at the end of pilight config.json (/etc/pilight/config.json). Make sure you stop pilight before you edit config.
That’s it! I was incorrectly looking at the HTTP port thinking that was it! Thank you!
Now I have another problem …I now get the following errors:
expected int for dictionary value @ data['switches']['lamp']['off_code']['id']. Got B1
expected int for dictionary value @ data['switches']['lamp']['on_code']['id']. Got B1
I’m using the clarus_switch protocol which has IDs that are alphanumeric. Perhaps this is a drawback of the HA component only allowing protocols with integer IDs?
Yep, works a treat after the help from @SmartValley to get the port configured !
I’m really glad of it as well as my Pilight Pi is in a nice central location with good range to all the switches. The Home Assistant Pi is tucked away in a corner .