BlackZork / mqmgateway

MQTT gateway for modbus networks
GNU Affero General Public License v3.0
44 stars 20 forks source link

Values are sended over MQTT only when changed #32

Closed MaJEk-0 closed 9 months ago

MaJEk-0 commented 9 months ago

Values are sent over MQTT only when changed. Would it be possible to send data that has not changed?

BlackZork commented 9 months ago

You mean to publish MQTT topic value after every modbus poll?

MaJEk-0 commented 9 months ago

yes, value are publish over MQTT only if are changed.

BlackZork commented 9 months ago

This is by design. Why would you like to publish the same value over and over again?

MaJEk-0 commented 9 months ago

it is not necessary to send every sample, but for example every 10th or 100th. In my project, I measure values that change every pool, but some values change once a day or a week. Here it would be useful for me to send the current status periodically.

pki791 commented 9 months ago

Possibly You should use retain on Your MQTT server, this will allow to see the stored last value. Or switch to modbus4mqtt :)

BlackZork commented 9 months ago

it is not necessary to send every sample, but for example every 10th or 100th. In my project, I measure values that change every pool, but some values change once a day or a week. Here it would be useful for me to send the current status periodically.

Values from modbus devices published by mqmgateway have retain flag set. After your client subscribe to MQTT topic, it should always get current value no matter when it was published.

MaJEk-0 commented 9 months ago

Thanks for the information, it was more about improving MQTT for data with a small period of change..

BlackZork commented 2 months ago

This feature was requested from other users too and I've added it in current master. See #56 for details.