-
Notifications
You must be signed in to change notification settings - Fork 123
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
First version of mqtt support. #357
Conversation
Adds - ENABLE_MQTT cmake option. Defaults to On but turns off automatically if libmosquitto not found. - basic mqtt client support using libmosquitto - topics generated are: vzlogger/<channel-id>/uuid vzlogger/<channel-id>/raw vzlogger/<channel-id>/agg - added config options for - host - port (currently no tls/sll support!) - user - password - topic (prefix used instead of vzlogger in above example) - (some more, see etc/vzlogger.conf) - agg values get's preferred instead of raw. Using config option rawAndAgg this can be changed.
This should be to get a better understanding of what the channel actually is. E.g. will contains obis ids.
Hi Mathias, Code ist jenseits meiner Fähigkeiten ;) Was ich nich gesehen habe: reconnect wenn mqtt stirbt und wieder kommt bzw. late connect falls mqtt meim Start von vzlogger nicht da? Namenskonvention der Topics? Viele Grüße, Andreas |
@andig reconnect ist dabei: |
Ich hab den Logger gar nicht mehr im Einsatz- Modbus Zähler... |
Hab reconnect Handling beim Startup hinzugefügt. Wenn "con refused" kommt, wird später wieder versucht. |
Wie heissen die Topics? |
s.o. |
This should allow startups where the mqtt server will be available later
I could add the meter name as well into the topic. e.g. vzlogger/mtr1/chn5/... but the channel ids would still be unique. (so e.g. mtr1/ch1, mtr1/ch2, mtr2/ch3,...) |
Wo kommt denn das
Uuid optional? Im use case von @gitka würde es ja gar kein VZ api mehr geben. Ich habe bei meinen Redesigngedankenspielen auch damit gekämpft wie die Hierarchie aus Meter/ Devices/ Meßwerten aussehen soll. Richtig glücklich hat mich am Ende nicht gemacht... |
ist der 5. Channel aus der Cfg. Ich nutze einfach Channel::name(). |
Runs quite good so far. |
when will this be merged into the master branch ? long awaited feature ;) |
@andig ok for you to be merged? |
Yes of course! And prerequisite for #366 |
@mbehr1: |
See here for #308 the first commits for review and discussion.
Seems to work for me.
Topics generated are:
< prefix>/chn/id <- contains the channel identifier (e.g. Obis code)
< prefix>/chn/uuid <- contains the uuid from that channel
< prefix>/chn/[raw|agg] <- contains the last value. either raw or from configured agg mode.
prefix defaults to "vzlogger" and can be overwritten in mqtt object within vzlogger.conf.
For testing I used test.mosquitto.org. Simply update mqtt object inside vzlogger.cfg and e.g. use
mosquitto_sub -h test.mosquitto.org -t "vzlogger/#" -v
and see the data arriving ;-)