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

All Tuya TS110E dimmers broke after update! Cannot update state in all models #16863

Open
chojnicki opened this issue Mar 1, 2023 · 58 comments
Labels
problem Something isn't working

Comments

@chojnicki
Copy link
Sponsor

What happened?

I already reported issue with this dimmer in #16804 but it's not exactly related, that's why I need to make new one. In previous one it was about wrong support for new model/firmware _TZ3210_k1msuvg6. But I already have _TZ3210_zxbtub8r and _TZ3210_wdexaypg (2 gang) that was working before.

While debugging _TZ3210_k1msuvg6 i updated Z2M (not sure what version I had before, but something around month old), and then tried Edge. But while doing this, my old dimmers broke. When I refresh state, it always shows as on, but it's not true. Not only that - it shows on with brightness 0` - or maybe it really starts it with 0, not sure, and why would it do that.

So when I really click to turn on, it starts with brightness 0. What's worse - HA updates it in some period by itself (not sure why, but not important). Because of that, all my light become unusable, because I can't turn them on by automation (they start with brightness 0).

Note that I DO NOT have custom converters. I also tried converter from #16804 shared by @Berlusconi13, and multiple other converters I found in old TS110E issues, but none of them fixes that problem. Of course same situation on both latest and edge version. I tried to tweak converter by myself, but no luck. My guess is that is somewhere deeper in tuya libs.

Since there is no easy way to downgrade addon in HomeAssistant - I'm without lights. My wife will kill me, so pleeease @Koenkk heeelp 🆘

What did you expect to happen?

Correct state update

How to reproduce it (minimal and precise)

Refresh state

Zigbee2MQTT version

1.30.1

Adapter firmware version

0x26680700

Adapter

ConBee2

Debug log

(turned off with max brightness from dashboard)
Info 2023-03-01 18:03:53MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":0,"brightness_1":254,"last_seen":"2023-03-01T17:04:31.057Z","linkquality":95,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"OFF","state_1":"OFF","switch_type":"momentary"}'

(click refresh state)
Debug 2023-03-01 18:03:59Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-01 18:03:59Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-01 18:03:59Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-01 18:03:59MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":0,"brightness_1":254,"last_seen":"2023-03-01T17:04:37.486Z","linkquality":95,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"OFF","switch_type":"momentary"}'

@chojnicki chojnicki added the problem Something isn't working label Mar 1, 2023
@veveme
Copy link

veveme commented Mar 6, 2023

@Koenkk is it possible to fix that ?

@Koenkk
Copy link
Owner

Koenkk commented Mar 6, 2023

@chojnicki it won't fix the issue but I want to understand better what happens. Can you stop z2m, remove the device state from data/state.json start z2m and see if the state_1 and brightness_1 gets added to the published state?

@chojnicki
Copy link
Sponsor Author

chojnicki commented Mar 6, 2023

@Koenkk
No, it's not. But I used converters, so maybe that's it.

_TZ3210_zxbtub8r

Info 2023-03-06 19:54:59MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"last_seen":"2023-03-06T18:54:59.808Z","linkquality":159,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-06 19:55:00Received Zigbee message from 'office_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":254}' from endpoint 1 with groupID null
Info 2023-03-06 19:55:00MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"last_seen":"2023-03-06T18:55:00.637Z","linkquality":159,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-06 19:55:04Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"brightness":""}'
Debug 2023-03-06 19:55:04Publishing get 'get' 'brightness' to 'office_ceiling_lamp'
Debug 2023-03-06 19:55:04Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genLevelCtrl', data '{}' from endpoint 1 with groupID null
Info 2023-03-06 19:55:04MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"last_seen":"2023-03-06T18:55:04.279Z","linkquality":151,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Error 2023-03-06 19:55:04Publish 'get' 'brightness' to 'office_ceiling_lamp' failed: 'Error: Read 0xa4c138321f493293/1 genLevelCtrl(["currentLevel"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'
Info 2023-03-06 19:55:04MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"Publish 'get' 'brightness' to 'office_ceiling_lamp' failed: 'Error: Read 0xa4c138321f493293/1 genLevelCtrl(["currentLevel"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'","meta":{"friendly_name":"office_ceiling_lamp"},"type":"zigbee_publish_error"}'
Debug 2023-03-06 19:55:41Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-06 19:55:41Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-06 19:55:41Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:55:41MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"last_seen":"2023-03-06T18:55:41.646Z","linkquality":151,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-06 19:55:44Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/set' with data '{"state":"OFF"}'
Debug 2023-03-06 19:55:44Publishing 'set' 'state' to 'office_ceiling_lamp'
Info 2023-03-06 19:55:44MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"last_seen":"2023-03-06T18:55:44.419Z","linkquality":151,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-06 19:55:44MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"last_seen":"2023-03-06T18:55:44.419Z","linkquality":151,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"OFF","switch_type":"momentary"}'
Debug 2023-03-06 19:55:45Received Zigbee message from 'office_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":0}' from endpoint 1 with groupID null
Info 2023-03-06 19:55:45MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":0,"last_seen":"2023-03-06T18:55:45.230Z","linkquality":159,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"OFF","switch_type":"momentary"}'
Debug 2023-03-06 19:55:45Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-06 19:55:45Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-06 19:55:45Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:55:45MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":0,"last_seen":"2023-03-06T18:55:45.522Z","linkquality":159,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-06 19:55:49Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-06 19:55:49Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-06 19:55:49Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:55:49MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":0,"last_seen":"2023-03-06T18:55:49.176Z","linkquality":159,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'

