Code Monkey home page Code Monkey logo

Comments (18)

adamcstephens avatar adamcstephens commented on June 12, 2024 1

Yes, that's better. It no longer crashes.

I'll get you a dump of the metrics soon. I want to drop all my retained messages and get a clean capture of the named topics, and I've unfortunately not gotten to that yet.

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024 1

great!! 🎉🎉🎉

To filter out the metrics you don't want, don't hesitate to leverage MQTT_IGNORED_TOPICS option.

I'll merge the branch right away and close this feature request.

Don't hesitate to open issues if you have others feature requests or issues, I'll be happy to help.

Thanks

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024 1

Thank you!

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

hi @adamcstephens,

Sure I can work on that. But I don't have any zWave device. Could you help by providing real life examples so I can work from tests? I can work from the doc you provided, but I would prefer real life examples.

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024

Yep! I'm happy to help however best I can. Here's a dump of topics/values in my environment with the two automatic topic types.

named topics - https://gist.github.com/adamcstephens/4bf4a312cbaec0e3c5abb6a23271eb8d
valueID topics - https://gist.github.com/adamcstephens/9c4e3a144d9734913809b560cb0851da

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024

This is a lot to unpack. An alternative would be to add Home Assistant mqtt discovery support. https://www.home-assistant.io/docs/mqtt/discovery/

zwavejs2mqtt can publish in this format too https://zwave-js.github.io/zwavejs2mqtt/#/usage/setup?id=home-assistant

One benefit of using the Home Assistant format is compatibility with other producers (see list) at the cost of some of losing access to some of raw zwave data. The added compatibility is worth the tradeoff for me and still meets my needs.

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

Thanks for the input data it will help.

I would prefer work on the data source, and not depend on Home-Assistant. While it is a great tool (I use it), there are alternatives and I don't want to prevent people from using this exporter if they don't use HA.

However, this is a good idea. I can work on adding both HA compatibility format, and zwave-js, in dedicated Feature Requests :)

I'll focus here on the zwave-js integration.

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024

I completely agree that this should not depend on HA, I only meant to suggest adding the format support. I actually don't want to use HA, which is one of the reasons I'm interested in this exporter. :)

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

I only meant to suggest adding the format support

yep, we are perfectly aligned ;)

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

can you test with this branch? (It may need improvements)

Don't hesitate to provide the Prometheus metrics it exposes.

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

Actually I have to rethink the integration, to better respect the format. I need to find a way to differentiate named from valueid topics (because I ma targeting supporting only named topics).

I am a little confused as your examples does not show property_key while in the doc it is not marked as optional

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

nevermind, I had a look to ZWavejs2mqtt source code to find answers :)
I've update the branch, please test :)

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024

Gave it a try with my setup and it crashes with the below output. I'm currently on valueid, and will switch to named for this support, but I need to update some automations first. I'll get that done (hopefully this evening) and try again, but I figured a crash is probably undesired anyway.

app_1  | INFO:mqtt-exporter:subscribing to "#"
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_currentTrack_ItemId
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_currentTrack_ParentId
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_enqueuedMetadata_ItemId
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_enqueuedMetadata_ParentId
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_ts
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_volume_Master
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_volume_LF
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_volume_RF
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_mute_Master
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_mute_LF
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_mute_RF
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_bass
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_treble
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_connected
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_state
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_currentvalue
app_1  | INFO:mqtt-exporter:creating prometheus metric: mqtt_targetvalue
app_1  | Traceback (most recent call last):
app_1  |   File "/opt/mqtt-exporter/exporter.py", line 5, in <module>
app_1  |     main()
app_1  |   File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 299, in main
app_1  |     client.loop_forever()
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
app_1  |     rc = self._loop(timeout)
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1164, in _loop
app_1  |     rc = self.loop_read()
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1556, in loop_read
app_1  |     rc = self._packet_read()
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
app_1  |     rc = self._packet_handle()
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
app_1  |     return self._handle_publish()
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
app_1  |     self._handle_on_message(message)
app_1  |   File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
app_1  |     on_message(self, self._userdata, message)
app_1  |   File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 249, in expose_metrics
app_1  |     topic, payload = _parse_message(msg.topic, msg.payload)
app_1  |   File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 213, in _parse_message
app_1  |     topic, payload = _normalize_zwave2mqtt_format(raw_topic, payload)
app_1  |   File "/opt/mqtt-exporter/mqtt_exporter/main.py", line 193, in _normalize_zwave2mqtt_format
app_1  |     payload_dict = {properties.lower(): payload["value"]}
app_1  | KeyError: 'value'

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

totally, it is not supposed to crash but just discard it. Thanks for the output.

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

fix pushed, any better?

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024

zwave data:
https://gist.github.com/adamcstephens/09770a8b731226a752700b1b779458df

exporter data:
https://gist.github.com/adamcstephens/34d885bc67ad7be1c695465029f17080

from mqtt-exporter.

kpetremann avatar kpetremann commented on June 12, 2024

there are tons of metrics, maybe a lot of them are useless. However, it seems the relevant metrics are working, for instance: mqtt_air_temperature{topic="zwave_backroom_multisensor_sensor_multilevel_endpoint_0"} 83.2

What do you think? is there anything missing?

from mqtt-exporter.

adamcstephens avatar adamcstephens commented on June 12, 2024

Yeah, most of these metrics (and the corresponding mqtt messages) aren't useful for me. Some filtering would be nice, but isn't critical.

I'm not seeing anything missing at this time, so this looks good!

from mqtt-exporter.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.