magico13 / PyEmVue

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

charging_rate , max_charging_rate ... where is current charge rate ? #81

Closed aviadoffer closed 1 month ago

aviadoffer commented 1 month ago

emporia So the max_charge_rate is 48amp, which is what it's configured during install, not shown here but I don't need it anyway. charger._charging_rate is 14amp I can't figure what value is the 15amp (which is the current draw by the EV as it takes time to adjust), how does the app get it and I don't see it in the json returning ?

Ignore the 12amp showing, thats an app behind issue.

magico13 commented 1 month ago

My car's not set up right now to test locally, but I believe the charging_rate should be the 15 amps (the max it'll do, as if you adjusted the slider) and max_charging_rate is the maximum set by the breaker (48 amps when on a 60 amp breaker). The actual charging rate is by asking for the device usage and passing just the gid for the charger, something like below. There's only one channel and only one entry in the dictionary, so you can omit the loops. If you want the most immediate value you can grab the seconds scale, just don't grab it too often (and scale the usage appropriately).

usage_dict = vue.get_device_list_usage('62626', datetime.datetime.now(datetime.timezone.utc), Scale.MINUTE.value, Unit.AMPHOURS.value)
for (gid, usageDevice) in usage_dict.items():
    for (channelNum, usageChannel) in usageDevice.channels.items():
        scaledUsage = usageChannel.usage * 60 # convert Ah used over the minute to average Amps
        print(f'{gid} - {channelNum} - {usageChannel.name} - {scaledUsage}A')
aviadoffer commented 1 month ago

Awesome, I will take a look

aviadoffer commented 1 month ago

that worked perfectly! you the man!! thanks much for this amazing project