_TZ3210_k1msuvg6

Debug 2023-03-06 19:57:27Received Zigbee message from 'living_room_ceiling_lamp', type 'attributeReport', cluster 'genBasic', data '{"65506":54,"65508":0,"appVersion":64}' from endpoint 1 with groupID null
Info 2023-03-06 19:57:27MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":0,"last_seen":"2023-03-06T18:57:27.723Z","linkquality":255,"power_on_behavior":null,"state":"OFF","switch_type":null}'
Debug 2023-03-06 19:58:06Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"brightness":""}'
Debug 2023-03-06 19:58:07Publishing get 'get' 'brightness' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:07Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genLevelCtrl', data '{"currentLevel":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:07MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:07.035Z","linkquality":255,"power_on_behavior":null,"state":"OFF","switch_type":null}'
Debug 2023-03-06 19:58:08Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"brightness":""}'
Debug 2023-03-06 19:58:08Publishing get 'get' 'brightness' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:08Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genLevelCtrl', data '{"currentLevel":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:08MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:08.292Z","linkquality":255,"power_on_behavior":null,"state":"OFF","switch_type":null}'
Debug 2023-03-06 19:58:09Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"min_brightness":""}'
Debug 2023-03-06 19:58:09Publishing get 'get' 'min_brightness' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:09Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genLevelCtrl', data '{"64515":512}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:09MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:09.178Z","linkquality":255,"min_brightness":131,"power_on_behavior":null,"state":"OFF","switch_type":null}'
Debug 2023-03-06 19:58:09Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"min_brightness":""}'
Debug 2023-03-06 19:58:09Publishing get 'get' 'min_brightness' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:09Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genLevelCtrl', data '{"64515":512}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:09MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:09.465Z","linkquality":255,"min_brightness":131,"power_on_behavior":null,"state":"OFF","switch_type":null}'
Debug 2023-03-06 19:58:10Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-06 19:58:10Publishing get 'get' 'state' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:10Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:10MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:10.304Z","linkquality":255,"min_brightness":131,"power_on_behavior":null,"state":"ON","switch_type":null}'
Debug 2023-03-06 19:58:11Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-06 19:58:11Publishing get 'get' 'state' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:11Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:11MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:11.141Z","linkquality":255,"min_brightness":131,"power_on_behavior":null,"state":"ON","switch_type":null}'
Debug 2023-03-06 19:58:29Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-06 19:58:29Publishing get 'get' 'state' to 'living_room_ceiling_lamp'
Debug 2023-03-06 19:58:29Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-06 19:58:29MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":1,"last_seen":"2023-03-06T18:58:29.336Z","linkquality":255,"min_brightness":131,"power_on_behavior":null,"state":"ON","switch_type":null}'

This how both of them looked like just after stop/start. I had to refresh manually every field.

Lights were off, but after refreshing state again state ON with brightness 0.

Screenshot from 2023-03-06 19-53-59

@chojnicki
Copy link
Sponsor Author

@Koenkk I can even give you access to HA with Z2M and live stream to lamp if that will help you 😁

@Koenkk
Copy link
Owner

Koenkk commented Mar 7, 2023

(click refresh state)
Debug 2023-03-01 18:03:59Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-01 18:03:59Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-01 18:03:59Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null

Is {"onOff":1} logged when refreshing and the device is OFF?

@chojnicki
Copy link
Sponsor Author

@Koenkk not sure if I understand correctly, so to be sure I will describe steps and provide logs again.

  1. I turned light on by manually setting brightness to max.
  2. Then turned it off by by clicking OFF on state. So light is for sure OFF.
    Screenshot from 2023-03-07 20-04-39
  3. Then I clicked refresh state, and it's now showing as ON in dashboard.
    Screenshot from 2023-03-07 20-09-27

Logs from this step:

Debug 2023-03-07 20:04:47Received MQTT message on 'zigbee2mqtt/living_room_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-07 20:04:47Publishing get 'get' 'state' to 'living_room_ceiling_lamp'
Debug 2023-03-07 20:04:47Received Zigbee message from 'living_room_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-07 20:04:47MQTT publish: topic 'zigbee2mqtt/living_room_ceiling_lamp', payload '{"brightness":0,"last_seen":"2023-03-07T19:04:47.189Z","linkquality":255,"min_brightness":131,"power_on_behavior":null,"state":"ON","switch_type":null}'

So yes, there is {"onOff":1}

@Koenkk
Copy link
Owner

Koenkk commented Mar 7, 2023

@chojnicki then the device reports the wrong state (1 = ON, 0 = OFF). I cannot do anything about that, it's a bug in the device firmware. This may be caused because we now control this device a little bit differently to workaround other bugs in the fw. Are there any other issues besides refreshing the state?

@chojnicki
Copy link
Sponsor Author

