Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added logic to only push mqtt messages when a change is outside of a range #38

Open
mitchell-pioneer opened this issue Jun 18, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@mitchell-pioneer
Copy link
Contributor

I added another change whereby mqtt messages are only sent when the value is outside of a range of values. Currently changes are sent if the two values are not equal. In practice, if the value is .0000001 different it will still send it. I added an upper or lower change by a percentage.

I made these src changes

-CSV file has a new column
-New command line switch
-New logic in modbus_task::modbus_publish

I'm testing it now. Let me know if this is something that you want to commit.

@gavinying
Copy link
Owner

Yeah, that's a nice feature. Also your approach looks good to me.
Here are some points for your consideration,

  1. Backwards compatibility: Current users don't have to modify their existing commands and config files for upgrade
  2. The new code shall allow those additional columns in csv file to be empty if this feature is not required.
  3. Consider adding two columns (low bound / high bound) to make it more generic, which can be used for abnormal detection / alarm use case. Many device vendors provide such register value range in their Modbus documents. I believe it will also cover your use case.

Your contribution is most welcome. Thanks.

@gavinying gavinying added the enhancement New feature or request label Jun 19, 2024
@mitchell-pioneer
Copy link
Contributor Author

Great suggestions.

I am also considering modifying the docker configuration. I'm using Portainer, and it allows you to specify environment variables from inside that tool. I think I should add it in the contributions section as it will break the existing system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants