ostrya/PresencePublisher

Configured send message

Gidrogen opened this issue · 4 comments

Hi,
Is there any way to add my key to the json message?

{
  "chargingState": "DISCHARGING",
  "plugState": "N/A",
  "connectedWifi": "N/A",
  "geoLocation": "N/A",
  "batteryLevel": 90,
  "currentTimestamp": 1691093107,
  "nextScheduledTimestamp": 1691093167,
  "nextAlarmclockTimestamp": 1691132640,
"myKey":"My Static Value"
}
ostrya commented

At the moment, this is not possible. What would be your use-case? If it's a different value per phone, why not let the phones post to different topics? Or do you want to regularly change the value?

Use case: A bash script forwards my mqtt messages to the corresponding telegram chat. So I want to pass the ID number. Also, I would like to pass the device name in the message body, which is much more convenient.
I can't change the bash script to parse mqtt topics.

ostrya commented

If it's just about the device name, how about just adding a data field DEVICE_NAME that is resolved from the device's name as configured in "Settings" - "About the phone" - "Device name" (starting from Android 7.1) or the device's Bluetooth name in older devices?

Does the new device name help with your use case? Or do you really need a freely configurable field?