@Koenkk But at least _TZ3210_zxbtub8r was working for months for me with Z2M until updates, and this device does not support OTA to be broken by firmware update 🤔

@Koenkk
Copy link
Owner

Koenkk commented Mar 7, 2023

Could you check if the issue is fixed with the following external converter:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: tuya.fingerprint('TS110E', ['_TZ3210_zxbtub8r', '_TZ3210_k1msuvg6']),
    model: 'TS110E_1gang_1',
    vendor: 'TuYa',
    description: '1 channel dimmer',
    fromZigbee: extend.light_onoff_brightness({disablePowerOnBehavior: true, disableMoveStep: true, disableTransition: true})
        .fromZigbee.concat([tuya.fz.power_on_behavior]),
    toZigbee: extend.light_onoff_brightness({disablePowerOnBehavior: true, disableMoveStep: true, disableTransition: true})
            .toZigbee.concat([tuya.tz.power_on_behavior]),
    exposes: [e.light_brightness()],
    configure: async (device, coordinatorEndpoint, logger) => {
        await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
        await extend.light_onoff_brightness().configure(device, coordinatorEndpoint, logger);
        await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff', 'genLevelCtrl']);
    },
};

module.exports = definition;
  • save this as file next to configuration.yaml as ext_converter.js
  • add it to configuration.yaml:
external_converters:
  - ext_converter.js
  • start z2m, check if issue is fixed

@chojnicki
Copy link
Sponsor Author

Nope, it removed min_brightness and max_brightness so for sure converted is loaded correctly, but refreshing state still gives exact same results.

@chojnicki
Copy link
Sponsor Author

This may be caused because we now control this device a little bit differently to workaround other bugs in the fw. Are there any other issues besides refreshing the state?

I described them in separate issue only for new model #16804.
But now I checked both again, on Edge(dev) version. No previous converter. And results:

_TZ3210_zxbtub8r:

  1. Issue with refreshing state.
  2. Cannot refres brightness Publish 'get' 'brightness' to 'office_ceiling_lamp' failed: 'Error: Read 0xa4c138321f493293/1 genLevelCtrl(["currentLevel"], {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE')'
  3. Turning light off also changes slider with brightness to 0 (which does not happen in any other light device I have in Z2M),

_TZ3210_k1msuvg6:

  1. Issue with refreshing state.
  2. Refreshing brightness changes slider to 1 (but in reality light is still bright).
  3. Turning light off also changes slider with brightness to 0 (which does not happen in any other light device I have in Z2M),
  4. Changing brightness to any value causes decrease -1 after second. So after setting it to 150, it changes by itself to 149.

@Koenkk
Copy link
Owner

Koenkk commented Mar 8, 2023

Can you provide the debug log when doing this with the latest known working version?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable debug logging.

@chojnicki
Copy link
Sponsor Author

I did found way to downgrade Z2M in HA (addon) :/ I found git commands about switching branch, but I think this is for standalone z2m, no idea how to do this for HA addon.

@Koenkk
Copy link
Owner

Koenkk commented Mar 8, 2023

What was the last known working version? I can you provide you an external converter to match the behavior of that version.

@chojnicki
Copy link
Sponsor Author

chojnicki commented Mar 8, 2023

Like I said in first post, I updated Z2M (normal version, not edge) only while debugging new dimmer model, and I'm not sure what version was before, but probably around month old, so maybe 1.29.*.

BUT to be clear, it was working for model _TZ3210_zxbtub8r (at least refreshing state), not _TZ3210_k1msuvg6. I updated Z2M and later switched to edge after I bought _TZ3210_k1msuvg6 that was not working.

@Koenkk
Copy link
Owner

Koenkk commented Mar 9, 2023

@chojnicki this external converter gives the behaviour from 1.28.2:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: [{modelID: 'TS110E', manufacturerName: '_TZ3210_zxbtub8r'}, {modelID: 'TS110E', manufacturerName: '_TZ3210_ngqk6jia'}],
    model: 'TS110E_1gang',
    vendor: 'Lonsonho',
    description: 'Zigbee smart dimmer module 1 gang with neutral',
    extend: extend.light_onoff_brightness(),
};

module.exports = definition;

Can you try if it works with that? If not, since HA doesn't support downgrading, can you setup a separate z2m environment with the working version and provide me the debug logging?

@chojnicki
Copy link
Sponsor Author

@Koenkk still exact same issues :/

Problem is - I have only one zigbee adapter, installed on computer with HA system. I cannot set up separate Z2M :(
I will try again to find a way to downgrade Z2M in HA, but not sure if it's even possible in any way.

@chojnicki
Copy link
Sponsor Author

@Koenkk I forgot that I can just restore HA backup...

Reversed to 1.29.2-1. Tested on _TZ3210_zxbtub8r since I remember that _TZ3210_k1msuvg6 was not working anyway on old version. But on both models refresh state is not bugged anymore :)

Light off, clicking refresh state:

Debug 2023-03-09 18:17:47Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-09 18:17:47Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-09 18:17:47Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-09 18:17:47MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"brightness_1":0,"last_seen":"2023-03-09T17:17:47.915Z","linkquality":255,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"OFF","state_1":"ON","switch_type":"momentary"}'

