Docker container - adorobis/hacomfoairmqtt GitHub Wiki
Quick start as Docker container
Clone Github repositiory
git clone https://github.com/jschanz/hacomfoairmqtt.git
cd hacomfoairmqtt
Edit docker-compose.yml
services:
comfoair:
image: adorobis/hacomfoairmqtt:latest
container_name: comfoair
environment:
- SOCAT=True
- COMFOAIR_IP=192.168.1.50
- COMFOAIR_PORT=502
- SERIAL_PORT="/dev/comfoair350"
- RS485_PROTOCOL=False
- REFRESH_INTERVAL=10
- ENABLE_PC_MODE=False
- DEBUG=False
- FAN_OUT_ABSENT=15
- FAN_OUT_LOW=30
- FAN_OUT_MID=50
- FAN_OUT_HIGH=70
- FAN_IN_ABSENT=15
- FAN_IN_LOW=30
- FAN_IN_MID=50
- FAN_IN_HIGH=70
- SETUP_FAN_LEVELS_AT_START=True
- MQTT_SERVER=mosquitto.domain.tld
- MQTT_PORT=1883
- MQTT_KEEPALIVE=45
- MQTT_USER=username
- MQTT_PASSWORD=password
- HA_ENABLE_AUTO_DISCOVERY_SENSORS=True
- HA_ENABLE_AUTO_DISCOVERY_CLIMATE=True
- HA_AUTO_DISCOVERY_DEVICE_ID=ca350
- HA_AUTO_DISCOVERY_DEVICE_NAME=CA350
- HA_AUTO_DISCOVERY_DEVICE_MANUFACTURER=Zehnder
- HA_AUTO_DISCOVERY_DEVICE_MODEL=Comfoair 350
restart: always
If you want to use a Serial-2-Ethernet-Converter (e. g. from https://www.waveshare.com or https://www.pusr.com/ ), you have to enable it with SOCAT=True. During startup socat is creating a virtual device SERIAL_PORT which will connect to COMFOAIR_IP and COMFOAIR_PORT.
/usr/bin/socat -d -d pty,link="$SERIAL_PORT",raw,group-late=dialout,mode=660 tcp:"$COMFOAIR_IP":"$COMFOAIR_PORT" &
Tested RS232 - Network devices
Container was tested with the following devices:
- USR-TCP232-302 https://www.pusr.com/products/1-port-rs232-to-ethernet-converters-usr-tcp232-302.html
- RS232/485/422 TO POE ETH (B) https://www.waveshare.com/wiki/RS232/485/422_TO_POE_ETH_(B)
Power over ethernet (PoE)
- RS232/485 TO WIFI ETH (B) https://www.waveshare.com/wiki/RS232/485_TO_WIFI_ETH_(B)
Can be powered by 12VDC available on the Comfoair unit. No additional external cabling required.
Running the container with local attached serial connection is still untested. Feedback is welcome.
Starting Docker Container
docker-compose up
If everything is setup correctly, you should see something like that:
2023-08-24T15:26:31.644203595Z create serial device over ethernet with socat for ip 192.168.1.50:502
2023-08-24T15:26:31.649293698Z 2023/08/24 15:26:31 socat[9] N PTY is /dev/pts/0
2023-08-24T15:26:31.650497425Z 2023/08/24 15:26:31 socat[9] N opening connection to AF=2 192.168.1.50:502
2023-08-24T15:26:31.652213345Z 2023/08/24 15:26:31 socat[9] N successfully connected from local address AF=2 172.31.59.2:46566
2023-08-24T15:26:31.652254376Z 2023/08/24 15:26:31 socat[9] N starting data transfer loop with FDs [5,5] and [7,7]
Additionally check the status and settings on the Serial-2-Ethernet-Device. The TX Count / RX Count should increase, if communication is happening.
If you encounter some stability problems, try to disable the RESET checkbox.
If you want to connect more than one device, increase the number of concurrent connection.