Open schauveau opened 7 months ago
I just tried on a wall switch https://www.zigbee2mqtt.io/devices/WHD02.html and it behaves the same : state: ON
triggers a toggle after 10 times the specified on_time
value.
{
"modelId": "TS0001",
"manufName": "_TZ3000_kycczpw8",
"appVersion": 70,
"stackVersion": 0,
"hwVersion": 1
}
I think that I now understand what is going on.
A lot of manufacturers appear to be using the OnWithTimedOff command as it is currently implemented in Z2M so a ON state that turns to OFF after a delay. That seems to be mostly a Lighting feature to turn off the lights after a delay. This is also used in Matter or z-wave. The arguments are indeed specified as 1/10 seconds.
However, Tuya is (ab)using the same command as a timer/countdown. This is documented for all Tuya standards that support the On/Off cluster in https://developer.tuya.com/en/docs/connect-subdevices-to-gateways/Zigbee_2?id=Kcww7qppbe87m
The links in the page body are all in Chinese but can be changed to English using the 'World' icon at the top of the page (or replace /cn/
by /en/
in the URL).
For example, the Standard for Smart Metering Socket documents the Timer feature as follow:
================================
Direction | Cluster ID | Command/Attribute ID | |
---|---|---|---|
Client to server | 0x0006: On/Off | 0x42: On With Timed Off | Payload |
Server to client | 0x0006: On/Off | 0x4001: OnTime 0x4002: OffWaitTime |
0 to 43200 |
Format of payload: On/off Control: 0x00. On time and Off Wait Time must be set to the same value. Example: To send a command of a local countdown for 60s, the payload contains the following settings:
================================
A few remarks:
OffWaitTime
should be equal to OnTime
. I did not follow that rule in my external converter but it seems to work fine at least for now.0 to 43200
? because 43200s = 12 * 3600s = 12 hours
. The full 16bits range 0-0xFFFF may not be allowed. Some tests are needed. OnTime
and OffWaitTime
that were obviously borrowed from the non-tuya standard behavior. The Standard for Smart Switch is slightly different but the idea remains the same:
Countdown
- The countdown function is implemented with the 0x42 command of
the Zigbee on/off cluster.
- After the countdown command is received, the device starts to count down.
The count value is decreased by 1 every second. The countdown data is
written to the OnTime and OffWaitTime attributes.
- After the count value becomes 0, the bits are reversed and the switch status
and values of OnTime and Off Wait Time are reported to the gateway.
I started a discussion https://github.com/Koenkk/zigbee2mqtt/discussions/22191 about how to improve support for the Tuya on-off cluster.
Hi @schauveau how were you able to update these? I've got a bunch of the _TZ3000_cehuw1lw plugs and I'm stuck on appversion 112 and z2m just won't see an update for them. They report amperage incorrectly, and won't report kWh at all.
Thanks in advance!
I only have one TZ3000_cehuw1lw
that I bought about one month ago (on Amazon, not AliExpress) with another tuya plug and and energy meter. Those were my first zigbee devices and if I remember well, I was able to apply an OTA update to two of them (probably the two plugs since the energy meter does not support OTA).
I do not know the versions numbers before the OTA update but what I have now is
"modelId": "TS011F",
"manufacturerName": "_TZ3000_cehuw1lw",
"zclVersion": 3,
"appVersion": 192,
"stackVersion": 0,
"hwVersion": 1,
Did you try to reset the device? Also, the hw version may be different which could explain why you do not have any update.
I think you're right, it does indeed seem to be a different hardware revision!
"modelId":"TS011F",
"manufacturerName":"_TZ3000_cehuw1lw",
"zclVersion":3,
"appVersion":112,
"stackVersion":2,
"hwVersion":0
Was the update available in Z2M for you or did you use a tuya hub? Ordered a Tuya hub just in case, and currently reading into supporting devices to see if I can fix it myself. Although I don't think that would really be possible considering it's the same model number as working devices, but a different firmware version.
Tried resetting the plugs, didn't seem to have an effect unfortunately.
The update was in Z2M. I do not really know how OTA updates work for Tuya. Nothing is listed in https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/lib/ota/OTA_URLs.md so I assume that this is using a Tuya web api.
I assume that you already tried to tune the reporting setting. For the kWh of my TZ3000_cehuw1lw
, the relevant reporting is currently seMettering / currentSumDelivered / 5 / 60 / empty (so probably 0)
which is probably the default.
Anyways, having both bad values for current (and probably power I suppose) and no kWh reporting probably means that the device is broken. I just have to hope than mine with a newer hwVersion will be more resilient. Humm... cheap Chinese devices ... When did you buy it?
As a side note, I have two new similar plugs _TZ3000_fukaa7nc
that are currently at appVersion 78. I pressed the 'check for new update" button yesterday and now they show a possible OTA update. One has hwVersion 1 while the other does not show any hwVersion (?!!!). So the hwVersion my not be required after all. I am currently starting the update.
If it goes to appVersion 192 then that could mean that all TS011F plugs share the same firmware.
If you are not afraid to brick your device then you could try to change its identifier in database.db to another value such as _TZ3000_fukaa7nc
and see if it works.
After a bit of digging, I found the source for the firmware : https://github.com/Koenkk/zigbee-OTA/blob/2fddaba1bedbe007e777bd775451cc4343690e7e/index.json#L1636
As you can see, there is a single version 192 for all TS011F. The important values are "manufacturerCode": 4417, "imageType": 54179, "modelId": "TS011F"
They have to match the values expected by the device:
check for new updates
zhc:ota
Here is what I get for my device:
[2024-04-29 08:43:57] debug: zhc:ota:common: Checking if an update is available for '0xa4c138137f39a0ed' (TS011F)
[2024-04-29 08:43:57] debug: zhc:ota:common: Using endpoint '1'
[2024-04-29 08:43:57] debug: zhc:ota:common: Got request '{"fieldControl":0,"manufacturerCode":4417,"imageType":54179,"fileVersion":192}'
[2024-04-29 08:43:57] debug: zhc:ota:common: Is new image available for '0xa4c138137f39a0ed' (TS011F), current '{"fieldControl":0,"manufacturerCode":4417,"imageType":54179,"fileVersion":192}'
[2024-04-29 08:43:57] debug: zhc:ota: Getting image metadata for 'TS011F'
[2024-04-29 08:43:58] debug: zhc:ota: Downloaded main index
[2024-04-29 08:43:58] debug: zhc:ota:common: Is new image available for '0xa4c138137f39a0ed' (TS011F), latest meta '{"fileVersion":192,"fileSize":307682,"url":"https://images.tuyaeu.com/smart/firmware/upgrade/20220907/1662545193-oem_zg_tl8258_plug_OTA_3.0.0.bin","sha512":"01939ca4fc790432d2c233e19b2440c1e0248d2ce85c9299e0b88928cb2341de675350ac7b78187a25f06a2768f93db0a17c4ba950b60c82c072e0c0833cfcfb"}'
[2024-04-29 08:43:58] debug: zhc:ota:common: Update available for '0xa4c138137f39a0ed' (TS011F): NO
The 1st line tells me that the modelId is TS011F
. The 3rd line gives and manufacturerCode and imageType required by the device and fileVersion is the current firmware.
Thank you very much for your replies! I'll give all of your suggestions a go as soon as I've got some time after assignments.
After a bit of digging, I found the source for the firmware : https://github.com/Koenkk/zigbee-OTA/blob/2fddaba1bedbe007e777bd775451cc4343690e7e/index.json#L1636
As you can see, there is a single version 192 for all TS011F. The important values are
"manufacturerCode": 4417, "imageType": 54179, "modelId": "TS011F"
They have to match the values expected by the device:
- Set the log level to debug
- in the OTA web interface, press the button
check for new updates
- filter or grep the log for
zhc:ota
- Do not forget to restore the log level
Here is what I get for my device:
[2024-04-29 08:43:57] debug: zhc:ota:common: Checking if an update is available for '0xa4c138137f39a0ed' (TS011F) [2024-04-29 08:43:57] debug: zhc:ota:common: Using endpoint '1' [2024-04-29 08:43:57] debug: zhc:ota:common: Got request '{"fieldControl":0,"manufacturerCode":4417,"imageType":54179,"fileVersion":192}' [2024-04-29 08:43:57] debug: zhc:ota:common: Is new image available for '0xa4c138137f39a0ed' (TS011F), current '{"fieldControl":0,"manufacturerCode":4417,"imageType":54179,"fileVersion":192}' [2024-04-29 08:43:57] debug: zhc:ota: Getting image metadata for 'TS011F' [2024-04-29 08:43:58] debug: zhc:ota: Downloaded main index [2024-04-29 08:43:58] debug: zhc:ota:common: Is new image available for '0xa4c138137f39a0ed' (TS011F), latest meta '{"fileVersion":192,"fileSize":307682,"url":"https://images.tuyaeu.com/smart/firmware/upgrade/20220907/1662545193-oem_zg_tl8258_plug_OTA_3.0.0.bin","sha512":"01939ca4fc790432d2c233e19b2440c1e0248d2ce85c9299e0b88928cb2341de675350ac7b78187a25f06a2768f93db0a17c4ba950b60c82c072e0c0833cfcfb"}' [2024-04-29 08:43:58] debug: zhc:ota:common: Update available for '0xa4c138137f39a0ed' (TS011F): NO
The 1st line tells me that the modelId is
TS011F
. The 3rd line gives and manufacturerCode and imageType required by the device and fileVersion is the current firmware.
This is what I get for an update check:
Info 2024-05-01 22:17:32Checking if update available for '0xa4c13806a55864d9'
Warning 2024-05-01 22:17:32Images currently unavailable for device 'TS011F', hardwareVersion '0', manufacturerName _TZ3000_cehuw1lw, {"fieldControl":0,"manufacturerCode":4107,"imageType":517,"fileVersion":268514823}'
Info 2024-05-01 22:17:32No update available for '0xa4c13806a55864d9'
I bought the plugs about 2 weeks ago. I've also tried changing the identifier in the database.db but it keeps changing back on every boot if z2m and the update checks for the old identifier. The confusing part is that they do seem to report kWh, but reported as a list with "0,measurement" where measurement is the amount (we presume). But it doesn't show up in the UI, only in the logs. UI just keeps saying NULL or N/A. I've tried the seMettering setting but it doesn't seem to ever populate
Managed to use the custom ota index option to force it to see the update, but i unfortunately get "update failed, manufacturer code mismatch", guess that would have been too easy :D
So your device needs a firmware with imageType 517 (0x0205) instead of 54179 (0xD3A3).
The imageType is also stored at offset 12 in the firmware file in little-endian format (a3 d3) .
# hexdump -C 1662545193-oem_zg_tl8258_plug_OTA_3.0.0.bin.1 | head -n 2
00000000 1e f1 ee 0b 00 01 38 00 00 00 41 11 a3 d3 c0 00 |......8...A.....|
00000010 00 00 02 00 54 65 6c 69 6e 6b 20 4f 54 41 20 53 |....Telink OTA S|
You could try to change the a3 d3
to 05 02
but this is probably a bad idea. That could brick the device.
The fact that the kwh is reported as "0,measurement" is probably good news. That means that writing an external converter should not be that difficult.
Also the TS011F plug already has 3 converters TS011F_plug_1, TS011F_plug_2 and TS011F_plug_3
so it could well be that one of them works for your device.
TS011F_plug_3
is the most likely candidate since TS011F_plug_2
is without power monitoring.
Try adding 112 to the list of known applicationVersion https://github.com/Koenkk/zigbee-herdsman-converters/blob/37bac5b3536c127866c9544d0f77423f9129b066/src/devices/tuya.ts#L4270
You may also want to add it here if the kwh are not properly reported: https://github.com/Koenkk/zigbee-herdsman-converters/blob/37bac5b3536c127866c9544d0f77423f9129b066/src/devices/tuya.ts#L4294
PS: For testing, the file you need to edit is .../zigbee2mqtt/node_modules/zigbee-herdsman-converters/devices/tuya.js
Just tried my luck by changing both the image type and manufacturer ID in the firmware.bin, but I get "device did not request any image blocks" so I presume either OTA isn't properly implemented on the version I have or it's doing a firmware check. I'll try my luck with a custom converter! I've been playing around with them but I haven't really figured it out yet
TS011F_plug_3
is the most likely candidate sinceTS011F_plug_2
is without power monitoring.Try adding 112 to the list of known applicationVersion https://github.com/Koenkk/zigbee-herdsman-converters/blob/37bac5b3536c127866c9544d0f77423f9129b066/src/devices/tuya.ts#L4270
You may also want to add it here if the kwh are not properly reported: https://github.com/Koenkk/zigbee-herdsman-converters/blob/37bac5b3536c127866c9544d0f77423f9129b066/src/devices/tuya.ts#L4294
PS: For testing, the file you need to edit is
.../zigbee2mqtt/node_modules/zigbee-herdsman-converters/devices/tuya.js
This worked! It is now reporting amperage properly, and I'm currently running a load on it to see if it is reporting total kWh as well (via polling).
Seriously, thank you SO much for your help! I will see if I can merge this in a PR for this specific model (if it's appropriate)
Edit: IT WORKS! It now correctly reports kWh usage! I'll read through the docs a bit more after assignments and then I'll see if I can make/adapt the converter, whatever needs to be done! Thank you so much, this was an extreme motivation for me to start contributing! :D
Make sure that your PR does NOT add _TZ3000_cehuw1lw
in the condition for TS011F_plug_3
since that would break my device.
Yep, I was thinking of adding only the firmware version, basically exactly what you've told me to do. These are the UK plugs at my partners house, my EU plugs in my place are the same firmware version, but a slightly different model, but those report fine. Don't want to break mine either :D
I have finally found a difference between my UK and EU plugs. They are both on the same appversion, but have different swbuildIDs. The UK ones are
"swBuildId":"1.0.5\u0000"
and the EU plugs are on:
"swBuildId":"0122052017"
Given that, I think it would be more prudent to determine the fingerprint for the converter by swBuildID instead of appversion, given that they have the same app version, but different Builds, and behave differently
I do not know enough about fingerprints to help you. This is probably something you should discuss in your PR.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days
TS011F, _TZ3000_w0qqde0g Zigbee2MQTT version 1.41.0 Coordinator type EZSP v13 Coordinator revision 7.4.4.0 build 0
Parameters are not read correctly: "sw_version":"500+TZSKT21Z3102" "voltage":null "current":null "energy":null
info 2024-11-22 23:17:55z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0x70b3d52b6011539b', payload '{"last_seen":"2024-11-22T23:17:55+03:00","linkquality":216,"update":{"installed_version":-1,"latest_version":-1}}'
info 2024-11-22 23:17:55zh:controller: Interview for '0x70b3d52b6011539b' started
info 2024-11-22 23:17:55z2m: Device '0x70b3d52b6011539b' joined
info 2024-11-22 23:17:56z2m: Starting interview of '0x70b3d52b6011539b'
info 2024-11-22 23:17:56z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x70b3d52b6011539b","ieee_address":"0x70b3d52b6011539b"},"type":"device_joined"}'
info 2024-11-22 23:17:56z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x70b3d52b6011539b","ieee_address":"0x70b3d52b6011539b","status":"started"},"type":"device_interview"}'
info 2024-11-22 23:17:56zh:controller: Succesfully interviewed '0x70b3d52b6011539b'
info 2024-11-22 23:17:56z2m: Successfully interviewed '0x70b3d52b6011539b', device has successfully been paired
info 2024-11-22 23:17:56z2m: Device '0x70b3d52b6011539b' is supported, identified as: Tuya Smart plug (with power monitoring by polling) (TS011F_plug_3)
info 2024-11-22 23:17:56z2m: Configuring '0x70b3d52b6011539b'
info 2024-11-22 23:17:56z2m:mqtt: MQTT publish: topic 'homeassistant/switch/0x70b3d52b6011539b/switch/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt/0x70b3d52b6011539b/set","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"name":null,"object_id":"0x70b3d52b6011539b","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"payload_off":"OFF","payload_on":"ON","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_switch_zigbee2mqtt","value_template":"{{ value_json.state }}"}'
info 2024-11-22 23:17:56z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":{"description":"Smart plug (with power monitoring by polling)","exposes":[{"features":[{"access":7,"description":"On/off state of the switch","label":"State","name":"state","property":"state","type":"binary","value_off":"OFF","value_on":"ON","value_toggle":"TOGGLE"}],"type":"switch"},{"access":7,"description":"Recover state after power outage","label":"Power outage memory","name":"power_outage_memory","property":"power_outage_memory","type":"enum","values":["on","off","restore"]},{"access":7,"description":"LED indicator mode","label":"Indicator mode","name":"indicator_mode","property":"indicator_mode","type":"enum","values":["off","off/on","on/off","on"]},{"access":1,"category":"diagnostic","description":"Instantaneous measured power","label":"Power","name":"power","property":"power","type":"numeric","unit":"W"},{"access":1,"category":"diagnostic","description":"Instantaneous measured electrical current","label":"Current","name":"current","property":"current","type":"numeric","unit":"A"},{"access":1,"category":"diagnostic","description":"Measured electrical potential value","label":"Voltage","name":"voltage","property":"voltage","type":"numeric","unit":"V"},{"access":1,"description":"Sum of consumed energy","label":"Energy","name":"energy","property":"energy","type":"numeric","unit":"kWh"},{"features":[{"access":3,"description":"Enables/disables physical input on the device","label":"State","name":"state","property":"child_lock","type":"binary","value_off":"UNLOCK","value_on":"LOCK"}],"label":"Child lock","type":"lock"},{"access":1,"category":"diagnostic","description":"Link quality (signal strength)","label":"Linkquality","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"TS011F_plug_3","options":[{"access":2,"description":"This device does not support reporting electric measurements so it is polled instead. The default poll interval is 60 seconds, set to -1 to disable.","label":"Measurement poll interval","name":"measurement_poll_interval","property":"measurement_poll_interval","type":"numeric","value_min":-1},{"access":2,"description":"Calibrates the power value (percentual offset), takes into effect on next report of device.","label":"Power calibration","name":"power_calibration","property":"power_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for power, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Power precision","name":"power_precision","property":"power_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the current value (percentual offset), takes into effect on next report of device.","label":"Current calibration","name":"current_calibration","property":"current_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for current, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Current precision","name":"current_precision","property":"current_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the voltage value (percentual offset), takes into effect on next report of device.","label":"Voltage calibration","name":"voltage_calibration","property":"voltage_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for voltage, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Voltage precision","name":"voltage_precision","property":"voltage_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"Calibrates the energy value (percentual offset), takes into effect on next report of device.","label":"Energy calibration","name":"energy_calibration","property":"energy_calibration","type":"numeric"},{"access":2,"description":"Number of digits after decimal point for energy, takes into effect on next report of device. This option can only decrease the precision, not increase it.","label":"Energy precision","name":"energy_precision","property":"energy_precision","type":"numeric","value_max":3,"value_min":0},{"access":2,"description":"State actions will also be published as 'action' when true (default false).","label":"State action","name":"state_action","property":"state_action","type":"binary","value_off":false,"value_on":true}],"supports_ota":true,"vendor":"Tuya"},"friendly_name":"0x70b3d52b6011539b","ieee_address":"0x70b3d52b6011539b","status":"successful","supported":true},"type":"device_interview"}'
info 2024-11-22 23:17:56z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/power_outage_memory/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:power-settings","name":"Power outage memory","object_id":"0x70b3d52b6011539b_power_outage_memory","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_power_outage_memory_zigbee2mqtt","value_template":"{{ value_json.power_outage_memory }}"}'
info 2024-11-22 23:17:56z2m:mqtt: MQTT publish: topic 'homeassistant/select/0x70b3d52b6011539b/power_outage_memory/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt/0x70b3d52b6011539b/set/power_outage_memory","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"enabled_by_default":true,"entity_category":"config","icon":"mdi:power-settings","name":"Power outage memory","object_id":"0x70b3d52b6011539b_power_outage_memory","options":["on","off","restore"],"origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_power_outage_memory_zigbee2mqtt","value_template":"{{ value_json.power_outage_memory }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/indicator_mode/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"enabled_by_default":false,"name":"Indicator mode","object_id":"0x70b3d52b6011539b_indicator_mode","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_indicator_mode_zigbee2mqtt","value_template":"{{ value_json.indicator_mode }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0x70b3d52b6011539b', payload '{"last_seen":"2024-11-22T23:17:57+03:00","linkquality":220,"power_outage_memory":null,"state":null,"update":{"installed_version":-1,"latest_version":-1}}'
info 2024-11-22 23:17:57z2m: Successfully configured '0x70b3d52b6011539b'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/select/0x70b3d52b6011539b/indicator_mode/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt/0x70b3d52b6011539b/set/indicator_mode","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"enabled_by_default":true,"name":"Indicator mode","object_id":"0x70b3d52b6011539b_indicator_mode","options":["off","off/on","on/off","on"],"origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_indicator_mode_zigbee2mqtt","value_template":"{{ value_json.indicator_mode }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/power/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"power","enabled_by_default":true,"entity_category":"diagnostic","object_id":"0x70b3d52b6011539b_power","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_power_zigbee2mqtt","unit_of_measurement":"W","value_template":"{{ value_json.power }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/current/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"current","enabled_by_default":false,"entity_category":"diagnostic","object_id":"0x70b3d52b6011539b_current","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_current_zigbee2mqtt","unit_of_measurement":"A","value_template":"{{ value_json.current }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/voltage/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"voltage","enabled_by_default":false,"entity_category":"diagnostic","object_id":"0x70b3d52b6011539b_voltage","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_voltage_zigbee2mqtt","unit_of_measurement":"V","value_template":"{{ value_json.voltage }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/energy/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"energy","enabled_by_default":true,"object_id":"0x70b3d52b6011539b_energy","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_class":"total_increasing","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_energy_zigbee2mqtt","unit_of_measurement":"kWh","value_template":"{{ value_json.energy }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/lock/0x70b3d52b6011539b/child_lock/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt/0x70b3d52b6011539b/set/child_lock","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"name":"Child lock","object_id":"0x70b3d52b6011539b_child_lock","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"payload_lock":"LOCK","payload_unlock":"UNLOCK","state_locked":"LOCK","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","state_unlocked":"UNLOCK","unique_id":"0x70b3d52b6011539b_child_lock_zigbee2mqtt","value_template":"{{ value_json.child_lock }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/linkquality/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","name":"Linkquality","object_id":"0x70b3d52b6011539b_linkquality","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_linkquality_zigbee2mqtt","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/last_seen/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"timestamp","enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:clock","name":"Last seen","object_id":"0x70b3d52b6011539b_last_seen","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_last_seen_zigbee2mqtt","value_template":"{{ value_json.last_seen }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0x70b3d52b6011539b', payload '{"child_lock":null,"current":null,"energy":null,"indicator_mode":null,"last_seen":"2024-11-22T23:17:57+03:00","linkquality":220,"power":null,"power_outage_memory":null,"state":null,"update":{"installed_version":-1,"latest_version":-1},"voltage":null}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/sensor/0x70b3d52b6011539b/update_state/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:update","name":"Update state","object_id":"0x70b3d52b6011539b_update_state","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_update_state_zigbee2mqtt","value_template":"{{ value_json['update']['state'] }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/binary_sensor/0x70b3d52b6011539b/update_available/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"update","enabled_by_default":false,"entity_category":"diagnostic","name":null,"object_id":"0x70b3d52b6011539b_update_available","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"payload_off":false,"payload_on":true,"state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_update_available_zigbee2mqtt","value_template":"{{ value_json['update']['state'] == \"available\" }}"}'
info 2024-11-22 23:17:57z2m:mqtt: MQTT publish: topic 'homeassistant/update/0x70b3d52b6011539b/update/config', payload '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0x70b3d52b6011539b/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt/bridge/request/device/ota_update/update","device":{"identifiers":["zigbee2mqtt_0x70b3d52b6011539b"],"manufacturer":"Tuya","model":"Smart plug (with power monitoring by polling) (TS011F_plug_3)","name":"0x70b3d52b6011539b","sw_version":"500+TZSKT21Z3102","via_device":"zigbee2mqtt_bridge_0xe0798dfffe718922"},"device_class":"firmware","entity_category":"config","entity_picture":"https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png","json_attributes_template":"{\"in_progress\": {{ iif(value_json['update']['state'] == 'updating', 'true', 'false') }} }","json_attributes_topic":"zigbee2mqtt/0x70b3d52b6011539b","latest_version_template":"{{ value_json['update']['latest_version'] }}","latest_version_topic":"zigbee2mqtt/0x70b3d52b6011539b","name":null,"object_id":"0x70b3d52b6011539b","origin":{"name":"Zigbee2MQTT","sw":"1.41.0","url":"https://www.zigbee2mqtt.io"},"payload_install":"{\"id\": \"0x70b3d52b6011539b\"}","state_topic":"zigbee2mqtt/0x70b3d52b6011539b","unique_id":"0x70b3d52b6011539b_update_zigbee2mqtt","value_template":"{{ value_json['update']['installed_version'] }}"}'
info 2024-11-22 23:18:03z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0x70b3d52b6011539b', payload '{"child_lock":null,"current":null,"energy":null,"indicator_mode":null,"last_seen":"2024-11-22T23:18:03+03:00","linkquality":220,"power":null,"power_outage_memory":null,"state":"OFF","update":{"installed_version":-1,"latest_version":-1,"state":null},"update_available":null,"voltage":null}'
What happened?
I recently bought two plugs
_TZ3000_cehuw1lw
and_TZ3000_w0qqde0g
from two different vendors on AliExpress. They are recognized asTS011F_plug_1
and both haveappVersion:192
after an OTA update.I tested the On with timed off currently described as follow in the documentation
At first that did not seem to work but I noticed that the plug was turning on and off unexpectedly.
I eventually figured out that the behavior is a lot simpler than the one described in the documentation.
Doing
/set { "state": "on" , "on_time": 15}
toggles the state after 150 seconds so 10 times the specified amount. This is a real toggle so bothON --> OFF
andOFF --> ON
are possible. Also, a pending toggle can be cancelled by setting the state.This implementation of the 'onWithTimedOff` tuya request expects a delay in seconds. The scaling by 10 is caused by the current implementation in https://github.com/Koenkk/zigbee-herdsman-converters/blob/7727e110580a38c913cbd30f8c00ada394b0ad54/src/converters/toZigbee.ts#L45
As a proof of concept, I created a new command
toggle_wait_cmd
in an external converter derived from the currentTS011F_plug_1
. For example,/set { "toggle_wait_cmd" : 34 }
will toggle the state after 34 second (and so is equivalent to/set { "state" : "ON" , "on_time": 3.4 }
)I believe that this is related to the OTA update (appVersion 192 ?) but I have no other plug to compare.
What did you expect to happen?
No response
How to reproduce it (minimal and precise)
No response
Zigbee2MQTT version
1.36.1 commit: ffc2ff1d
Adapter firmware version
-
Adapter
-
Setup
-
Debug log
No response