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

Update tuya.ts #6293

Merged
merged 1 commit into from
Oct 16, 2023
Merged

Update tuya.ts #6293

merged 1 commit into from
Oct 16, 2023

Conversation

SeLLeRoNe
Copy link
Contributor

Added TS0601 _TZE200_jkbljri7 presence detector that has a difference manufacturer.

Added TS0601 _TZE200_jkbljri7 presence detector that has a difference manufacturer.
@Koenkk Koenkk merged commit 90913a2 into Koenkk:master Oct 16, 2023
1 check passed
@Koenkk
Copy link
Owner

Koenkk commented Oct 16, 2023

Thanks!

@SeLLeRoNe
Copy link
Contributor Author

Hi @Koenkk , no worries.

I am not sure if I did something wrong but now the occupancy returns Null and I keep seeing popups about legacy mode.

Did I break it?
Those were working before and I'm not sure if they stopped with that change (and I didn't notice, odd but I don't exclude anything) or more recently with another unrelated change this was affected... Or maybe just now the dep was updated and built into z2m.

Is there something I needed to do in the above update for this legacy mode?

Is there any information that could help you help me? :)

Thanks!

@Koenkk
Copy link
Owner

Koenkk commented Nov 30, 2023

I keep seeing popups about legacy mode.

Can you provide a screenshot of those?

@SeLLeRoNe
Copy link
Contributor Author

Hi @Koenkk ,
I was still using the custom external converted code that was part of this merge, removed that custom code it started to work fine, but now the one I did add in the merge results again as not supported:
image

Has maybe the template changed and I need to do some other update/merge request?

I will add back the ext_converter.js file to provide you with a screenshot of that too in soon.

@SeLLeRoNe
Copy link
Contributor Author

SeLLeRoNe commented Dec 1, 2023

image

I've noticed that this only happen when I click to re-configure the device, but at the same time, the occupancy is Null
While if I remove the custom version then that part is working, but the other radar becomes unsupported :)
image

This is my custom 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('TS0601', ['_TZE200_lu01t0zl', '_TZE200_vrfecyku', '_TZE200_ypprdwsl', '_TZE200_jkbljri7']),
        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, legacy.dataPoints.trsfTumbleSwitch, 0);
            await tuya.configureMagicPacket(device, coordinatorEndpoint, logger);
        },
        exposes: [
            e.illuminance_lux(), e.presence(), e.occupancy(),
            e.numeric('motion_speed', ea.STATE).withDescription('Speed of movement'),
            e.enum('motion_direction', ea.STATE, ['standing_still', 'moving_forward', 'moving_backward'])
                .withDescription('direction of movement from the point of view of the radar'),
            e.numeric('radar_sensitivity', ea.STATE_SET).withValueMin(0).withValueMax(10).withValueStep(1)
                .withDescription('Sensitivity of the radar'),
            e.enum('radar_scene', ea.STATE_SET, ['default', 'area', 'toilet', 'bedroom', 'parlour', 'office', 'hotel'])
                .withDescription('Presets for sensitivity for presence and movement'),
            e.enum('tumble_switch', ea.STATE_SET, ['ON', 'OFF']).withDescription('Tumble status switch'),
            e.numeric('fall_sensitivity', ea.STATE_SET).withValueMin(1).withValueMax(10).withValueStep(1)
                .withDescription('Fall sensitivity of the radar'),
            e.numeric('tumble_alarm_time', ea.STATE_SET).withValueMin(1).withValueMax(5).withValueStep(1)
                .withUnit('min').withDescription('Tumble alarm time'),
            e.enum('fall_down_status', ea.STATE, ['none', 'maybe_fall', 'fall'])
                .withDescription('Fall down status'),
            e.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;

@Koenkk
Copy link
Owner

Koenkk commented Dec 2, 2023

_TZE200_jkbljri7 should be supported in z2m 1.34.0

@SeLLeRoNe
Copy link
Contributor Author

I'll install the normal add-on then, I was using the Edge in Home Assistant, odd that the Dev branch doesn't if it is on the release. I'll update once I have tested.
Thanks

@SeLLeRoNe
Copy link
Contributor Author

Confirmed, with the main add-on it's recognized, but the occupancy (which should be a PIR as far as I understood it) returns Null.

So K guess something went wrong in my tests as the others I have are working fine, but this doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants