forked from sqozz/sem6000
Merge branch 'features/total_power' of sqozz/sem6000 into master
This commit is contained in:
commit
34b1e667af
|
@ -9,6 +9,7 @@ class SEMSocket():
|
||||||
current = 0
|
current = 0
|
||||||
power = 0
|
power = 0
|
||||||
power_factor = 0
|
power_factor = 0
|
||||||
|
total_power = 0
|
||||||
frequency = 0
|
frequency = 0
|
||||||
mac_address = ""
|
mac_address = ""
|
||||||
custom_service = None
|
custom_service = None
|
||||||
|
@ -197,12 +198,14 @@ class SEMSocket():
|
||||||
voltage = data[8]
|
voltage = data[8]
|
||||||
current = (data[9] << 8 | data[10]) / 1000
|
current = (data[9] << 8 | data[10]) / 1000
|
||||||
power = (data[5] << 16 | data[6] << 8 | data[7]) / 1000
|
power = (data[5] << 16 | data[6] << 8 | data[7]) / 1000
|
||||||
|
total_power = (data[14] << 24 | data[15] << 16 | data[16] << 8 | data[17]) / 1000
|
||||||
|
|
||||||
self.__btle_device.voltage = voltage
|
self.__btle_device.voltage = voltage
|
||||||
self.__btle_device.current = current
|
self.__btle_device.current = current
|
||||||
self.__btle_device.power = power
|
self.__btle_device.power = power
|
||||||
self.__btle_device.frequency = data[11]
|
self.__btle_device.frequency = data[11]
|
||||||
self.__btle_device.powered = bool(data[4])
|
self.__btle_device.powered = bool(data[4])
|
||||||
|
self.__btle_device.total_power = total_power
|
||||||
|
|
||||||
# calculated values
|
# calculated values
|
||||||
self.__btle_device.power_factor = power / (voltage * current)
|
self.__btle_device.power_factor = power / (voltage * current)
|
||||||
|
|
Loading…
Reference in a new issue