Hi,
I’ve now spent an unproportional amount of time with this now but to no avail.
I have a heating system that I’ve built myself, and I have a ton of sensors coming out over a tcp port.
I can format the output in any way needed in order to get it in HA to eventually be feed in to node red to control everything with.
so to the problem:
I send a “*\n” to a tcp connection on my own hw, that one responds back (can be changed…)
15.999695;31.999390;28.300000;15.700000;
all these are different measurement points of various parameters, so I want to bring each value in as a separate sensor in HA. I can do this like below, but that suxx for many reasons, especially when I soon is going to have 50 sensors.
sensor:
- platform: command_line
name: heating_flow
scan_interval: 5
command: echo "*\n" | timeout 1 nc 192.168.0.88 5001
value_template: "{{ value.split(';')[0] }}"
unit_of_measurement: "l/min"
- platform: command_line
name: radiator_flow
scan_interval: 5
command: echo "*\n" | timeout 1 nc 192.168.0.88 5001
value_template: "{{ value.split(';')[1] }}"
unit_of_measurement: "l/min"
So instead I just want to do 1 TCP request, and preferably with the TCP sensor, ie
sensor:
- platform: tcp
name: tanksystem
host: 192.168.0.88
port: 5001
timeout: 2
payload: "*\n"
value_template: "{{ value }}"
- platform: template
sensors:
radiatorflow:
friendly_name: Radiator flow
value_template: "{{ states('tanksystem').split(';')[0] }}"
unit_of_measurement: "l/min"
heatingflow:
friendly_name: Heating flow
value_template: "{{ states('tanksystem').split(';')[1] }}"
unit_of_measurement: "l/min"
etc
etc..
the variable (or whatever you call it) heatingsystem looks just fine when I look at the entity in HA, but the radiatorflow can’t be rendered.
Please help me understand how I can do this, I tried the above but instead using value_json and instead printed a json over tcp ala
{
"heatingsystem": {
"flows": {
"heater": 1,
"radiator": 1
},
"temperatures": {
"RadiatorOut": 1.43,
"RadiatorIn": 3.23423,
"TankTop": 4.2,
"TankMid": 5,
"TankBottom": 6
}
}
}
but I couldn’t for my life get the
'states(‘tanksystem’)[‘heatingsystem’][‘flows’][‘heater’] 'or
'states(‘tanksystem’).heatingsystem.flows.heater ’
or similar work.
if someone could point me to any way where it explains how to do this very simple task I would be extremly happy, and you may have saved a life or at least a ton of pulled hair…