Hi, a need a help. I have something like this. It is working but in lovelace i get bad values. I have battery voltage in kWh, or Last Readout in Current consumption. Where is an error. I readed out template docs, but i don’t know how to rewrite it to. Any help or advice ?
sensor:
- platform: rest
scan_interval: 900
name: OneMeter
resource: https://cloud.onemeter.com/api/devices/<DEVICE_ID>
value_template: "{{ value_json.lastReading.OBIS['15_8_0'] }} {{ value_json.lastReading.OBIS['S_1_1_2'] }} {{ value_json.lastReading.OBIS['S_1_1_4'] }} {{ value_json.usage['thisMonth'] }} {{ value_json.usage['previousMonth'] }} {{ value_json.firmware['currentVersion'] }}"
force_update: true
headers:
Authorization: <API_KEY>
- platform: template
sensors:
onemeter_kwh:
friendly_name: "kWh"
unit_of_measurement: "kWh"
icon_template: mdi:flash
value_template: "{{ states.sensor.onemeter.state.split(' ')[0] }}"
onemeter_voltage:
friendly_name: "OneMeter Battery Voltage"
unit_of_measurement: "v"
icon_template: mdi:battery
value_template: "{{ states.sensor.onemeter.state.split(' ')[1] }}"
onemeter_timestamp:
friendly_name: "OneMeter Last Readout"
icon_template: mdi:clock
value_template: "{{ states.sensor.onemeter.state.split(' ')[2] }}"
onemeter_this_month:
friendly_name: "Current Consumption"
unit_of_measurement: "kWh"
icon_template: mdi:calendar-month
value_template: "{{ states.sensor.onemeter.state.split(' ')[3] }}"
onemeter_previous_month:
friendly_name: "Previous Consumption"
unit_of_measurement: "kWh"
icon_template: mdi:calendar-month-outline
value_template: "{{ states.sensor.onemeter.state.split(' ')[4] }}"
onemeter_firmware:
friendly_name: "OneMeter Firmware Version"
icon_template: mdi:chip
value_template: "{{ states.sensor.onemeter.state.split(' ')[5] }}"