Voltage values only showing on zigbee2mqtt

I have a bunch of relays with power metering, I use the energy values to monitor consumption using the energy tab, and I can see also these values on the history, but the voltage one I can’t find, neither in the entities list, nor history etc. It only shows inside of zigbee2mqtt inside of each device as shown in the pics:



How can I make it show up in the history, or even being able to see the voltage value inside of the dashboard? I guess I’m missing some entities, but I don’t know how to add them.
Thanks a lot!

On the Zigbee2MQTT web page for your device, first picture you published, click on the ‘State’ tab and see what it shows for the JSON string that Zigbee2MQTT is publishing to MQTT. Unfortunately some devices are not configured in Zigbee2MQTT to publish this data. Two examples I have for the State tab, first one below does publish the voltage, second does not. Some devices do not report the voltage (not your device it looks like). A couple options, you can post a bug/feature request on the Zigbee2MQTT github page, link below. Or if you are adventurous, you can create your own custom ‘External converter’, link below.

Good hunting!

https://www.zigbee2mqtt.io/guide/configuration/more-config-options.html#external-converters

{
    "current": 7.46,
    "last_seen": "2023-09-18T15:59:30-07:00",
    "linkquality": 72,
    "power": 858.2,
    "state": "ON",
    "voltage": 114,
    "elapsed": 5004
}
{
    "energy": 6.73,
    "last_seen": "2023-09-18T16:00:27-07:00",
    "linkquality": 65,
    "power": 7.6,
    "state": "ON",
    "elapsed": 5052
}


Seems mine reports voltage here as expected, why isn’t it showing up on the entities then? Is this part where I have to create this converter to have it as a new entity?

Also weird when I go into MQTT it shows as voltage is available but without any number


Seems that it is reporting correctly, but I can’t access the data outside of here, only power is available

Puzzling.

I’m not sure how you bring Zigbee2MQTT sensors into Home Assistant. I manually create MQTT sensors for all of my Z2M devices. I’m sure there are better ways, however I want full control over what comes into HA and how it is formatted.

I’m not clear on your setup and how you are bringing MQTT date into HA.

I do not think it is part of the problem, however anal me, I don’t like ‘spaces’ in my MQTT topics…

zigbee2mqtt/AC Quarto

Again, OCD/anal me, this is how I bring in a Z2M voltage value from one of my plugs:

  - name: "Hall Dehumidifier Plug Voltage"
    device_class: voltage
    unique_id: "0x282c02bfffeb4c9b-Voltage"
    expire_after: 3600
    state_topic: "zigbee2mqtt/0x282c02bfffeb4c9b"
    value_template: "{{ ( value_json.voltage / 10.0 ) | float(0) }}"
    unit_of_measurement: "V"
    availability_topic: zigbee2mqtt/0x282c02bfffeb4c9b/availability

I would have a close look at the raw MQTT topic and message content. And also how HA sees/consumes this topic and JSON message.

Picture below is what HA developer tools ‘sees’ from above sensor and MQTT JSON message.

topic :
zigbee2mqtt/0x282c02bfffeb4c9b

JSON message :
{"current":11,"elapsed":496,"last_seen":"2023-09-18T18:12:53-07:00","linkquality":91,"power":0.1,"state":"ON","voltage":1207}

Z2M brings in all my devices via MQTT discovery. I believe that is how most people do it, although that is no reflection on the way you do it. In doing so it gets rid of any spaces in the topics.

But a bit of poking around in the MQTT topics may assist.

Oddly, I have a power monitoring plug. State in Z2M shows

{
    "consumption": 0,
    "device_temperature": 33,
    "energy": 0,
    "linkquality": 61,
    "power": 0,
    "power_outage_count": 29,
    "power_outage_memory": true,
    "state": "OFF",
    "voltage": 221
}

However voltage does not show up in HA, and the docs are a bit confusing Xiaomi ZNCZ02LM control via MQTT | Zigbee2MQTT

@honlino could you please advise exactly what device this is (under the “About” TAB in Z2M)


https://www.zigbee2mqtt.io/devices/TS011F_plug_1.html#tuya-ts011f_plug_1
here’s how it’s showing

also here what I have on stats in dev tools

Looks like I found the solution, will try and give feedback.

This didn’t work, voltage still not showing up as a new entity

Edit: after repairing one device it started to show up, thanks :slight_smile: looks like the above is the solution

1 Like