magico13 / PyEmVue

Python Library for the Emporia Vue Energy Monitor
MIT License
185 stars 36 forks source link

Occasional zero values in my main panel power feed readings. #61

Closed DabblerIOT closed 4 months ago

DabblerIOT commented 4 months ago

A couple things. New to emporia as of a couple weeks ago. This isn't happening when I look at data on emporia side. 2 I am using another (insecure) api that is having the same problem. Stood up ha vm, on my nas with to test.

I believe the response from /getDeviceListUsages is returning a 1 length array (when array should be # of channels on a device or configured in request). Setting up a test to get debug info (capture the 1 length array with data response from the emporia energy API so I can share it later. Will patch my local copy to test. (Just have to sort out how to do that :)). This would match with only the mains having a 0 glitch every now and again. Every other device does not have the issue (as in short array will only mess up the main panel reading) and other data won't be updated.

Line #103 in pyemvue.py needs something to check response is valid, and not a length 1 valid data zero array. Believe we are going to find actual issue is with emporia api but considering it is unsupported.... for us. """if j.length != expected length (# of channels)-- retry request.."""

Thanks. Will post my fix and get it writing log or setup stand alone test with pyemvue to catch issue. And provide actual http response and headers to prove.

BTW - Thank you for doing your work and documenting the api. Really want to hit it directly with javascript / browser, but they have cors headers on the api which makes that a no-go for now / ever.

webdeck commented 4 months ago

Related to #39 ?

DabblerIOT commented 4 months ago

Yes :( I missed that when I was checking open issues. Should I just post my fix here or on 39 when I have it?