magico13 / ha-emporia-vue

Home Assistant Integration for Emporia Vue Energy Monitor
MIT License
474 stars 64 forks source link

Possibility to request missing hours #189

Open ccoles146 opened 1 year ago

ccoles146 commented 1 year ago

Firstly thanks for the great work in producing this integration. It is largely because of buying an Emporia Vue and a Tuya Door sensor that I got into Home Assistant. I have a request... I turn my Internet off at night to conserve electricity. The Emporia vue still gathers data and seems to cope with the lack of Internet as the following day the usage overnight can be seen in the app. However, the Home Assistant integration only sees data where Home Assistant and the Internet are both online. Would it be possible to add the ability to query the API for the missing hours when it comes back online? My coding skills aren't up to much and I'm new to HA but if you point me to the appropriate place in your code then I might be able to figure it out myself also.

magico13 commented 1 year ago

Unfortunately I'm not aware of a way to backfill data like that, other than directly interfacing with the backing Home Assistant database. Home Assistant tracks the history itself and all I'm really giving it is the latest sensor values and the rest is sort of out of my hands.

If anyone is aware of a way to do this please chime in, I'm not an expert with the Home Assistant API by any means so it's entirely possible I've missed something.

bobstaff commented 10 months ago

You might not be getting the right data for the times you off line. I contacted Emporia about a stretch of time that I was getting exactly the same values for several hours on the app. They told me that the actual device only stores information for about 20 minutes. If it can't connect to their servers the data after that is lost until it connects again. The servers averages out the difference and devides it by however long it was offline. That's why all the same numbers in a row.

S54Mpower commented 8 months ago

If you look at the vuegraf.py project on github, there is a section which you can edit in the code at initial startup or database reset to pull historic days from the emporia cloud. I am using this on my influxdb setup and is working perfect. Maybe something that you could implement in the HA emporia project.


parser.add_argument(
        '--historydays',
        help='Starts execution by pulling history of Hours and Day data for specified number of days.  example: --historydays 60',
        type=int,
        default=0
        )