Click state ON:
Debug 2023-03-09 18:20:16Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/set' with data '{"state":"ON"}'
Debug 2023-03-09 18:20:16Publishing 'set' 'state' to 'office_ceiling_lamp'
Info 2023-03-09 18:20:16MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"brightness_1":0,"last_seen":"2023-03-09T17:20:16.166Z","linkquality":191,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"OFF","state_1":"ON","switch_type":"momentary"}'
Info 2023-03-09 18:20:16MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"brightness_1":0,"last_seen":"2023-03-09T17:20:16.166Z","linkquality":191,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","state_1":"ON","switch_type":"momentary"}'
Debug 2023-03-09 18:20:16Received Zigbee message from 'office_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"currentLevel":254}' from endpoint 1 with groupID null
Info 2023-03-09 18:20:17MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"brightness_1":254,"last_seen":"2023-03-09T17:20:16.971Z","linkquality":199,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","state_1":"ON","switch_type":"momentary"}'

Click refresh state:

Debug 2023-03-09 18:22:26Received MQTT message on 'zigbee2mqtt/office_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-09 18:22:26Publishing get 'get' 'state' to 'office_ceiling_lamp'
Debug 2023-03-09 18:22:27Received Zigbee message from 'office_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-09 18:22:27MQTT publish: topic 'zigbee2mqtt/office_ceiling_lamp', payload '{"brightness":254,"last_seen":"2023-03-09T17:22:27.022Z","linkquality":191,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","state_1":"ON","switch_type":"momentary"}'

@Koenkk
Copy link
Owner

Koenkk commented Mar 11, 2023

@chojnicki I think I understand what happens. In 1.29.2 there was a bug when refreshing state it would update state_1 (which is still incorrect and not used) instead of state. To confirm this, stop z2m remove the device state from data/state.json and refresh again. If state_1 appears this is the diff with 1.30.*.

@chojnicki
Copy link
Sponsor Author

@Koenkk Yes that's correct

@Koenkk
Copy link
Owner

Koenkk commented Mar 12, 2023

I see, so then the issue was also there in 1.29.2 but in 1.29.2 there is another bug which causes the state to be published on the wrong property (state_1 instead of state)

@chojnicki
Copy link
Sponsor Author

chojnicki commented Mar 12, 2023

Hm so I'm confused - what can be done about that? I understand that device firmware sucks, but at the same time on previous Z2M version it's at least usable :)

@Koenkk
Copy link
Owner

Koenkk commented Mar 12, 2023

@chojnicki device provides the wrong state so there is nothing we can do about that. What I can do is to disable the refresh button but this is tricky since I'm not sure this bug applies to all versions of this device. The easiest workaround would be to not click the refresh button

@chojnicki
Copy link
Sponsor Author

@Koenkk problem is it's not just about refreshing in dashboard. Like eexplained previously, device updates state by itself after some time. So I turn light off, it becomes on with brightness 0 in HA by itself, so I cant turn light on again.

@chojnicki
Copy link
Sponsor Author

@Koenkk more logs for you. I checked what's is up with that state reporting, and I see that device does report state correctly after turning light on/off directly in device (pins). Normally I'm not using that, just my own automations, by since device reports changed state, I thing it should do it also while refreshing or any other action?

I'm using new device that as never connected to Z2M/HA, on version 1.29.

Can you find something useful in that?

Light is on, turn it off by pins on device:

Debug 2023-03-12 16:18:12Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
Info 2023-03-12 16:18:12MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:18:12.231Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"OFF","switch_type":"momentary","switch_type_1":"momentary"}'

Now turn it on by pins on device:

2023-03-12 16:18:40Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-12 16:18:40MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:18:40.660Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"ON","switch_type":"momentary","switch_type_1":"momentary"}'

I'm NOT touching dashboard (no refresh state) so device is updating it by itself as it should.

We can see that state_1 changes to real state, so device reports it correctly.

Now tests in dashboard:

Light is on, turn it off by dashboard:

Debug 2023-03-12 16:20:49Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/set' with data '{"state":"OFF"}'
Debug 2023-03-12 16:20:49Publishing 'set' 'state' to 'bedroom_ceiling_lamp'
Info 2023-03-12 16:20:49MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:20:49.896Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"ON","switch_type":"momentary","switch_type_1":"momentary"}'
Info 2023-03-12 16:20:49MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:20:49.896Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"OFF","state_1":"ON","switch_type":"momentary","switch_type_1":"momentary"}'
Debug 2023-03-12 16:20:49Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
Info 2023-03-12 16:20:49MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:20:49.909Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"OFF","state_1":"OFF","switch_type":"momentary","switch_type_1":"momentary"}'

It updated state correctly in dashboard, but let's click refresh state anyway:

Debug 2023-03-12 16:21:41Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-12 16:21:41Publishing get 'get' 'state' to 'bedroom_ceiling_lamp'
Debug 2023-03-12 16:21:41Received Zigbee message from 'bedroom_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
Info 2023-03-12 16:21:41MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:21:41.452Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"OFF","state_1":"OFF","switch_type":"momentary","switch_type_1":"momentary"}'

Turn on in dashboard:

