bvlaicu / home-assistant-addons

MIT License
17 stars 16 forks source link

Unable to retrieve meter data #9

Open kunalkhosla opened 3 years ago

kunalkhosla commented 3 years ago

I cannot tell if this is a misconfiguration or something changed on oru.com


  File "/usr/local/lib/python3.7/dist-packages/coned/meter.py", line 93, in last_read
    await self.browse()
  File "/usr/local/lib/python3.7/dist-packages/coned/meter.py", line 151, in browse
    await page.click(".js-login-new-device-form .button")
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/page.py", line 1546, in click
    await frame.click(selector, options, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/frame_manager.py", line 584, in click
    await handle.click(options)
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/element_handle.py", line 178, in click
    obj = await self._clickablePoint()
  File "/usr/local/lib/python3.7/dist-packages/pyppeteer/element_handle.py", line 112, in _clickablePoint
    'Node is either not visible or not an HTMLElement')
pyppeteer.errors.ElementHandleError: Node is either not visible or not an HTMLElement
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "run.py", line 18, in <module>
    startTime, endTime, value, uom = asyncio.get_event_loop().run_until_complete(meter.last_read())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.7/dist-packages/coned/meter.py", line 114, in last_read
    raise MeterError("Error requesting meter data")
coned.meter.MeterError: Error requesting meter data`
bvlaicu commented 3 years ago

It's working for me so it's not oru.com. Hard to say what it could be without additional logging. I too get some errors occasionally, but overall the meter data is returned successfully. I ended up running the add-on from "local", so I can easily add helpful log statements and reload it with ease, in case of issues. Running locally means simply adding the add-on code under the /addons/local/. Usually they get installed under /addons/core/.

kunalkhosla commented 3 years ago

ok, so I cloned your repo and made the tests run locally. Turned out my UUID was incorrect. There are apparently two UUIDs in oru.com, and i picked up the wrong one. I'll send in a PR to your docs to correctly determine the right UUID.

On a separate note, does your integration show up data in the energy dashboard? I have about 10 data points so far, but my energy dashboard says it doesnt have any data to show

Screen Shot 2021-08-23 at 5 47 36 PM

Grafana Chart

Screen Shot 2021-08-23 at 5 48 11 PM
bvlaicu commented 3 years ago

I didn't spend too much time on it, but I was able to configure the energy dashboard with the energy meter sensor that I have configured based on the oru usage sensor. Something like this:

utility_meter:
  daily_energy:
    source: sensor.oru_current_energy_usage
    net_consumption: true
    cycle: daily

So I added this sensor.daily_energy as the "Grid consumption" sensor in the energy dashboard. Probably not the most ideal way, but I guess will do for now.

image image
kunalkhosla commented 3 years ago

ok, I think this is much better than what I proposed in #12 . I am going to try this with my setup, and if this works, I will close my PR