home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.19k stars 30.22k forks source link

OneMeter Cloud API #82589

Closed kubasxp closed 1 year ago

kubasxp commented 1 year ago

The problem

Hello, Just today I've installed Home Assistant and so far everything went smooth, I've connected few devices etc. Now I have tried to connect my OneMeter to Home Assistant but I've failed. There is code prepared from OneMeter support itself but looks like it's outdated and from what I heard they don't care about rewriting code so here is my question - have someone managed to connect it to Home Assistant? Below is code from OneMeter team

What version of Home Assistant Core has the issue?

2022.11.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

- platform: rest
  scan_interval: 900 # Makes a request every 15min
  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] }}"

Anything in the logs that might be useful for us?

No response

Additional information

No response

ludeeus commented 1 year ago

Please use forums or discord for configuration questions. The documentation for rest might help you https://www.home-assistant.io/integrations/rest/