Closed osazcas closed 2 years ago
Enums are defined in the enums.py file and can be imported with from pyemvue import Scale
or from pyemvue import Unit
. So you would set the unit to unit=Unit.KWH.value
.
Oh, but I was wondering if there is a way to get kW instead of kWh. So basically what is the power at any specified time.
If you're trying to get the current power in watts rather than in kilowatt-hours then you have to scale it yourself, the API only returns the total kwh used in the interval. So if 0.002 kwh was used in 1 second then:
watts=kwh*3600s/h*1000w/1kw
ie 0.002*3600*1000=7200 watts
For kilowatts just ignore the *1000
part.
Nice! That's what I was going for. Thank you very much!
I am trying to get power data by using the following line:
usage_over_time, start_time = vue.get_chart_usage(devices[0].channels[0], datetime.datetime.utcnow()-datetime.timedelta(seconds=1), datetime.datetime.utcnow(), scale=Scale.SECOND.value, unit='Kilowatt')
I think that the library does not cover power units in the enums, so I guessed this was the correct name for the API to interpret. I am not getting a response from such API, so I wonder if it is possible to get information that is not energy.