Integrate sensor value from script inside tasmota to HA

Hi to all.

I setup a water flow sensor with a Wemos D1 and a Water Flow sensor mod.YF-B5.
I setup Tasmota like this GitHub - KonstantinPfeiffer/TasmotaWaterFlow

I integrate the Tasmota device inside HA, but i can see only the Counter Value.

I edit the script to create a JSON like

tele/%topic%/SENSOR {"FlowRate":%flow%,"PulseRate":%delta%,"WaterFlow":"%cflow%","Total":%liter%,"Counter":%total%}

as i see in other tasmota device i have in my house.

I think is not good enough.

This is the output of the Tasmota WebUI (all the value except the Counter1 all calculated in the script)

This is what i get in HA:

What kind of JSON i need to create, to get HA side catch all the data?

Do these actually get filled ? Do you see values in e.g. MQTT Explorer ?

yes, the MQTT broker have the information

i try to add the Timestamp.

also i have the device in the tasmota/discovery topic, but i don’t have the value i want

Actually i add an entity to HA by configuration.yaml with following code

mqtt:
  sensor:
    - name: "Consumo Acqua Acquedotto"
      state_topic: "tele/sensore_acqua/SENSOR"
      value_template: "{{ value_json.Total }}"
      device_class: water
      state_class: total_increasing
      unit_of_measurement: L

but how can i create the entity directly into the Tasmota device, so HA can discover it automatically?

Thanks

I think i’m almost done…

Naturally i have the topic tasmota/discovery/%macaddress%/sensors populated with the Counter1

If i add in the script the section

>J
,"Acqua":{
"FlowRate":%flow%,
"PulseRate":%delta%,
"WaterFlow":%cflow%,
"Total":%liter%
}

the result is

but this time the JSON is not idented… maybe is only this the problem.

Thanks