-
Notifications
You must be signed in to change notification settings - Fork 69
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
Parse more value types #9
Conversation
Hello, |
Ye, this was my quick attempt to make it work for myself, and I opened this PR to get the ball rolling here. I think we can safely map JSON For strings, here's one example config to map string values to floats: - prom_name: zb_state
mqtt_name: state
help: Discrete level state of the sensor
type: gauge
string_value_mapping:
default: 1
map:
off: 0
low: 0
false: 0 |
Hey, |
Yep
Sounds good. There is another thing to consider: as there is no standard on what values each sensor attribute can have, there should be a way in the config to specify filters that limits which mqtt topics the rules apply to, either based on the topic name via a regex, or based on attributes. Here is an example: - prom_name: zb_state
mqtt_name: state
sensor_name: ".*brand_a.*"
... We can look at this in another PR though. |
* Parse bools as 0 for false and 1 for true * Allow mapping between string and float values
I pushed a fresh change with config changes. |
LGTM. Thank you for your contribution! |
Released in v0.0.6 |
Various sensors have string attributes such as "state" which are still
useful to track as metrics. For example, state may be "on" or "off".
These can be showen as 1 and 0 and be used to trigger alerts.