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

1.30 breaks Tuya TS0601 _TZE200_lu01t0zl Human presence sensor with fall function #16467

Closed
mescalum opened this issue Feb 1, 2023 · 38 comments
Labels
problem Something isn't working

Comments

@mescalum
Copy link

mescalum commented Feb 1, 2023

What happened?

after upgrading the device presence sensor show as unknown in Homeassistant. After restore everyting works again.

What did you expect to happen?

No response

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

1.30

Adapter firmware version

not sure

Adapter

Slaesh stick

Debug log

No response

@mescalum mescalum added the problem Something isn't working label Feb 1, 2023
@brot123
Copy link

brot123 commented Feb 2, 2023

i have also Problems with 1.30 with my TS601 lu01t0zl, what exactly logs you need about it? The Sensor didnt work ,i could change to 1.30 tomorrow again, i must change before my wife come back, you know:)

@alexebner
Copy link

Same Here with TS0601_TZE200_ztc6ggyl

It logs something like report 0 but only 1,2 allowed.
But only in a short red popup. not ind the logs.
I also have rolled back because my wife is killing me when the light in the bathroom is not working.

@cdemi
Copy link

cdemi commented Feb 2, 2023

I confirm I have this problem as well

@mescalum
Copy link
Author

mescalum commented Feb 3, 2023

@alexebner , I have the Problem with my wife in the dark bathroom too. What makes it worse that Z2M keeps updating itself without any prompts and then issue reoccurs. Happened twice since the first rollback. I have now deactivated the update.

@cdemi
Copy link

cdemi commented Feb 3, 2023

I think Koenkk/zigbee-herdsman-converters/pull/4859 is the cause of this issue

@cdemi
Copy link

cdemi commented Feb 3, 2023

Actually, it looks like problem is not with the hedsman converter, because I see the device reporting Presence and Occupation correctly in Zigbee2MQTT
image

However Home Assistant is treating these as Unknown
image

@mescalum
Copy link
Author

mescalum commented Feb 3, 2023

yes, thanks for illustrating. Same here. Sensors such as moving forward are shown correctly. It is just those two unknown sensors,which are unfortunately the important ones.

@alexebner
Copy link

alexebner commented Feb 4, 2023

Today i have updatet all again and flashed the new firmware on my Sonoff stick but the presence detector does not work.
The Log says:
Exception while calling fromZigbee converter: Value '0' is not allowed, expected one of 1,2}

It looks like the message comes in with zigbee but it is not published to mqtt. There is no topic for presence

homeassistant/sensor/0xcc86ecfffec2c747/fall_down_status/config
homeassistant/sensor/0xcc86ecfffec2c747/fall_sensitivity/config
homeassistant/sensor/0xcc86ecfffec2c747/illuminance_lux/config
homeassistant/sensor/0xcc86ecfffec2c747/linkquality/config
homeassistant/sensor/0xcc86ecfffec2c747/motion_direction/config
homeassistant/sensor/0xcc86ecfffec2c747/motion_speed/config
homeassistant/sensor/0xcc86ecfffec2c747/radar_scene/config
homeassistant/sensor/0xcc86ecfffec2c747/radar_sensitivity/config
homeassistant/sensor/0xcc86ecfffec2c747/static_dwell_alarm/config
homeassistant/sensor/0xcc86ecfffec2c747/tumble_alarm_time/config
homeassistant/sensor/0xcc86ecfffec2c747/tumble_switch/config

@alexebner
Copy link

But this topic reports the sensors.

zigbee2mqtt/PM Küche:
{"fall_down_status":"none","fall_sensitivity":6,"illuminance_lux":32,"linkquality":54,"motion_direction":"standing_still","motion_speed":1,"occupancy":"false","presence":"true","radar_scene":"area","radar_sensitivity":8,"static_dwell_alarm":null,"tumble_alarm_time":2,"tumble_switch":1}

{"fall_down_status":"none","fall_sensitivity":6,"illuminance_lux":32,"linkquality":54,"motion_direction":"standing_still","motion_speed":0,"occupancy":"false","presence":"false","radar_scene":"area","radar_sensitivity":8,"static_dwell_alarm":null,"tumble_alarm_time":2,"tumble_switch":1}

And ther it is reporting as it should.

@alexebner
Copy link

I have found another topic:
homeassistant/binary_sensor/pm_kuche_presence/presence

Now i have changed the automation to MQTT topic Change and it looks like its working.

