Compare commits
1 Commits
v1.29.9
...
add-networ
| Author | SHA1 | Date | |
|---|---|---|---|
| 26b955a1e8 |
@@ -22,6 +22,7 @@ import json
|
|||||||
import bottle as B
|
import bottle as B
|
||||||
import tHome as T
|
import tHome as T
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def meter(client, data, cfg):
|
def meter(client, data, cfg):
|
||||||
msg = {
|
msg = {
|
||||||
@@ -30,7 +31,8 @@ def meter( client, data, cfg ):
|
|||||||
"produced": data.Produced, # kWh
|
"produced": data.Produced, # kWh
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( cfg.mqttEnergy, msg )
|
return cfg.mqttEnergy, msg
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def instant(client, data, cfg):
|
def instant(client, data, cfg):
|
||||||
@@ -39,7 +41,8 @@ def instant( client, data, cfg ):
|
|||||||
"power": data.Power * 1000, # W
|
"power": data.Power * 1000, # W
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( cfg.mqttPower, msg )
|
return cfg.mqttPower, msg
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def price(client, data, cfg):
|
def price(client, data, cfg):
|
||||||
@@ -48,7 +51,18 @@ def price( client, data, cfg ):
|
|||||||
"price": data.Price,
|
"price": data.Price,
|
||||||
"tier": data.Tier,
|
"tier": data.Tier,
|
||||||
}
|
}
|
||||||
return ( cfg.mqttPrice, msg )
|
return cfg.mqttPrice, msg
|
||||||
|
|
||||||
|
|
||||||
|
# ===========================================================================
|
||||||
|
def network(client, data, cfg):
|
||||||
|
msg = {
|
||||||
|
"status": data.Status,
|
||||||
|
"description": data.Description,
|
||||||
|
"linkstrength": data.LinkStrength
|
||||||
|
}
|
||||||
|
return cfg.mqttNetwork, msg
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
handlers = {
|
handlers = {
|
||||||
@@ -59,13 +73,14 @@ handlers = {
|
|||||||
"InstantaneousDemand": instant,
|
"InstantaneousDemand": instant,
|
||||||
# "MessageCluster" :
|
# "MessageCluster" :
|
||||||
# "MeterInfo" :
|
# "MeterInfo" :
|
||||||
#"NetworkInfo" :
|
"NetworkInfo": network,
|
||||||
"PriceCluster": price,
|
"PriceCluster": price,
|
||||||
# "Reading" :
|
# "Reading" :
|
||||||
# "ScheduleInfo" :
|
# "ScheduleInfo" :
|
||||||
# "TimeCluster" :
|
# "TimeCluster" :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
|
|
||||||
@B.post('/')
|
@B.post('/')
|
||||||
@@ -90,6 +105,7 @@ def root_post():
|
|||||||
|
|
||||||
return "ok"
|
return "ok"
|
||||||
|
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
#
|
#
|
||||||
# Main applications script
|
# Main applications script
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ mqttPrice = 'power/elec/Home/price'
|
|||||||
#Current rate label (returns rate label from meter)
|
#Current rate label (returns rate label from meter)
|
||||||
mqttRateLabel = 'power/elec/Home/ratelabel'
|
mqttRateLabel = 'power/elec/Home/ratelabel'
|
||||||
|
|
||||||
|
#Network Info Topic (returns status, description and link strength from meter)
|
||||||
|
mqttNetwork = 'power/elec/Home/network'
|
||||||
|
|
||||||
#===========================================================================
|
#===========================================================================
|
||||||
#
|
#
|
||||||
# Logging configuration. Env variables are allowed in the file name.
|
# Logging configuration. Env variables are allowed in the file name.
|
||||||
|
|||||||
Reference in New Issue
Block a user