mirror of
https://github.com/Tafkas/fritzbox-munin.git
synced 2023-10-10 11:36:55 +00:00
power switches/sockets: fixed aggregated energy measurements
This commit is contained in:
parent
2d6a97315b
commit
37b1ba1158
@ -137,14 +137,12 @@ def getSimplifiedDevices(debug=False):
|
|||||||
if "powerConsumptionInWatt" in skill:
|
if "powerConsumptionInWatt" in skill:
|
||||||
simpleDev["powerInWatt"] = skill["powerConsumptionInWatt"]
|
simpleDev["powerInWatt"] = skill["powerConsumptionInWatt"]
|
||||||
|
|
||||||
|
if "powerPerHour" in skill:
|
||||||
|
simpleDev["energyInKWH"] = float(skill["powerPerHour"]) / 1000
|
||||||
|
|
||||||
if "voltageInVolt" in skill:
|
if "voltageInVolt" in skill:
|
||||||
simpleDev["voltageInVolt"] = skill["voltageInVolt"]
|
simpleDev["voltageInVolt"] = skill["voltageInVolt"]
|
||||||
|
|
||||||
|
|
||||||
# FIXME: no energy any more
|
|
||||||
# if "FIXME" in skill:
|
|
||||||
# simpleDev["energyInKWH"] = FIXME
|
|
||||||
|
|
||||||
elif (skillType == "SmartHomeSocket"):
|
elif (skillType == "SmartHomeSocket"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -172,8 +170,8 @@ def getSimplifiedDevices(debug=False):
|
|||||||
# end getSimplifiedDevices
|
# end getSimplifiedDevices
|
||||||
|
|
||||||
|
|
||||||
def get_smart_home_temperature(debug=False):
|
def get_smart_home_measurements(debug=False):
|
||||||
"""get the current temperature"""
|
"""get the current measurements (temperature, humidity, power, states, ...)"""
|
||||||
|
|
||||||
|
|
||||||
simpleDevicesDict = getSimplifiedDevices(debug)
|
simpleDevicesDict = getSimplifiedDevices(debug)
|
||||||
@ -581,11 +579,11 @@ if __name__ == '__main__':
|
|||||||
elif len(sys.argv) == 2 and sys.argv[1] == 'autoconf':
|
elif len(sys.argv) == 2 and sys.argv[1] == 'autoconf':
|
||||||
print('yes')
|
print('yes')
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == 'debug':
|
elif len(sys.argv) == 2 and sys.argv[1] == 'debug':
|
||||||
get_smart_home_temperature(True)
|
get_smart_home_measurements(True)
|
||||||
elif len(sys.argv) == 1 or len(sys.argv) == 2 and sys.argv[1] == 'fetch':
|
elif len(sys.argv) == 1 or len(sys.argv) == 2 and sys.argv[1] == 'fetch':
|
||||||
# Some docs say it'll be called with fetch, some say no arg at all
|
# Some docs say it'll be called with fetch, some say no arg at all
|
||||||
try:
|
try:
|
||||||
get_smart_home_temperature()
|
get_smart_home_measurements()
|
||||||
except:
|
except:
|
||||||
sys.exit("Couldn't retrieve fritzbox smarthome temperatures")
|
sys.exit("Couldn't retrieve fritzbox smarthome temperatures")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user