trigger:

  • platform: mqtt
    topic: homeassistant/binary_sensor/pm_kuche_presence/presence
    payload: '"true"'

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

Koenkk commented Feb 4, 2023

The problem is that true became a string, "true" instead of true, I've pushed a fix, let me know if this works.

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)

@alexebner
Copy link

I am not able to test it because the edge brunsh wont start at my homeasisstant.

When i insert my config and press save then the configuration page does get blank and i am unable to start Z2M.

When i switch back to normal brunsh it works again.

@mescalum
Copy link
Author

mescalum commented Feb 5, 2023

@Koenkk this fixes the issue for Presence which is the important one. Can you do the same trick for Occupancy which still shows as unknown in HA? Thank you very much.

@Koenkk
Copy link
Owner

Koenkk commented Feb 5, 2023

@mescalum it should already be fixed for occupancy, maybe it takes some time before the sensor updates its occupancy? What you can do is stop z2m, remove the device state from data/state.json, start z2m and wait before the sensor updates.

@mescalum
Copy link
Author

mescalum commented Feb 5, 2023

@Koenkk Z2MEdge shows occupancy as null, even after refreshing edge and repairing. I guess that is why HA shows it still as unknown.

@Koenkk
Copy link
Owner

Koenkk commented Feb 5, 2023

@mescalum has the occupancy ever worked before? Maybe it only triggers in very specific situations.

@xistor4
Copy link

xistor4 commented Feb 5, 2023

@mescalum has the occupancy ever worked before? Maybe it only triggers in very specific situations.

The occupancy sensor behaved like a normal motion sensor triggering instantly from motion, where the presence sensor was slow to react but more accurate on continued room presence

@mescalum
Copy link
Author

mescalum commented Feb 5, 2023

@Koenkk it shows value Occupied in z2m v1.29 and prior at least. I think it also shows that in v1.30 but am not going to verify that currently. Our bathroom window openend last time while wife was in shower as humidity was going up and no presence reported, she cried for help as the window is facing the road. usually it opens only a tiny bit when there is presence.

@cdemi
Copy link

cdemi commented Feb 5, 2023

From my end occupancy definitely worked because I have automations setup on that sensor

@robertbigk
Copy link

Is any one can say how to fix that now i all house light not work and i dont know how fix issue

@alexebner
Copy link

@robertbigk
You can add to your automations a second trigger that looks at the mqtt state of the presence detector.

@robertbigk
Copy link

@alexebner Sorry i not much undestood what You mean second trigger?
brave_9bBDNUJVHS
brave_YQqip8k47o

Can You explane me what to do in long version?:)

@alexebner
Copy link

grafik

@alexebner
Copy link

To get all MQTT messages i am using the windows software MQTT.fx

@robertbigk
Copy link

@alexebner
brave_6VKJ3F1Stw
brave_iANvfjmFb2

Sorry I ask, but i miss something? I try that and not work

@xistor4
Copy link

xistor4 commented Feb 6, 2023

For anyone else having issues but also using node-red with home assistant,I was able to get it working fine with the zigbee2mqtt integration with node red

@Koenkk
Copy link
Owner

Koenkk commented Feb 6, 2023

Can anybody else confirm that this issue is fixed in the latest dev? Then I can create a hotfix release. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

@alexebner
Copy link

@robertbigk

You have to search for the MQTT Topic with the name instead of the ID because the Problem is that the ID/presence ist not availabe.

@robertbigk
Copy link

@Koenkk Hi , I got two sensors MIR-HE200-TY. Install Zigbee2MQTT Edge in home assistant and confirm all devices back to life and report state in home assistant.

@Koenkk
Copy link
Owner

Koenkk commented Feb 6, 2023

@robertbigk thanks for confirming, I will do a hotfix release today.

@Koenkk Koenkk closed this as completed Feb 6, 2023
@mescalum
Copy link
Author

mescalum commented Feb 6, 2023

@Koenkk, sorry, am late to respond. For me the presence sensor is fixed in EDGE 1.30.1-dev and my automations work. Thanks for that. However, the occupancy sensor is not. It shows as Null in Z2M GUI and as unknown in HA GUI. I am happy to create a new issue for that. Maybe someone can confirm the descibed behavior? For me it is no longer critical as I dont use occupancy sensor.

@mescalum
Copy link
Author

mescalum commented Feb 6, 2023

I can see briefly a red error message in Z2M GUI when opening the sensor. It says "Exception while calling fromZigbee converter: cannot read properties of undefined (reading 'from')}"

This I cannot find in the Z2M log, unfortunately