Debug 2023-03-12 16:22:19Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/set' with data '{"state":"ON"}'
Debug 2023-03-12 16:22:19Publishing 'set' 'state' to 'bedroom_ceiling_lamp'
Info 2023-03-12 16:22:19MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:22:19.186Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"OFF","state_1":"OFF","switch_type":"momentary","switch_type_1":"momentary"}'
Info 2023-03-12 16:22:19MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:22:19.186Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"OFF","switch_type":"momentary","switch_type_1":"momentary"}'
Debug 2023-03-12 16:22:19Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-12 16:22:19MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:22:19.198Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"ON","switch_type":"momentary","switch_type_1":"momentary"}'

Refresh:

Debug 2023-03-12 16:22:35Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-12 16:22:35Publishing get 'get' 'state' to 'bedroom_ceiling_lamp'
Debug 2023-03-12 16:22:35Received Zigbee message from 'bedroom_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
Info 2023-03-12 16:22:35MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"brightness_1":254,"last_seen":"2023-03-12T15:22:35.410Z","linkquality":255,"max_brightness":255,"min_brightness":4,"power_on_behavior":"previous","power_on_behavior_1":"previous","state":"ON","state_1":"OFF","switch_type":"momentary","switch_type_1":"momentary"}'

@Koenkk
Copy link
Owner

Koenkk commented Mar 13, 2023

@chojnicki when using z2m 1.30.2 and not using any external converter and clearing the state (stop z2m, remove from data/state.json and start z2m), does the state_1 property appear again?

@chojnicki
Copy link
Sponsor Author

@Koenkk I will make sure later, but if I remember correctly, 95% for no.

@chojnicki
Copy link
Sponsor Author

chojnicki commented Mar 15, 2023

@Koenkk did that, and not there is no state_1 on latest version.
Still issue with state, but not opposite, after refresh it always shows as "OFF".

Removed from state.json, started addon and just waited:

Debug 2023-03-15 16:51:38Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genBasic', data '{"65506":54,"65508":0,"appVersion":64}' from endpoint 1 with groupID null
Info 2023-03-15 16:51:38MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"last_seen":"2023-03-15T15:51:38.569Z","linkquality":111,"power_on_behavior":null,"state":null,"switch_type":null}'

After refreshing everything (while light is off) and then clicking refresh state:

Debug 2023-03-15 16:55:17Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-15 16:55:17Publishing get 'get' 'state' to 'bedroom_ceiling_lamp'
Debug 2023-03-15 16:55:17Received Zigbee message from 'bedroom_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
Info 2023-03-15 16:55:17MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":254,"last_seen":"2023-03-15T15:55:17.746Z","linkquality":95,"max_brightness":196,"min_brightness":132,"power_on_behavior":"previous","state":"OFF","switch_type":"momentary"}'

Light is on, clicked refresh state - dashboard now shows it as off (but it is still on):

Debug 2023-03-15 16:58:49Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/get' with data '{"state":""}'
Debug 2023-03-15 16:58:49Publishing get 'get' 'state' to 'bedroom_ceiling_lamp'
Debug 2023-03-15 16:58:49Received Zigbee message from 'bedroom_ceiling_lamp', type 'readResponse', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID null
Info 2023-03-15 16:58:49MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"last_seen":"2023-03-15T15:58:49.857Z","linkquality":111,"max_brightness":196,"min_brightness":132,"power_on_behavior":"previous","state":"OFF","switch_type":"momentary"}'

Edit: plus bonus logs with that brightness decreasing -1 issue. Maybe related, maybe not...

