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

ZIGBEE2MQTT_AVAILABILITY not working #32

Closed
onedr0p opened this issue Aug 24, 2022 · 16 comments
Closed

ZIGBEE2MQTT_AVAILABILITY not working #32

onedr0p opened this issue Aug 24, 2022 · 16 comments
Assignees
Labels
help request Help to use the tool

Comments

@onedr0p
Copy link
Contributor

onedr0p commented Aug 24, 2022

Hi 👋🏼

I deployed this and I can see metrics coming thru but it seems like ZIGBEE2MQTT_AVAILABILITY=True is not working. I actually still see the _state metrics.

# HELP zigbee2mqtt_state metric generated from MQTT message.
# TYPE zigbee2mqtt_state gauge
zigbee2mqtt_state{topic="zigbee2mqtt_Basement - Back Yard - Door Sensor"} 0.0
zigbee2mqtt_state{topic="zigbee2mqtt_Basement - Door Sensor"} 0.0

image

@kpetremann
Copy link
Owner

kpetremann commented Aug 24, 2022

Hi @onedr0p,

Weird, I've just tested and it is working (I've tested for both zigbee2mqtt 1.26.0 and 1.27.0).

I do see the availability metrics:
zigbee2mqtt_zigbee_availability{sensor="zigbee2mqtt_garage"} 1.0

Could you please provide the following info:

  • what version of zigbee2mqtt are you running?
  • please provide the logs using the DEBUG level
  • does it work if you set Availability (simple) in zigbee2mqtt? (personally I am running simple mode, but I tried with advanced and it is still working).

Thanks

@kpetremann kpetremann self-assigned this Aug 24, 2022
@kpetremann kpetremann added the bug Something isn't working label Aug 24, 2022
@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 24, 2022

Env:

LOG_LEVEL: DEBUG
MQTT_ADDRESS: emqx.default.svc.cluster.local
MQTT_TOPIC: "zigbee2mqtt/#"
MQTT_V5_PROTOCOL: "True"
MQTT_USERNAME: username
MQTT_PASSWORD: password
PROMETHEUS_PORT: 80
PROMETHEUS_PREFIX: zigbee2mqtt_
ZIGBEE2MQTT_AVAILABILITY: "True"

Zigbee2mqtt Version: 1.27.0

Logs:

https://pastebin.com/Ca86YUkK

I can try changing to changing to Availability (simple) but like you said it should work...

@kpetremann
Copy link
Owner

Thanks for the details.
At a first glance, there is no "availability" mention in the logs. There should be whether it has failed to convert or succeeded.

I suspect zigbee2mqtt not exporting the availability metric for some reason.

But I'll have a deeper look at the log.

In the meantime, if you can extract the raw value from MQTT it would be nice. Otherwise, I may just add additional logs in the exporter to show them in debug mode.

@kpetremann
Copy link
Owner

@onedr0p unfortunately, I am not able to reproduce your issue.

Could you please run the exporter using this branch https://github.com/kpetremann/mqtt-exporter/tree/debug and provide me the logs.

I have simply added the original MQTT messages in the debug log. But I don't necessarily want to merge this.

@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 26, 2022

Any chance there's a docker image of that?

@kpetremann
Copy link
Owner

kpetremann commented Aug 26, 2022

sure
Actually I've added this MQTT message debug mode as an option.

You'll have to set the following environment variables:

  • LOG_MQTT_MESSAGE="True"
  • LOG_LEVEL=DEBUG

It will be pushed to Docker Hub once this GH Action is complete: https://github.com/kpetremann/mqtt-exporter/actions/runs/2935308892

@kpetremann
Copy link
Owner

The docker image has been pushed to Docker Hub

@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 26, 2022

On the topic of docker images would it be possible to push release tags instead of only latest?

I'll try the debug image out soon.

@kpetremann
Copy link
Owner

On the topic of docker images would it be possible to push release tags instead of only latest?

sure

I'll try the debug image out soon.

Thanks

Also can you confirm that legacy availability payload is disabled? https://www.zigbee2mqtt.io/guide/configuration/device-availability.html#availability-payload

@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 26, 2022

Also can you confirm that legacy availability payload is disabled? zigbee2mqtt.io/guide/configuration/device-availability.html#availability-payload

I set that to false

And what do you know with the latest latest latest version it now works :) I have no idea what happened but you did something! lol

@kpetremann
Copy link
Owner

kpetremann commented Aug 26, 2022

Oh weird ^^ the change I pushed could not have fixed that. Maybe because of a restart either of the exporter or zigbee2mqtt?

Was it already set to false or did you change it recently?

@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 26, 2022

I changed it, maybe that was the fix :)

@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 26, 2022

Thanks for the debugging, I'll go ahead and close the issue!

@onedr0p onedr0p closed this as completed Aug 26, 2022
@kpetremann
Copy link
Owner

oh I see. I confirm this was the root cause for sure.

As stated in the README, legacy mode is not supported.

https://github.com/kpetremann/mqtt-exporter#zigbee2mqtt-device-availability-support
Note: Supports only non-legacy mode - see [Device availability advanced](https://www.zigbee2mqtt.io/guide/configuration/device-availability.html#availability-advanced-configuration)

Don't hesitate if you need further assistance or features.

@kpetremann kpetremann added help request Help to use the tool and removed bug Something isn't working labels Aug 26, 2022
@onedr0p
Copy link
Contributor Author

onedr0p commented Aug 26, 2022

I got confused and thought you mean the other setting which I showed in the screenshot.

@kpetremann
Copy link
Owner

I'll update the readme to make it clearer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help request Help to use the tool
Projects
None yet
Development

No branches or pull requests

2 participants