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

Add new string processor command "add()" to add constant (offset) to the value #600

Conversation

amsterjanis
Copy link

Added new command to string processor "add()" that adds an offset to the value.
Did not find a way to do this with existing commands.

@maxwroc
Copy link
Owner

maxwroc commented Nov 16, 2023

LGTM. I'm curious what is the exact use case for this command?

@maxwroc maxwroc added the enhancement New feature or request label Nov 16, 2023
@amsterjanis
Copy link
Author

I was trying to convert signal strength (dBm) into percentage and the commonly used formula is
percentage = (dBm + 100) * 2
Couldn't figure out how to achieve that existing commands.
Another use case would be to adjust a sensor value that you know to be off, for example a device that reports battery percentage 10% lower than it actually is based on previous experience.

@maxwroc
Copy link
Owner

maxwroc commented Nov 16, 2023

Ok thanks for the examples - sounds reasonable

@maxwroc maxwroc merged commit e58d0af into maxwroc:master Nov 16, 2023
1 check failed
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

Successfully merging this pull request may close these issues.

2 participants