Debug 2023-03-15 17:07:40Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/set' with data '{"brightness":150}'
Debug 2023-03-15 17:07:40Publishing 'set' 'brightness' to 'bedroom_ceiling_lamp'
Info 2023-03-15 17:07:40MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":219,"last_seen":"2023-03-15T16:07:40.800Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:07:40Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-15 17:07:40MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":219,"last_seen":"2023-03-15T16:07:40.816Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:07:40MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":219,"last_seen":"2023-03-15T16:07:40.841Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:07:40MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":150,"last_seen":"2023-03-15T16:07:40.841Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:07:41Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"61440":589,"currentLevel":150}' from endpoint 1 with groupID null
Info 2023-03-15 17:07:41MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":150,"last_seen":"2023-03-15T16:07:41.670Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:00Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/set' with data '{"brightness":230}'
Debug 2023-03-15 17:08:00Publishing 'set' 'brightness' to 'bedroom_ceiling_lamp'
Info 2023-03-15 17:08:00MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":150,"last_seen":"2023-03-15T16:08:00.059Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:00Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-15 17:08:00MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":150,"last_seen":"2023-03-15T16:08:00.065Z","linkquality":135,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:08:00MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":150,"last_seen":"2023-03-15T16:08:00.119Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:08:00MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":230,"last_seen":"2023-03-15T16:08:00.119Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:00Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"61440":902,"currentLevel":230}' from endpoint 1 with groupID null
Info 2023-03-15 17:08:00MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":229,"last_seen":"2023-03-15T16:08:00.927Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:04Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/set' with data '{"brightness":200}'
Debug 2023-03-15 17:08:04Publishing 'set' 'brightness' to 'bedroom_ceiling_lamp'
Info 2023-03-15 17:08:04MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":229,"last_seen":"2023-03-15T16:08:04.252Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:04Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-15 17:08:04MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":229,"last_seen":"2023-03-15T16:08:04.260Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:08:04MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":229,"last_seen":"2023-03-15T16:08:04.301Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:08:04MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":200,"last_seen":"2023-03-15T16:08:04.301Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:05Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"61440":785,"currentLevel":200}' from endpoint 1 with groupID null
Info 2023-03-15 17:08:05MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":199,"last_seen":"2023-03-15T16:08:05.120Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:07Received MQTT message on 'zigbee2mqtt/bedroom_ceiling_lamp/set' with data '{"brightness":254}'
Debug 2023-03-15 17:08:07Publishing 'set' 'brightness' to 'bedroom_ceiling_lamp'
Info 2023-03-15 17:08:07MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":199,"last_seen":"2023-03-15T16:08:07.284Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:07Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID null
Info 2023-03-15 17:08:07MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":199,"last_seen":"2023-03-15T16:08:07.302Z","linkquality":119,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:08:07MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":199,"last_seen":"2023-03-15T16:08:07.321Z","linkquality":111,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Info 2023-03-15 17:08:07MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":254,"last_seen":"2023-03-15T16:08:07.321Z","linkquality":111,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'
Debug 2023-03-15 17:08:08Received Zigbee message from 'bedroom_ceiling_lamp', type 'attributeReport', cluster 'genLevelCtrl', data '{"61440":997,"currentLevel":254}' from endpoint 1 with groupID null
Info 2023-03-15 17:08:08MQTT publish: topic 'zigbee2mqtt/bedroom_ceiling_lamp', payload '{"brightness":253,"last_seen":"2023-03-15T16:08:08.172Z","linkquality":127,"max_brightness":255,"min_brightness":1,"power_on_behavior":"previous","state":"ON","switch_type":"momentary"}'

@Koenkk
Copy link
Owner

Koenkk commented Mar 20, 2023

@chojnicki this is the same as we already found in #16863 (comment)

Device returns the wrong state when doing a GET. I cannot do anything about that, its a bug in the firmware of the device. The reason why this didn't happend in earlier z2m versions is because a GET would update the state_1 (which is not used and incorrect) instead of state. Are there any issues when never refreshing the state?

@chojnicki
Copy link
Sponsor Author

@Koenkk

Are there any issues when never refreshing the state?

The one with decreasing brightness to -1 by itself.

But about state - it's not only while clicking refresh, device or z2m/hs is updating this by itself. That's why I even noticed this.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Mar 21, 2023
@Koenkk
Copy link
Owner

Koenkk commented Mar 21, 2023

The one with decreasing brightness to -1 by itself.

This one should be fixable, pushed a possible fix.
Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

device or z2m/hs is updating this by itself.

Can you provide the debug log when the device state updates by itself?

@jacekmarek
Copy link

jacekmarek commented Mar 26, 2023

But I already have _TZ3210_zxbtub8r and _TZ3210_wdexaypg (2 gang) that was working before.

Hi @Koenkk
I also have TS110E_2gang_1: _TZ3210_wdexaypg and _TZ3210_3mpwqzuu ( Z2M current version 1.30.2.), both models have a problem with brightness - refresh state.
State of _TZ3210_3mpwqzuu is very strange also:

{
    "brightness_l1": 210,
    "brightness_l2": 251,
    "last_seen": "2023-03-26T18:12:47+02:00",
    "linkquality": 244,
    "max_brightness": 255,
    "min_brightness": 1,
    "state_l1": "OFF",
    "state_l2": "OFF",
    "switch_type_l1": "momentary",
    "switch_type_l2": "momentary",
    "power_on_behavior": "off",
    "min_brightness_l1": 1,
    "max_brightness_l1": 255,
    "power_on_behavior_l1": "off",
    "min_brightness_l2": 1,
    "max_brightness_l2": 255,
    "brightness": 209
}

The light l2 is ON, I set brightness:230 on Endpoint: l2:

debug 2023-03-26 18:22:14Received MQTT message on 'zigbee2mqtt/0xa4c138fe17711517/set' with data '{"brightness_l2":230}'
debug 2023-03-26 18:22:14Publishing 'set' 'brightness' to '0xa4c138fe17711517'
info 2023-03-26 18:22:14MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517', payload '{"brightness":209,"brightness_l1":210,"brightness_l2":251,"last_seen":"2023-03-26T18:22:13+02:00","linkquality":255,"max_brightness":255,"max_brightness_l1":255,"max_brightness_l2":255,"min_brightness":1,"min_brightness_l1":1,"min_brightness_l2":1,"power_on_behavior":"off","power_on_behavior_l1":"off","state_l1":"OFF","state_l2":"ON","switch_type_l1":"momentary","switch_type_l2":"momentary"}'
info 2023-03-26 18:22:14MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517/l1', payload '{"brightness":210,"max_brightness":255,"min_brightness":1,"power_on_behavior":"off","state":"OFF","switch_type":"momentary"}'
info 2023-03-26 18:22:14MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517/l2', payload '{"brightness":251,"max_brightness":255,"min_brightness":1,"state":"ON","switch_type":"momentary"}'
info 2023-03-26 18:22:14MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517', payload '{"brightness":209,"brightness_l1":210,"brightness_l2":251,"last_seen":"2023-03-26T18:22:13+02:00","linkquality":236,"max_brightness":255,"max_brightness_l1":255,"max_brightness_l2":255,"min_brightness":1,"min_brightness_l1":1,"min_brightness_l2":1,"power_on_behavior":"off","power_on_behavior_l1":"off","state_l1":"OFF","state_l2":"ON","switch_type_l1":"momentary","switch_type_l2":"momentary"}'

