Richard Barraclough
Richard Barraclough

Reputation: 2974

How do I get a value from an zigbee2mqtt sensor

Do the sensors just send values whenever they feel like it and I have to be connected to mqtt and listening at the time in order to witness it?

Or can I request the sensor to send a value?

Can I get the last value that was seen (and its timestamp)? (I see I can set retain: true in configuration.yml -- is that all there is?)

I tried

#  mosquitto_pub -t 'zigbee2mqtt/Temp1/get' -m '{"state": ""}'

but it just causes this to appear in the log:

error 2022-01-26 21:50:45: No converter available for 'state' ("")

What does it mean? (The sensor is a TuYa WSD500A.)

Upvotes: 1

Views: 2180

Answers (1)

mikhail kornilov
mikhail kornilov

Reputation: 41

No, you can't query the state of the sensor when you want to. You can only send the calibration commands described in https://smarthomescene.com/reviews/tuya-temperature-humidity-sensor-wsd500a/ But these commands are only for the Zigbee2MQTT module, not for the sensor.

Since this unit is battery powered - it is not listening to the coordinator to receive commands.

The sensor itself wakes up periodically and sends data periodically (I noticed an interval of 5 to 30 minutes), or, as they say, if any parameter changes significantly.

You can also initiate sending of values by pressing a button on the back of the sensor housing.

Upvotes: 3

Related Questions