I’ve added capability to connect to not anonymous MQTT broker : just add login password in the conf file.
It’s available on the github dev branch.
Do not hesitate to provide a feedback : I will merge it on the main branch.
Regards,
Benoit
Hi Benoit
Unfortunately in HAOS, I did’nt managed to get systemctl running nor systemD to launch the service directly.
But launching the script in terminal did work perfectly . Doing so, even If I reboot, HA reconnects to mqqt without any action, so this is not an optimized solution but at least it works !
Also Mqtt login works fine and mqqt has been discovered with 37 entities.
I have copied also your cards and this is simply brillant and thanks to you my old dietrich is alive and monitored in HA
I thank you for your feedback and happy to see you manage to get some results.
I started to have a look to generate an HA add on with a python script but I’ve only understood that there are several step to do, eg generate a package usable with docker, be able to get settings from HA etc… As I have already a big to do list in the pipe, it won’t be possible to deliver something before weeks/months.
I had a look on the web to try to find a reusable example for python scripts to HA add on, but didn’t find any links.
Hi Benoit,
I have a de dietrich heater and I have it connected to home assistant for about 2 years, using the built-in modbus read/write. It is however not very stable. Reading from the heater works very well, but when writing, some other addresses get overwritten, which is of course very annoying.
So to get a more stable integration with home assistant, I would like to use your integration. However I think I am using a slightly different de dietrich heater than you (although the modbus registers seem to match). I have a de dietrich mca 25. See link.
Do you (or anyone else) have experience with this heater? Is it fully compatible with your MQTT interface?
Kind regards,
Thomas.
I’ve managed to get numbers for gas consumption converting power% (value 0-100) of sensor.power to Watt by multiplying by 24500/100 (=>sensor. gas_power). See the table extracted from brochure where power is proportional to power%:
Then integrating these values of sensor. gas_power give energy in kWh (sensor.energie_gaz).
Using an average value of PCI/PCS we can deduce the quantity of burned propane in kg (sensor.conso_gaz) by multiplying sensor.energie_gaz x 0.075146.
Then I deduce an equivalent of %propane consumed in my tank (knowing 1 kg of propane corresponds to 0.0786% of my tank level (deduced from my last refill of 585kg tank => level from 38% to 84%)
We can finally estimate the tank level using a correction factor (input_number.gaz_correction) and deducing the % consumed calculated above. (correction factor use to correct the calculation and for future refill :-))
You’ve done it and this is confirmed in energy distribution:
I do not know if this raw estimate is fully correct and time will confirm but I think it could be interesting to get numbers in kWh and to monitor gas consumption (even in € using energy management in HA)
Benoit you are free or welcome if you think is usefull to integrate this in your script and thank you again to your very stable script and to make this happens.
Kind regards
Rofiq
PS: Edited to correct the integration method from default (trapezoidal) to left
I understood, but not sure, that Diematic Isystem modBus is always in slave mode . => So the Diematic3 MQTT interface should be adapted to work with an Isystem regulator. It shouldn’t be very complex but unfeasible without heater. I don’t know anybody who have done it.
Hi Benoit
After runing the gas consumption for several days, I’ve realized that by default the method of integration of the power% is the trapezoidal method which is not accurate for our dietrich boiler (specially when the boiler is off over long period during the night and restarts in the morning at high level). After some reasearch, it is best to use the “left method” of integration and with this simple trick, the monitoring is now quite accurate.
So the modification (method: left) of the integration is the following:
- platform: integration
source: sensor.gas_power
name: energie_gaz
unique_id: energie_gaz
method: left
unit_prefix: k
unit_time: h
round: 2
I have edited my previous post to reflect this change.
Thanks
Rofiq
Hi,
On Hassos you have to install the following addon in order to have terminal:
You can also install samba share to get access to Hassos file system from your computer
Then follow Benoit’s procedure by installing his script to the directory of your choice e.g addons/Diematic32MQTT and configure the conf file.
Then on terminal, browse to that directory :
cd addons/Diematic32MQTT
Install pytz package:
sudo pip3 install pytz
Install paho MQTT client:
sudo pip3 install paho-mqtt
Then run Benoit’s script
python3 Diematic32MQTT.py
Message on terminal: Connected to MQTT broker
Hope this help
When I start Diematic32MQTT.py, it’s able to connect to MQTT broker and to the Modbus Converter, but there is no communication on configured TCP port and no communication on the Serial interface.
In the logs I see:
2023-03-19 14:39:12,407 - Diematic - WARNING - Init Link with Regulator
2023-03-19 14:39:52,587 - Diematic - WARNING - Synchro timeout
2023-03-19 14:39:52,604 - Diematic - WARNING - Init Link with Regulator
I tried Simply Modbus TCP client to get any information’s from boiler and in this case I see some communication on the TCP and Send Frames/Received Frames on the serial interface of the Modbus converter, but with Slave 10 and different Registers I never got any response in the client.
I’m a newbee in Modbus world and I’m not sure what I’m doing wrong.
Am I using wrong boiler address?
Is there anything wrong in my converter configuration?
Hello,
it’s a little difficult to answer as i don’t know this kind of boiler ans serial interface.
But you shouldn’t use the modbus setting in the Elfin EE11A as the Modbus is decoded / encoded in the Diematic_to_MQTT interface with specific adaptations to the De Dietrich specific implementation (Master/Slave mode switch every 5s). Use something like serial instead (I don’t know this EE11A).
Setting the log mode to DEBUG should allow to log received byte stream.
Still Diematic32MQTT.py connects to TCP-server, but does not send or receive single packet.
When I try with nc 192.168.3.49 8899, I see data being transferred via Serial Port:
Thank you @BenoitS for the great integration. You saved me countless hours!
I am not really familiar with HA (as I just moved from OpenHAB) but I wanted to share the following steps I used to create an Addon from this project to automatically run the python scripts. I am most likely not following any best practice or anything but this works for me…
SSH to HA (or use Samba)
Create a new folder under /addons called HAAddOnDiematic_to_MQTT
Within that folder, add a new file called DockerFile and containing the following
ARG BUILD_FROM
FROM $BUILD_FROM
# Install requirements for add-on
RUN \
apk add --no-cache \
python3
RUN python3 -m ensurepip
#RUN pip3 install --no-cache --upgrade pip setuptools
RUN pip3 install pytz
RUN pip3 install paho-mqtt
# Copy data for add-on
COPY run.sh /
RUN chmod a+x /run.sh
COPY src/ /
CMD [ "/run.sh" ]
Add a new file called config.yaml containing the following:
Optional: update the polling period in the Diamatic32MQTT.conf file to 60 (every 10 seconds was too frequent in my case and made the connection crash from time to time).
Once this is done, restart HA and this new local “Addon” should show up. The Addon can then be installed and started.
Hope this helps.
Note: as a side unrelated note, it took me a while to figure out that the BrokerHost is core-mosquitto and not localhost…
Hi Benoit,
I am very excited about getting my Diematic 3 control panel (for a GTU 125s Fioul Chaudiere) connected into Home Assistant. You have done amazing work, Bravo!
But I need some help, as I am new to all this! Apologies if I am asking stupid beginner questions, I very much appreciate your time and work - thank you in advance!
I am running HA in docker on a headless ubuntu desktop.
My USR IOT (USR-TCP232-410S) page is showing many more options than yours, and a seperate page for RS232 and RS485. Both with identical parameters that I can change/adjust.
I presume that Socket B is used for Tx and Socket A is used to Rx - is this correct?
For the Socket A parameters I have the drop down choice of
UDP Client
TCP Client
UDP Server
TCP Server
Httpd Client
on the two TCP choices above there is after the option of either “NONE /or/ Modbus TCP” and also on the next line of parameters to either “KEEP /or/ KICK”.
Finally on the “Registry Type” , I have a choice between "NONE/USER Register/USR Cloud/or/ MAC as Register.
Final question : I can only get the Conn Status (ETH)B: Connected and the TX count increasing, when I have set the Socket B parameters to UDP Client - is this the correct configuration?
192.168.1.8 is the fixed IP of my ubunu desktop with HA
192.168.1.11 is the fixed IP of the IP to Serial box.
Hello,
it’s difficult to answer as the interface of your boiler (RS232 with TTL level ?) seems not to be the usual one. May be the data protocol is not the same also…