I check (publish:get) brightness on Endpoint: l2 now:

debug 2023-03-26 18:23:27Received MQTT message on 'zigbee2mqtt/0xa4c138fe17711517/get' with data '{"brightness_l2":""}'
debug 2023-03-26 18:23:27Publishing get 'get' 'brightness' to '0xa4c138fe17711517'
debug 2023-03-26 18:23:27Received Zigbee message from '0xa4c138fe17711517', type 'readResponse', cluster 'genLevelCtrl', data '{"currentLevel":251}' from endpoint 2 with groupID null
info 2023-03-26 18:23:27MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517', payload '{"brightness":229,"brightness_l1":210,"brightness_l2":251,"last_seen":"2023-03-26T18:23:26+02:00","linkquality":255,"max_brightness":255,"max_brightness_l1":255,"max_brightness_l2":255,"min_brightness":1,"min_brightness_l1":1,"min_brightness_l2":1,"power_on_behavior":"off","power_on_behavior_l1":"off","state_l1":"OFF","state_l2":"ON","switch_type_l1":"momentary","switch_type_l2":"momentary"}'
info 2023-03-26 18:23:27MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517/l1', payload '{"brightness":210,"max_brightness":255,"min_brightness":1,"power_on_behavior":"off","state":"OFF","switch_type":"momentary"}'
info 2023-03-26 18:23:27MQTT publish: topic 'zigbee2mqtt/0xa4c138fe17711517/l2', payload '{"brightness":251,"max_brightness":255,"min_brightness":1,"state":"ON","switch_type":"momentary"}'

and got brightness:251, I had previously set brightness:230.

What exactly do mean: min_brightness and max_brightness ? How it's working? I set min- and max_brightness but still can go below min/max treshold with the normal brightness slider in Z2M and HA.

@Koenkk
Copy link
Owner

Koenkk commented Mar 27, 2023

@jacekmarek could you provide the herdsman debug log when setting the brightness?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable the herdsman debug logging. Note that this is only logged to STDOUT and not to log files.

@jacekmarek
Copy link

jacekmarek commented Mar 28, 2023

@Koenkk

herdsman debug log when setting the brightness

In attached file debug.txt

@Koenkk
Copy link
Owner

Koenkk commented Mar 28, 2023

I check (publish:get) brightness on Endpoint: l1 now:

2023-03-28T11:25:09.688Z zigbee-herdsman:deconz:adapter resolve data request with transSeq Nr.: 253
2023-03-28T11:25:09.689Z zigbee-herdsman:controller:log Received 'zcl' data '{"frame":{"Header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":true,"reservedBits":0},"transactionSequenceNumber":253,"manufacturerCode":null,"commandIdentifier":1},"Payload":[{"attrId":0,"status":0,"dataType":32,"attrData":255}],"Command":{"ID":1,"name":"readRsp","parameters":[{"name":"attrId","type":33},{"name":"status","type":32},{"name":"dataType","type":32,"conditions":[{"type":"statusEquals","value":0}]},{"name":"attrData","type":1000,"conditions":[{"type":"statusEquals","value":0}]}]}},"address":53547,"endpoint":1,"linkquality":255,"groupID":null,"wasBroadcast":false,"destinationEndpoint":1}'
Zigbee2MQTT:debug 2023-03-28 13:25:09: Received Zigbee message from '0xa4c13895232f30db', type 'readResponse', cluster 'genLevelCtrl', data '{"currentLevel":255}' from endpoint 1 with groupID null

Similar as what we saw with @chojnicki were it reported the wrong state when doing a GET, yours reports a wrong brightness after doing a GET ('readResponse', cluster 'genLevelCtrl', data '{"currentLevel":255}'). This is an issue in the device firmware which I cannot fix from z2m.

@jacekmarek
Copy link

jacekmarek commented Mar 28, 2023

