Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95343

Problem with a REST sensor (not technical but knowledge)

$
0
0

@RalfP wrote:

Dear all,

I would like to integrate my new charging station for my car into HA as a sensor.
The charger has a REST api and when I curl the status I get the following output (truncated)

{"success":true,"age":132,
"data":{"version":"B","tme":"0311190734","rbc":"8","rbt":"395977232","car":"4",
"amp":"32","err":"0","ast":"0","alw":"1","stp":"0","cbl":"32","pha":"56","tmp":"19",
"dws":"1944425","dwo":"0","adi":"0","uby":"0","eto":"1020","wst":"3","txi":"1", ....}

I’ve got that in my configuration.yaml

sensor:   
  - platform: rest
    resource: https://api.go-e.co/api_status?token=some_token&wait=0
    name: "Ladestation"
    scan_interval:
      minutes: 2
    value_template: '{{ value_json["data"] }}'
    json_attributes:
      - data
  - platform: template
    sensors:
      car_state:
        friendly_name: 'Zustand Ladestation'
        value_template: "{{ state_attr('sensor.Ladestation', 'data').car }}"
      charging_power:
        friendly_name: 'Ladestrom'
        value_template: "{{ state_attr('sensor.Ladestation', 'amp') }}"
      unit_temp:
        friendly_name: 'Temperatur der Ladestation'
        value_template: "{{ state_attr('sensor.Ladestation', 'data').tmp }}"
      error_code:
        friendly_name: 'Fehlermeldung Ladestation'
        value_template: "{{ state_attr('sensor.Ladestation', 'data').err }}"
       total_energy:
         friendly_name: 'Gesamte geladene Energiemenge'
         value_template: "{{ state_attr('sensor.Ladestation', 'data').eto }}"

With that I get no output for car_state: sensor (blank) and “None” for the charging_power: sensor.

The others will go the same way, so I just focus on these two now.

So here is what I really would like to have (but I don’t understand yet fully, if this is possible).

One sensor with multiple readings, one for car_state, one for charging_power, one for …

When I do one sensor with just one data field (e.g. amp) I already got the right value. Unfortunately I did not save that code for reference :frowning:

I’ve read several posts now and I’m trying for 2 days to get it working. I know I just have it close to my fingertips but maybe someone more experienced like me will solve this in seconds and then I will just cry…

Help is highly appreciated.

Thanks upfront
RalfP

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>