@alexebner
Copy link

Same behaviour here
Exception while calling fromZigbee converter: Cannot read properties of undefined (reading 'from')}

And my workarround over the MQTT does not work anymore.

@cdemi
Copy link

cdemi commented Feb 6, 2023

Screenshot_20230206-203726.png

Yes, it looks like occupancy is still Unknown

@xistor4
Copy link

xistor4 commented Feb 7, 2023 via email

@raphaabreu
Copy link

I just updated in hoping of seeing this working again but the occupancy sensor still shows as unkown.

I can see that both values seem to have different types now in mqtt:
DE112EF4-CF0E-46D1-AD5C-D73351C36668

While the entity is configured to match the payload to boolean types instead of strings:

51E6E089-5775-4EB3-B961-E513DDDA1B1C

@raphaabreu
Copy link

Can we reopen this issue? Or should new one be created?

@Koenkk
Copy link
Owner

Koenkk commented Feb 7, 2023

@xistor4 could you provide the debug log of this?

EDIT: Found the issue and fixed it.
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)

For those who don't want to switch to the dev branch:

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('TS0601', ['_TZE200_lu01t0zl', '_TZE200_vrfecyku']),
    model: 'MIR-HE200-TY',
    vendor: 'TuYa',
    description: 'Human presence sensor with fall function',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await tuya.sendDataPointEnum(endpoint, tuya.dataPoints.trsfTumbleSwitch, false);
        await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
    },
    exposes: [
        e.illuminance_lux(), e.presence(), e.occupancy(),
        exposes.numeric('motion_speed', ea.STATE).withDescription('Speed of movement'),
        exposes.enum('motion_direction', ea.STATE, ['standing_still', 'moving_forward', 'moving_backward'])
            .withDescription('direction of movement from the point of view of the radar'),
        exposes.numeric('radar_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1)
            .withDescription('Sensitivity of the radar'),
        exposes.enum('radar_scene', ea.STATE_SET, ['default', 'area', 'toilet', 'bedroom', 'parlour', 'office', 'hotel'])
            .withDescription('Presets for sensitivity for presence and movement'),
        exposes.enum('tumble_switch', ea.STATE_SET, ['ON', 'OFF']).withDescription('Tumble status switch'),
        exposes.numeric('fall_sensitivity', ea.STATE_SET).withValueMin(1).withValueMax(10).withValueStep(1)
            .withDescription('Fall sensitivity of the radar'),
        exposes.numeric('tumble_alarm_time', ea.STATE_SET).withValueMin(1).withValueMax(5).withValueStep(1)
            .withUnit('min').withDescription('Tumble alarm time'),
        exposes.enum('fall_down_status', ea.STATE, ['none', 'maybe_fall', 'fall'])
            .withDescription('Fall down status'),
        exposes.text('static_dwell_alarm', ea.STATE).withDescription('Static dwell alarm'),
    ],
    meta: {
        tuyaDatapoints: [
            [1, 'presence', tuya.valueConverter.trueFalse1],
            [2, 'radar_sensitivity', tuya.valueConverter.raw],
            [102, 'occupancy', tuya.valueConverter.trueFalse2],
            [103, 'illuminance_lux', tuya.valueConverter.raw],
            [105, 'tumble_switch', tuya.valueConverter.plus1],
            [106, 'tumble_alarm_time', tuya.valueConverter.raw],
            [112, 'radar_scene', tuya.valueConverterBasic.lookup(
                {'default': 0, 'area': 1, 'toilet': 2, 'bedroom': 3, 'parlour': 4, 'office': 5, 'hotel': 6})],
            [114, 'motion_direction', tuya.valueConverterBasic.lookup(
                {'standing_still': 0, 'moving_forward': 1, 'moving_backward': 2})],
            [115, 'motion_speed', tuya.valueConverter.raw],
            [116, 'fall_down_status', tuya.valueConverterBasic.lookup({'none': 0, 'maybe_fall': 1, 'fall': 2})],
            [117, 'static_dwell_alarm', tuya.valueConverter.raw],
            [118, 'fall_sensitivity', tuya.valueConverter.raw],
            // Below are ignored
            [101, null, null], // reset_flag_code
            [104, null, null], // detection_flag_code
            [107, null, null], // radar_check_end_code
            [108, null, null], // radar_check_start_code
            [109, null, null], // hw_version_code
            [110, null, null], // sw_version_code
            [111, null, null], // radar_id_code
        ],
    },
};

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

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

8 participants