rubenbe / comfospottwin40

Control your Zehnder ComfoSpot Twin 40
MIT License
9 stars 0 forks source link

Add system name as parsed argument on startup #5

Open Phi2k opened 10 months ago

Phi2k commented 10 months ago

I will go "all in" and install another 5 fans which means I need a second controller for the 2nd floor of the building. I now run into the issue that both instances will post the same mqtt topics "comfospot40". therefore the feature request to parse the system name as argument of server.py e.g. --name.

If I read the code right it would just be changing line 10 in "mqtt.py" ?!

Workarround would be a second mqtt adapter in IOBROKER reachable under a different port. However, last time I checked I was not able to pass a port to the mqtt IP in the form xxx.xxx.xxx.xxx:port and only the standard port was working.

Thanks for the support.

rubenbe commented 10 months ago

Hi! Wow, nice, that would be a nice testcase. Unfortunately, it is not supported currently, and it is a bit harder than only changing the line 10. (mainly because I didn't take it in to account when writing the software). But I can quite easily do the modification.

In return I might ask some raw dumped data of your setup, since it is much more complex than mine ;)

I'll also add the option to use a non-default mqtt port

Phi2k commented 10 months ago

cool thanks! This would help me a lot and avoid a nasty IT setup... I will send dumps from the bus as soon as available. Setup will be: Two seperate busses with 4 and 5 fans installed. One sensor per bus (as more are currently not supported and also not neccessary)

the two systems would run completely seperated but should both report to the same IOBroker installation. Therefore the issue with the same naming scheme. If changing the port would work I would just run a second mqtt adapter and the same naming would not be an issue.

by the way: in case you do not find some time: perhaps I can just create a fork and replace every "comfospot40" string by "comfospot41" not elegant but probably a solution :-)

P.S. I read somewhere that the protocol would in general support even more fans using the jumper number 4... this is also something I coud try but would require changes in the code....

Phi2k commented 10 months ago

I tested once more handing over a different port. It does not work. According to documentation of the aiomqtt package the port is a seperate variable which has to be handed over. So this is probably the fastest way to do it. Fallback in case no port is assigned is 1883.

rubenbe commented 10 months ago

The protocol indeed supports more than 3 zones. This actual limitation is only there because there are only 3 dip switches on the fans. The 4th switch inverts the fan direction. This is a bit a simplification since on protocol level there are 6 zones used, to implement the fan direction using dip switch four.

rubenbe commented 10 months ago

Hi, I pushed some modifications. Can you test them?

Phi2k commented 10 months ago

Thank you very much. I can confirm that both changing the port and changing the mqtt-prefix is working. Tested with a docker container without hardware installed. Test with hardware in about a week.

rubenbe commented 10 months ago

Great! Let's close the ticket when it's confirmed to be working with the real hardware.

Phi2k commented 9 months ago

I now have two separate installations running on two docker containers on a raspberry Pi 5.

I was not able to run both installations on the same MQTT Broker. I got errors with "Pending messages". This might be an error of my IOBroker MQTT setup, though.

I now run two MGTT-Brokers on different ports.

rubenbe commented 9 months ago

That is weird, since I did the same to test, but I'm using mosquitto as MQTT broker. Pending messages is indeed due to the application sending quite a large amount of messages on startup (for the hass autoconfig)