-
Notifications
You must be signed in to change notification settings - Fork 26
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
btmon MQTT #8
Comments
Issue matthewwall#8 requested support for timestamps in the values sent to MQTT. This checkin adds support for Plaintext and JSON style encodings of the measurement timestamp data. Add support for Current values if the underlying system supports it. Signed-off-by: Mark Clark <[email protected]> (github: mrguessed)
I made a prototype of some of the changes, it's in the The code defaults to using the existing single-value payload format, and can be reconfigured for both plain-text and json style as needed. See the examples inside the code for more details.
This code will now follow the
Please file a separate ticket to track. Not sure when I'll get to that one, as it'll require a bunch of changes to be made for row-oriented format.
If your device supports it, then it can be used. Looks like only the GEM devices support it in their format. You'd need to check with Brultech to see if there's an equivalent for ECM-1240 models. That said, I've added support to MQTT output so it'll send this over if the data is there & it's been enabled.
In MQTT, it's never clear where this stuff is expected to go. There are certain conventions like Graphite's plaintext format, where they'll encode it. These rely upon you being able to peel apart the values at the other end. I've prototyped the addition of a See the doc in Once it's gone through some functional review, I'll submit a PR to @matthewwall for inclusion. Over time, I'd like to add per-measurement level metadata, and I plan to use this mechanism to do it (for JSON-encoded values) eg. |
Thanks for your updates. I am running on your update now and will continue testing over the coming days. Obfuscate is working now. Current shows if I use the -p option and it is included in the data transmitted by the ECM-1240, but it isn't showing up in the MQTT data. |
With the current feature enabled in
If the ECM-1240 has the values, I'm not sure why they wouldn't appear in the stream. |
I can see the current variables are allocated in the DB_SCHEMA's, but unfortunately I don't understand Python. I assume Matthew will know. Regardless, MQTT out is working great and even without current it is a great addition to btmon. |
@tgmaxx, In either case, you you mind including a copy of your -p output? My guess is that it's due to a missing I think it should look like the following (similar to
My code relies upon the filters to extract what I deliver to MQTT. |
@mrguessed, Anyway, here is a screen capture of your updated btmon startup and one packet using the -p option: |
Thx. I pushed a new version of my prototype that includes the support for current on both ECM-1220 and ECM-1240 units. Please try it out and let me know. For now I bundled it with my prototype, but I may break it out as a separate PR so it can be reviewed/included without the rest of my MQTT changes (as my changes may not be correct) Ref: Current support added in a4e4b12 |
Thanks Mark. I will check it out tomorrow and let you know how it goes. |
I am running your new version and getting current now. Thanks! |
Good stuff. I'll file a separate PR in a few days to cover fixing that part. |
@mrguessed, Thanks, Tom |
I am using btmon 3.2.0 with IP in and MQTT out and it is working, but I have a few issues/comments:
I have OBFUSCATE_SERIALS = 1, but the serial is not Obfuscated. I believe it works for OEM output. I can Obfuscate the serial with MQTT mapping, but that's just a workaround.
It would be useful if there was an option for all ECM-1240 data in one payload.
I set INCLUDE_CURRENT = 1, assuming the current would be output, but I saw in the comments it is only for GEM?
I noticed a timestamp is not included in MQTT out, even if upload period is set to sampling time. Can it be added?
Thanks.
The text was updated successfully, but these errors were encountered: