I am trying to pull “dc voltage” out of this JSON MQTT message. I can do this sucessfull with a template if the component does not have a space in the name but whenever there is a space I can’t seem to get it right.
Here is the JSON output from MQTT
{"data":"01FF120100000000","dc current":-2000000,"dc voltage":13.7,"device priority":255,"device priority definition":"undefined","dgn":"1FFFD","instance":1,"instance definition":"main house battery bank","name":"DC_SOURCE_STATUS_1","timestamp":"1677347972.694572"}
The value I want is “dc voltage”. This is the sensor config I have that generates an error:
- name: "Chassis Battery"
state_topic: "RVC/DC_SOURCE_STATUS_1/1"
unit_of_measurement: "V"
value_template: "{{ value_json.'dc voltage' }}"
icon: mdi:storage-tank
unique_id: "chasis_voltage"
state_class: "measurement"
Thanks for your help!