Unexpected issue Zigbee2MQTT hardware

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Unexpected issue Zigbee2MQTT hardware

Post by Jan Jansen »

Version: 2023.2
Build Hash: 19efd039c
Compile Date: 2023-07-21 17:23:44
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110]
Raspberrypi 3B
Bullseye

Several months ago (I don't know exactly how many) I made a prototype of a multi purpose zigbee device (CC2530 + CC2591 with some outputs, 1 input and a MFRC522 linked to UART). For inspiration see https://gio-dot.github.io/Z1-Mini/zigbe ... tag-reader.
The prototype worked excellently (using MQTT Auto Discovery Client Gateway with LAN). For each unique tag, a unique switch was created in Domoticz. The outputs and the input also worked as expected.
This week I wanted to use the prototype in my production system. After pairing, the outputs and the input appeared to work as expected. The creation of the unique switches after reading the various TAGs did not work anymore.
Is this a deliberate change or an error that has arisen over time?

Domoticz log

Code: Select all

 2023-08-17 18:52:52.512 Status: Zigbee2mqtt: connected to: localhost:1883
2023-08-17 18:52:53.022 Status: Zigbee2mqtt: discovered: Schuur/Schuur click (unique_id: 0x00124b00043a2953_click_zigbee2mqtt)
2023-08-17 18:52:53.127 Status: Zigbee2mqtt: discovered: Schuur/Schuur l2 (unique_id: 0x00124b00043a2953_switch_l2_zigbee2mqtt)
2023-08-17 18:52:53.241 Status: Zigbee2mqtt: discovered: Schuur/Schuur l3 (unique_id: 0x00124b00043a2953_switch_l3_zigbee2mqtt)
2023-08-17 18:52:53.353 Status: Zigbee2mqtt: discovered: Schuur/Schuur l4 (unique_id: 0x00124b00043a2953_switch_l4_zigbee2mqtt)
2023-08-17 18:52:53.465 Status: Zigbee2mqtt: discovered: Schuur/Schuur l5 (unique_id: 0x00124b00043a2953_switch_l5_zigbee2mqtt)
2023-08-17 18:52:53.577 Status: Zigbee2mqtt: discovered: Schuur/Schuur l6 (unique_id: 0x00124b00043a2953_switch_l6_zigbee2mqtt)
2023-08-17 18:52:53.688 Status: Zigbee2mqtt: discovered: Schuur/Schuur l7 (unique_id: 0x00124b00043a2953_switch_l7_zigbee2mqtt) 
After reading a TAG there is no response in Domoticz log

Zigbee2mqtt log after reading TAG

Code: Select all

info 2023-08-17 19:32:07MQTT publish: topic 'zigbee2mqtt/Schuur', payload '{"action":" 55 22 56 BE","click":null,"linkquality":36,"state_l2":"ON","state_l3":"OFF","state_l4":"OFF","state_l5":"OFF","state_l6":"OFF","state_l7":"OFF"}'
info 2023-08-17 19:32:07MQTT publish: topic 'zigbee2mqtt/Schuur', payload '{"action":"","click":null,"linkquality":36,"state_l2":"ON","state_l3":"OFF","state_l4":"OFF","state_l5":"OFF","state_l6":"OFF","state_l7":"OFF"}'
info 2023-08-17 19:32:07MQTT publish: topic 'zigbee2mqtt/Schuur/action', payload ' 55 22 56 BE'
Hopefully this problem can be solved. Thanks in advance for a reply.

Regards,
Jan
User avatar
gizmocuz
Posts: 2406
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by gizmocuz »

1. After pairing, the outputs and the input appeared to work as expected.
2. The creation of the unique switches after reading the various TAGs did not work anymore.


Not sure what you mean with '1' ... devices are created in Domoticz correctly?
If yes, what do you mean with '2' ?

Did you create a tag reader?

Please post the config topic + payload for '2'
Quality outlives Quantity!
User avatar
waltervl
Posts: 5502
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by waltervl »

Did you check the device list in menu Setup - Devices?
If they are present there, are they activated (blue arrow icon)? If not activate them.
If they are activated but not visible in the switches tab please go to menu Setup - Users and clear the assigned device list for the admin user you are using (most likely "admin").
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by Jan Jansen »

gizmocuz wrote: Friday 18 August 2023 13:05
Did you create a tag reader?

Please post the config topic + payload for '2'
I created a Tag reader (MFRC522 > Nano > UART PTVO).

Code: Select all

{"automation_type":"trigger","device":{"identifiers":["zigbee2mqtt_0x00124b00043a2953"],"manufacturer":"Custom devices (DiY)","model":"[Multi-channel relay switch](https://ptvo.info/zigbee-switch-configurable-firmware-router-199/) (ptvo.switch)","name":"Schuur","sw_version":"2023-08-10"},"payload":"  8A 43 EA 0E","subtype":"  8A 43 EA 0E","topic":"zigbee2mqtt/Schuur/action","type":"action"}
Is this what you mean?

Thanks in advance.

Jan
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by Jan Jansen »

waltervl wrote: Friday 18 August 2023 14:21 Did you check the device list in menu Setup - Devices?
The expected switches cannot be found in the device list.

Thanks for your quick reply

Jan
User avatar
gizmocuz
Posts: 2406
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by gizmocuz »

Unfraternally this is not what i mean.
If you login with MQTT Explorer, you should see a node with the auto discovery topic name (probably homeassistant), underneath this you see sub topics like lights,sensors,cover,binary_sensor etc...
Try to find your tag reader or tags
Then there should be a topic with 'config', this is the information I am looking for
Quality outlives Quantity!
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by Jan Jansen »

Retry!
Click.png
Click.png (67.37 KiB) Viewed 1256 times

Code: Select all

{"automation_type":"trigger","device":{"identifiers":["zigbee2mqtt_0x00124b00043a2953"],"manufacturer":"Custom devices (DiY)","model":"[Multi-channel relay switch](https://ptvo.info/zigbee-switch-configurable-firmware-router-199/) (ptvo.switch)","name":"Schuur","sw_version":"2023-08-10"},"payload":"  89 B2 E6 6E","subtype":"  89 B2 E6 6E","topic":"zigbee2mqtt/Schuur/action","type":"action"}
I hope this information is sufficient.
User avatar
gizmocuz
Posts: 2406
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by gizmocuz »

Yep, thanks, could you also post the payload of 'zigbee2mqtt/Schuur/action'

Could you also answer the questions from my first reply above?

Don't you get switches for each tag? Or binary_sensors?

Reason for this is that type 'device_automation' was never supported
Quality outlives Quantity!
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by Jan Jansen »

Zigbee2mqtt payload

Code: Select all

info 2023-08-21 12:31:08MQTT publish: topic 'zigbee2mqtt/Schuur', payload '{"action":" 89 B2 E6 6E","click":null,"linkquality":13,"state_l2":"ON","state_l3":"OFF","state_l4":"OFF","state_l5":"OFF","state_l6":"OFF","state_l7":"OFF"}'
info 2023-08-21 12:31:08MQTT publish: topic 'zigbee2mqtt/Schuur', payload '{"action":"","click":null,"linkquality":13,"state_l2":"ON","state_l3":"OFF","state_l4":"OFF","state_l5":"OFF","state_l6":"OFF","state_l7":"OFF"}'
info 2023-08-21 12:31:08MQTT publish: topic 'zigbee2mqtt/Schuur/action', payload ' 89 B2 E6 6E'
The following config may also be of interest.
click 2.png
click 2.png (48.97 KiB) Viewed 1241 times

Code: Select all

{"availability":[{"topic":"zigbee2mqtt/bridge/state"}],"device":{"identifiers":["zigbee2mqtt_0x00124b00043a2953"],"manufacturer":"Custom devices (DiY)","model":"[Multi-channel relay switch](https://ptvo.info/zigbee-switch-configurable-firmware-router-199/) (ptvo.switch)","name":"Schuur","sw_version":"2023-08-10"},"icon":"mdi:toggle-switch","json_attributes_topic":"zigbee2mqtt/Schuur","name":"Schuur click","state_topic":"zigbee2mqtt/Schuur","unique_id":"0x00124b00043a2953_click_zigbee2mqtt","value_template":"{{ value_json.click }}"}
Answers:
1. The following switches were created automatically. Input is linked to l2 (see start topic)
schakelaars.png
schakelaars.png (28.74 KiB) Viewed 1241 times
2. I hope to have answered question 2 through my (previous) answers.

Don't you get switches for each tag? Or binary_sensors? Answer is no

You said: Reason for this is that type 'device_automation' was never supported.
But a few months ago it worked, for each separate TAG its own switch was created.
User avatar
gizmocuz
Posts: 2406
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by gizmocuz »

Okey, but even 'if' it was supported back then (by looking in the code), you also need a 'state_topic' and I do not see that in here.
It is also strange to see the payload beginning with a space character...
Who is generating this all?

Another thing, we never had to support the device_automation because there was 'always' a switch or binary_sensor object to use

And if you look at the original project web page:

https://gio-dot.github.io/Z1-Mini/zigbe ... tag-reader

You will see that the output is

Code: Select all

binary_sensor:  
  - platform: mqtt
    name: "Z1 Wiegand"
    payload_on: "4710313" # readed code
    payload_off: ""
    state_topic: "zigbee2mqtt/0x00124b0022609cd1/action" # topic where code is sent
    expire_after: 1 # After 1s code is cleared
So why is yours not? This is also 100% what I expect it to be!
Quality outlives Quantity!
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Unexpected issue Zigbee2MQTT hardware

Post by Jan Jansen »

Then the problem may be caused by the Arduino code. I was unable to adapt the code (https://gio-dot.github.io/Z1-Mini/zigbe ... tag-reader) to the MFRC522. Finally, I used the following code.

Code: Select all

//Programa : RFID - Toegangscontrole RFID
//Autor : 
 
#include <SPI.h>
#include <MFRC522.h>
 
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
 
char st[20];

void setup() 
{
  Serial.begin(9600);   // Initialiseer seriële communicatie
  SPI.begin();      // Initialiseer  SPI bus
  mfrc522.PCD_Init();   // Initialiseer MFRC522
}
 
void loop() 
{
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial())
  {
    return;
  }
  // Toon UID tag
  Serial.print("");
  String inhoud= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     inhoud.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  {
    delay(2000); // waits for 2 seconds
  }
}
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Unexpected issue Zigbee2MQTT hardware [SOLVED]

Post by Jan Jansen »

Partly by using Nodered I have a working PTVO module. Gizmocuz, thank you very much for your help

Features: 1 input for a door contact, 1 output for a buzzer, 2 outputs for a LED, 2 outputs for a relay and 1 RFID reader

The Arduino code shown above has been changed.

A text sensor has been created in Domoticz. The UID of a TAG is shown in this text sensor. The following Nodered flow is used for this.

Code: Select all

[
    {
        "id": "2b474de86feda6be",
        "type": "tab",
        "label": "Schuur",
        "disabled": false,
        "info": ""
    },
    {
        "id": "aa605a8d8fc10ec6",
        "type": "mqtt in",
        "z": "2b474de86feda6be",
        "name": "PTVO schuur",
        "topic": "zigbee2mqtt/Schuur/action",
        "qos": "2",
        "datatype": "utf8",
        "broker": "fbb02111.25ba88",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 190,
        "y": 220,
        "wires": [
            [
                "2a9fb2c7d1e7b77a"
            ]
        ]
    },
    {
        "id": "2a9fb2c7d1e7b77a",
        "type": "function",
        "z": "2b474de86feda6be",
        "name": "",
        "func": "msg.payload = {\"command\" : \"udevice\", \"idx\": 16, \"svalue\": msg.payload};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 220,
        "wires": [
            [
                "76470ee270218ab8",
                "49673a19ca4d471a"
            ]
        ]
    },
    {
        "id": "76470ee270218ab8",
        "type": "mqtt out",
        "z": "2b474de86feda6be",
        "name": "Domoticz In",
        "topic": "domoticz/in",
        "qos": "",
        "retain": "",
        "broker": "fbb02111.25ba88",
        "x": 570,
        "y": 220,
        "wires": []
    },
    {
        "id": "49673a19ca4d471a",
        "type": "debug",
        "z": "2b474de86feda6be",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 680,
        "y": 320,
        "wires": []
    },
    {
        "id": "fbb02111.25ba88",
        "type": "mqtt-broker",
        "name": "MQTT",
        "broker": "127.0.0.1",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests