Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem on a Raspberry Pi 4 #4

Closed
b0tt0mturn opened this issue Jan 9, 2024 · 6 comments
Closed

Problem on a Raspberry Pi 4 #4

b0tt0mturn opened this issue Jan 9, 2024 · 6 comments

Comments

@b0tt0mturn
Copy link

First off, thanks so much from writing this service - if I can get it working, I'll be able to do some much needed automation with my fan control (I hope).

I'm a complete Docker and HA noob, but I've fumbled around enough to get HA and all my other services running as docker containers. But I'm running into the following problem with your docker compose:

"The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested"

ChatGTP is telling me that I need to rebuild the image for ARM64, but before I go down that rabbit hole, I was wondering if that is a simple change on your end or if you had a quick fix for my end.

Thanks!

@aneisch
Copy link
Owner

aneisch commented Jan 9, 2024

I just built and published ghcr.io/aneisch/thermostat_api_server:latest-arm64

Let me know if this image works for you!

@b0tt0mturn
Copy link
Author

Thanks!! It's running! But it looks like it's timing out connecting to MQTT. Here is my docker compose:

thermostat_api_server:
container_name: thermostat_api_server
image: ghcr.io/aneisch/thermostat_api_server:latest-arm64
ports:
- '8080:8080'
environment:
# Name for Device in HA
- THERMOSTAT_NAME=EdenObserverTSTAT
- THERMOSTAT_SERIAL=2615N363586
- MQTT_SERVER=10.0.1.22
# Optional MQTT_PORT - defaults to 1883
#- MQTT_PORT=1883
# Optional username/password
- MQTT_USERNAME=xxxx
- MQTT_PASSWORD=yyyy
# Used in reply to thermostat
- API_SERVER_ADDRESS=10.0.1.22
restart: always

And here is the log file from portainer:

Connecting to MQTT
Traceback (most recent call last):
File "/usr/bin/thermostat_api_server.py", line 410, in
client.connect(mqtt_address, mqtt_port)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/local/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/usr/local/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)
socket.timeout: timed out

@aneisch
Copy link
Owner

aneisch commented Jan 9, 2024

Be sure to modify the MQTT_SERVER environment entry and point it to the IP of your MQTT server.

@b0tt0mturn
Copy link
Author

Gotcha - It's connected to MQTT now and thermostat_api_server is running at 172.18.0.5.

I kept API_SERVER_ADDRESS=10.0.1.22 (although I suspect that is just a placeholder) and had the Observer pointed to that, but the Observer was not connecting. The Observer showed up as an MQTT device in HA, but all sensors were "unknown". I then tried setting API_SERVER_ADDRESS=172.18.0.5 and pointing the Observer there, but still not connecting. I suspect I'm doing something ignorantly, but can't figure it out.

Here is my current docker compose:

thermostat_api_server:
container_name: thermostat_api_server
image: ghcr.io/aneisch/thermostat_api_server:latest-arm64
ports:
- '8080:8080'
environment:
# Name for Device in HA
- THERMOSTAT_NAME=EdenObserverTSTAT
- THERMOSTAT_SERIAL=2615N363586
- MQTT_SERVER=172.18.0.4
# Optional MQTT_PORT - defaults to 1883
#- MQTT_PORT=1883
# Optional username/password
- MQTT_USERNAME=xxxx
- MQTT_PASSWORD=yyyy
# Used in reply to thermostat
- API_SERVER_ADDRESS=172.18.0.5
restart: always

@aneisch
Copy link
Owner

aneisch commented Jan 9, 2024

I believe the API_SERVER_ADDRESS is just informational on the thermostat, but it's worth setting.

Ensure you have:
MQTT_SERVER set to the IP of your MQTT server that is reachable from your wifi network (assuming port 1883 is exposed) OR this can be the IP of the docker container hosting your MQTT server (so long as they're in the same docker network)

API_SERVER_ADDRESS set to the IP address of the host running this docker container that is exposing port 8080. This will probably NOT be a 172.18.x.x address, but something like 192.168.x.x 10.x.x.x, etc. Whatever address you put, you should be able to get a result in a browser from a laptop or phone on your wifi by visiting http://THE_IP:8080/time. This same address will need to be input on the thermostat as the observer server.

My result:
Screen Shot 2024-01-09 at 1 36 32 PM

@b0tt0mturn
Copy link
Author

Awesome - I'm up and running

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants