-
Notifications
You must be signed in to change notification settings - Fork 181
Open
Description
I have a small problem that i'm not able to solve :(
There is a mqtt topic that receives idle/heat from device (not able to change on device side).
Now as i'd like to store the heat and idle in influx this needs to be binary (1 or 0).
I have tried to "convert it" with functions but seems my python/mqttwarn knowledge lacks ...
In mqttwarn.ini I have defined:
[z2m/0xa4c138d272f8dd7f/running_state]
format = convert_running_state()
targets = influxdb:floor_heating
And in samplefuncs.py I have tried different functions but the latest is
from mqttwarn.model import Service
def convert_running_state(topic: str, message: str, section: str, srv: Service):
if message == 'idle':
return 123
But that is wrong and gives python error ... no idea how to simply convert incoming payload 'heat'/'idle' to 1/0 ...
Anyone able to share some light how to achieve that :)?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels