ThomDietrich / miflora-mqtt-daemon

Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT to your smart home system, with cluster support 🌱🌼πŸ₯€πŸ‘🌳
MIT License
606 stars 141 forks source link

for usage with influxdb and grafana the json string needs to be extended #92

Open awiltschek opened 4 years ago

awiltschek commented 4 years ago

Is it possible to add the Name and the mac address to the json string which is published to mqtt so by making use of node red this fields also gets added to influxdb. at the moment only the main values get written into influx but without name and/or mac address you cannot define respective dashboards for the plants. as i am not so keen in your code this would help me to get further with my project having NodeRED-MQTT and your deamon pushing data into influx for usage with grafana ! Big Tnx Alex

awiltschek commented 4 years ago

ok if ixed it now for me and for the mqtt_json reporting by changing the data generating section.

for param,_ in parameters.items():
  if reporting_mode == 'mqtt-json':
    data['name'] = flora['name_clean']
    data['location'] = flora['location_clean']
    data['mac'] = flora['mac']
    data[param] = flora['poller'].parameter_value(param)
print_line('Result: {}'.format(json.dumps(data)))

and some other small improvements for clean name and location.

ThomDietrich commented 4 years ago

I can't see any harm in this. Will include soon

kwesolowski commented 4 years ago

Would be great, now I need to encode this in topic by using very fake names ;)