I have a fairly old heat pump that every minute over a rs232 sends a raw text string containing multiple tab separated values. The first value is a time stamp, the rest is a mix of temperature, watts, Hz, binary values, etc.
6:12:06 20,0 50,0 1,888E+01 5,052E+01 -1,437E+01 3,622E+01 10100 11001 75,0 75 8 0 0,000E-00 2,892E+03 5,881E+03 4,110E+01 4999 16,69 5,400E+00 3,06 75 6835 2000 0 3,000E+05 3,200E+07 4,000E+07 -4,687E+02 -3,750E+02 -7,812E-02 1,500E+03 0,000E-00 8,880E+02 9,539E+02 0,00 0,00 0,000E-00 0 0 0 0 0 0 0
Data is sent via a device converting to MQTT and in one Topic forwarding it to the broker. I can see the message arrive in MQTT so the connection between the heat pump and HA MQTT broker works. After that I have two issues.
#1. The data arrives divided up into 4 messages with the same Topic ”Heatpump”. It seems that the heat pump every minute sends the data in four bursts with a slight delay (milliseconds) but enough to have MQTT divide the data up. In HA MQTT it looks like this.
Message 0 received on Heatpump at 21:01:
6:12:06 20,0 50,0 1,888E+01 5,052E+01 -1,437E+01 3,622E+01 10100 11001 75,0 75 8 0
Message 1 received on Heatpump at 21:01:
0,000E-00 2,892E+03 5,881E+03 4,110E+01 4999 16,69 5,400E+00 3,06 75 6835 2000 0
Message 2 received on Heatpump at 21:01:
3,000E+05 3,200E+07 4,000E+07 -4,687E+02 -3,750E+02 -7,812E-02 1,500E+03 0,000E-00 8,880E+02 9,539E+02 0,00 0,00
Message 3 received on Heatpump at 21:01:
0,000E-00 0 0 0 0 0 0 0
I am only interested in the first message with the time stamp. The other three can be discarded, however this can’t be done on the client side.
#2. I have tried to extract values but can’t get them into Sensors. I have tried the approach below based on advice found in this forum.
- name: "Heater room temp setting”"
unique_id: Room_temp_setting
state_topic: "Heatpump"
unit_of_measurement: "°C"
value_template: "{{ trigger.payload[12:-1].split('\t')[0] | float(0) }}"
- name: "Heater tap water temp setting"
unique_id: Tap_water_temp_setting
state_topic: "Heatpump"
unit_of_measurement: "°C"
value_template: "{{ trigger.payload[12:-1].split('\t')[1] | float(0) }}"
etc.
I get “Unknown” when I try to view the values.
I believe that the different content in the four messages for the same Topic confuses things up.
Any suggestions on how to approach this are greatly appreciated.
Thank’s/TC