FUXA icon indicating copy to clipboard operation
FUXA copied to clipboard

[FEATURE] mqtt JSON, only publish on local update,

Open robbudge opened this issue 1 year ago • 0 comments

Describe the feature When a mqtt.publish is configured for JSON format utilizing existing tags. A publish is triggered every time the values are updated, even if the values are updated as part of an existing subscription.

Broker Sends to Subscriber topic (1 Second Updates) {"Mode":0,"Debounce":50,"Hi_Hi_Alarm":111.0,"Debounce":50,"Hi_Warn":80.0,"Low_Low_Alarm":10.0,"Low_warn":25.0,"Eu_Max":100.0,"Eu_Min":0.0,"Override_Value":0.0,"Raw_Max":20000.0,"Raw_Min":0.0,"Silence":0,"Raw":0.0,"EU":0.0,"PCT_Scale":0.0,"Ready":1,"EU":0.0,"Status":1,"StrStatus":"Low_Low_Alarm"}

A publishing topic is configured to allow fuxa to modify some parameters for example 'Hi_Hi_Alarm' image

if Hi_Hi_alarm is updated from the subscription fuxa instantly republishes the information (No Need as the change was from the broker) Now the problem occurs when the value is on a page and updated. The value is locally updated to say "Hi_Hi_Alarm":105.0 and the updated JSON published correctly. The receiving device has yet to receive the message and fuxa receives a message from the broker with the current value of "Hi_Hi_Alarm":110.0 Fuxa then publishes another JSON with the original value of "Hi_Hi_Alarm":110.0.

The receiving device see's the following subscription information in 2 separate events "Hi_Hi_Alarm":105.0 followed by "Hi_Hi_Alarm":110.0 Hi_Hi_Alarm remains at 110.

Describe the solution you'd like Option 1, if a tag is part of a JSON subscription, do not allow allow the new mqtt data to trigger a publish (Preferred) Option 2, When a publish is triggered via an updated tag, hold the publish valve for a configurable time say 1 second before allowing any mqtt subscriptions to update the value

robbudge avatar Dec 14 '23 18:12 robbudge