@hajo62 wrote:
I have two sensors:
The first results in:
{ "timestamp": "2020-03-24T17:00:00+01:00", "value": 369.0, "trend": -1, "stateMnwMhw": "normal", "stateNswHsw": "normal" }
and to extract the value, I use this template sensor:- platform: template sensors: rheinpegel: value_template: > {% set state = states('sensor.rheinpegel_object') | from_json %} {{ state.get('value', 'unknown') | multiply(0.01) }}
The second one results in:
{‘cases’: 32879, ‘deaths’: 140, ‘recovered’: 830, ‘tested’: ‘unknown’}But with template below that does not work and throws:
Error rendering template: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
What’s different?
- platform: template sensors: cases: value_template: > {% set state = states("sensor.berliner_morgenpost") | from_json %} {{ state.get("cases", "nix") }}
Posts: 8
Participants: 5