cpainchaud / RFLink32

RFLink for ESP, with MQTT client
Other
118 stars 44 forks source link

Add per device topics and json payload to MQTT #85

Open crazyserver opened 12 months ago

crazyserver commented 12 months ago

Instead of just using one topic for send and one for receive, use a full topic tree based on protocol and device ID.

crazyserver commented 8 months ago

Hi @cpainchaud,

I'd like to know if it would be great to implement that. I have something to start with that. I creates a topic for each device when a signal is received.

Example: Topic: rflink/msg/RTS/1234ab Payload: {code: '0000',cmd: 'DOWN'}

Instead of: Topic: rflink/msg Payload: 20;7F;RTS;ID=1234ab;CODE=0000;CMD=DOWN;

This way it uses standard mqtt model of passing data. My current version emits both the "plain" and the json approach and it's only used for received signals.

Pros: When using HomeAssistant, or any other MQTT broker you can listen to topics by device and then read the json having all the params separately.

We can also include some RFLink code in the json.

Cheers,

Pau

cpainchaud commented 8 months ago

Hi @crazyserver,

I don't have the time to work on it but feel free to submit a patch and I will review&merge it