@Koenkk Thanks for anwser.
Another Tuya devices with wrong firmware :(.
Today is another delivery of equipment, I will check how the new ones work.

image
TS110E_1gang_1 (Zigbee Manufacturer: TZ3210_zxbtub8r)

@jacekmarek
Copy link

jacekmarek commented Apr 16, 2023

When I refresh state on brightness on Z2M dashboard I got message:
UNSUPPORTED_ATTRIBUTE
@jacekmarek in your case the device does not support reading it (UNSUPPORTED_ATTRIBUTE)

Hi @Koenkk
I bought a Tuya gateway to check the operation of these device - TS110E_1gang_1 (Zigbee Manufacturer: TZ3210_zxbtub8r) and everything works fine. I did a test:

  • I paired the module - added device: "OTX ściemniacz 1 obwód Zigbee"
  • I turned on the device from the TuYa application and set the brightness to 10% level.
  • I turned off the Tuya gateway (power off - I disconnected the power)
  • I changed the brightness to 70% using the button
  • I turned off the device with the button
  • I turned on the Tuya gateway (power on - I connected the power)
  • after a few seconds the gateway correctly read the device status, TuYa application show status of device: state = off, brightness = 70%.

This proves that you can read the brightness level correctly from the device, when I try to read from Z2M, I get a message UNSUPPORTED_ATTRIBUTE, why? Where is the problem?

I also did a test with ZHA, also everything works fine, there are no problems as described @chojnicki :
"When I refresh state, it always shows as on, but it's not true. Not only that - it shows on with brightness 0"
"So when I really click to turn on, it starts with brightness 0. What's worse - HA updates it in some period by itself (not sure why, but not important). Because of that, all my light become unusable, because I can't turn them on by automation (they start with brightness 0)."

@Koenkk
Copy link
Owner

Koenkk commented Apr 16, 2023

I also did a test with ZHA, also everything works fine,

That is interesting, do you have any ZHA debug logging so I can see what requests it send?

@jacekmarek
Copy link

jacekmarek commented Apr 17, 2023

That is interesting, do you have any ZHA debug logging so I can see what requests it send?

No, I don't because I did it quickly, I don't use ZHA integration in my HA, I've been using Z2M forever :).
I'll try to collect the logs.

@DivusJulius
Copy link

I have a _TZ3210_3mpwqzuu that also incorrectly reports the state when pressing the refresh button or reading the genOnOff Attribute using the dev console. This is only really a problem because either Home Assistant or Z2M will occassionally refresh the state automatically resulting in an incorrect reported status.
I changed the value of the genOnOff Attribute using the Dev Console to 0 instead of 1. Now the Dimmer always reports the state as being off when it gets refreshed, essentially flipping the problem on its head.

The physical switches, set to toggle, are however always able to correcty switch the lamps on and off regardless of which state they report.

@Koenkk
I had this device setup in ZHA for 1h or so and have not noticed this problem. I then switched to Z2M because ZHA does not support the "Switch Type" setting that I need for this particular device. I'll set it up in ZHA again to see if the same problem exists and to capture some debug logs.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Jun 7, 2023
@jacekmarek
Copy link

The issue still exists.

@github-actions github-actions bot removed the stale Stale issues label Jun 8, 2023
@evangelo18
Copy link

I have 5 of these devices which I recently installed. 4 out of 5 work, however they are extremely slow to respond. Sometimes not at all. 1 of the 5 just refused to respond to any commands.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Jul 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2023
@patapovich
Copy link

@Koenkk Is it possible to reopen this? issue still exists at least for _TZ3210_3mpwqzuu

@Koenkk
Copy link
Owner

Koenkk commented Jan 26, 2024

@patapovich what issues are still present with z2m 1.35.1?

@Koenkk Koenkk reopened this Jan 26, 2024
@patapovich
Copy link

@patapovich what issues are still present with z2m 1.35.1?

Erratic brightness level reports in HA vs. setting, and the biggest issue is the state of L1 and L2 (on vs. off) usually being reported inverted when changed through Home Assistant.

I have a CC2531 stick on the way so that I can sniff the traffic and compare Zigbee2MQTT to the Tuya gateway, but it is still in transit.

@github-actions github-actions bot removed the stale Stale issues label Jan 27, 2024
@Koenkk
Copy link
Owner

Koenkk commented Jan 28, 2024

usually being reported inverted when changed through Home Assistant.

Can you provide the debug log of this?

See this on how to enable debug logging.

@pedroza26
Copy link

Issue still persist.. :(

@satzmann666
Copy link

satzmann666 commented Apr 22, 2024

I am also experiencing some of these issues with my TS110E_2gang_1 (_TZ3210_3mpwqzuu), specifically:

  • On/off state of the HA entities and on the expose tab of Z2M is not updated correctly when changed using switch connected to the module, however the values of "state_l1" and "state_l2" change properly in the state tab.
  • Turning the light off from within HA using the service, or on the expose tab of the device in Z2M also sets brightness to 0.
  • Turning the light on using connected switch then sets the state to on, however the light does not come on, due to brightness being 0.
  • Turning the light on using HA or Z2M expose tab after being turned off the same way and brightness changed to 0 restores previous brightness value.
  • Using dev console to send regular command to endpoint 1 (light1), cluster 6 (genOnOff), id 0 (Off) properly turns off the light and does not change brightness.
  • I also fail to understand what is the purpose of state keys without "_l1"/"_l2" suffix (ie. what is "brightness" for when there is already specific "brightness_l1" and "brightness_l2" for each light).

I will gladly provide any assistance in the form of debug logs if asked, considering that the onOff cluster seems to work properly I think this should be hopefully possible to remedy.

@satzmann666
Copy link

So I have created external converter file by copying code from here but excluded the tzLocal.TS110E_light_onoff_brightness converter and it seems to be working as intended. At least no more brightness changing to 0 when turned off in HA, but I would like to understand better what was the reason for this custom converter in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants