Hi,
I try to read different MQTT subtopics into a sensor with attributes.
In the MQTT-Explorer it looks like this:
I tried following code to read this out:
- name: "Test Heizung heute Energieverbrauch"
state_topic: "open3e/vitocal250/680_548_EnergyConsumptionCentralHeating/+"
state_class: total_increasing
unique_id: 680_548_TestEnergyConsumptionCentralHeatingToday
object_id: 548_TestEnergyConsumptionCentralHeatingToday
device:
name: "Open3e_Vitocal250A"
identifiers: !secret vitocal_sn
manufacturer: "Viessmann"
model: "Vitocal 250-A"
icon: mdi:home-lightning-bolt
value_template: '{{value_json.Today}}'
unit_of_measurement: "kWh"
device_class: energy
json_attributes_topic: "open3e/vitocal250/680_548_EnergyConsumptionCentralHeating/+"
json_attributes_template: '{{ value_json | tojson }}'
However the sensor remains ‘unknown’ with no contents in the attributes.
What works, is reading all subtopics in single steps and then templating them together in a Helper. While the effort is acceptable with 6 subtopics, it would be favourable to read out more complex Topics in one step automaticly.
Like this one:
Do you have any ideas?
Best regards
Hendrik