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

Trust ZCTS-808 / ZPIR-8000 #677

Closed
arcsyst opened this issue Dec 9, 2018 · 18 comments
Closed

Trust ZCTS-808 / ZPIR-8000 #677

arcsyst opened this issue Dec 9, 2018 · 18 comments

Comments

@arcsyst
Copy link

arcsyst commented Dec 9, 2018

I'm trying to get the two above devices to work without success. I have an Aqara temp/humidity sensor which works fine. Bothe the trust devices seem to pair correctly but never generate any 'events' when operated. Viewing the log in debug shows:

zigbee2mqtt:debug 2018-12-9 18:50:28 Received zigbee message of type 'devInterview' with data '"0x00158d0001cc9439"'
zigbee2mqtt:debug 2018-12-9 18:50:28 Received zigbee message of type 'devIncoming' with data '"0x00158d0001cc9439"' of device 'VMS_ADUROLIGHT' (0x00158d0001cc9439)
zigbee2mqtt:info 2018-12-9 18:50:28 Device incoming...
zigbee2mqtt:info 2018-12-9 18:50:28 MQTT publish, topic: 'zigbee2mqtt/bridge/log', payload: '{"type":"pairing","message":"device incoming"}'
zigbee2mqtt:debug 2018-12-9 18:50:28 Received zigbee message of type 'devStatus' with data '"online"' of device 'VMS_ADUROLIGHT' (0x00158d0001cc9439)

then nothing.
Any help appreciated.

@Koenkk
Copy link
Owner

Koenkk commented Dec 9, 2018

Can you share the content of your database.db?

@arcsyst
Copy link
Author

arcsyst commented Dec 9, 2018

database.zip

@Koenkk
Copy link
Owner

Koenkk commented Dec 12, 2018

Can you try adding this to devices.js:

    {
        zigbeeModel: ['VMS_ADUROLIGHT'],
        model: 'ZPIR-8000',
        vendor: 'Trust',
        description: 'Motion Sensor',
        supports: 'occupancy',
        fromZigbee: [ ],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const actions = [
                (cb) => device.write('ssIasZone', 'iasCieAddr', coordinator.device.getIeeeAddr(), cb),
                (cb) => device.functional('ssIasZone', 'enrollRsp', {enrollrspcode: 0, zoneid: 23}, cb),
            ];
            execute(device, actions, callback);
        },
    },

@arcsyst
Copy link
Author

arcsyst commented Dec 13, 2018 via email

@ekaats
Copy link

ekaats commented Dec 13, 2018

Awhile ago I've also tried to add this sensor, and am giving it a shot once again.
With Koen's suggestion I am able to connect to it, but I don' t get any meaningful information from the device:

Received zigbee message of type 'statusChange' with data '{"cid":"ssIasZone","zoneStatus":32}' of device 'VMS_ADUROLIGHT' (0x00158d0001cc708f)
No converter available for 'ZPIR-8000' with cid 'ssIasZone', type 'statusChange' and data '{"cid":"ssIasZone","zoneStatus":34}'

If I add gz.generic_occupancy to fromZigbee, I get a ' failed to configure' error from Zigbee2mqtt.

The device does seem to be connected as the LED on the device is periodically flashing. Is there any way to have it send a dump or something?

/Edit

I reckon I should add a function to fromZigbee.js that catches all information, but I am running zigbee2mqtt through the hass.io package. I suppose there are two things I could do:

  1. Create a pull request for hassio-zigbee2mqtt to also sync to/from Ziggbee.js
  2. Create a pull request for ziggbee-shepherd-converters to add a generic 'device'

Option 1 doesn't have my preference since the current solution to edit devices.js is already a bit iffy (could conflict with updates), but Option 2 might not work? I assume the cid and type are set by your suggested fix, would this in theory work with every new device?

@Koenkk
Copy link
Owner

Koenkk commented Dec 14, 2018

Looks good, this should be it:

    {
        zigbeeModel: ['VMS_ADUROLIGHT'],
        model: 'ZPIR-8000',
        vendor: 'Trust',
        description: 'Motion Sensor',
        supports: 'occupancy',
        fromZigbee: [fz.ias_zone_motion_dev_change, fz.ias_zone_motion_status_change],
        toZigbee: [],
        configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const actions = [
                (cb) => device.write('ssIasZone', 'iasCieAddr', coordinator.device.getIeeeAddr(), cb),
                (cb) => device.functional('ssIasZone', 'enrollRsp', {enrollrspcode: 0, zoneid: 23}, cb),
            ];
            execute(device, actions, callback);
        },
    },

Make sure you have the ias_zone_motion_dev_change and ias_zone_motion_status_change in fromZigbee.js (they have been added quite recently: https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/fromZigbee.js#L1019)

@ekaats
Copy link

ekaats commented Dec 14, 2018

Thanks, it seems to call the function, but something is still wrong:

Received zigbee message of type 'statusChange' with data '{"cid":"ssIasZone","zoneStatus":32}' of device 'VMS_ADUROLIGHT' (0x00158d0001cc708f)
/zigbee2mqtt-0.2.0/lib/controller.js:262
                return c.cid === cid && c.type === message.type;
                         ^
TypeError: Cannot read property 'cid' of undefined
    at mappedModel.fromZigbee.filter (/zigbee2mqtt-0.2.0/lib/controller.js:262:26)
    at Array.filter (<anonymous>)
    at Controller.handleZigbeeMessage (/zigbee2mqtt-0.2.0/lib/controller.js:260:51)
    at Zigbee.handleMessage (/zigbee2mqtt-0.2.0/lib/zigbee.js:172:18)
    at emitOne (events.js:116:13)
    at ZShepherd.emit (events.js:211:7)
    at ZShepherd.<anonymous> (/zigbee2mqtt-0.2.0/node_modules/zigbee-shepherd/lib/shepherd.js:138:14)
    at emitMany (events.js:147:13)
    at ZShepherd.emit (events.js:224:7)
    at dispatchIncomingMsg (/zigbee2mqtt-0.2.0/node_modules/zigbee-shepherd/lib/components/af.js:667:45)

Perhaps the cid should be a property of the message instead of a key in the data? I can't find a comparable example in devices.js to copy this from. Also, are those values like the zoneid just placeholders for initial setup?

@arcsyst
Copy link
Author

arcsyst commented Dec 14, 2018 via email

@Koenkk
Copy link
Owner

Koenkk commented Dec 14, 2018

@ekaats please update to the latest dev branch.

@Koenkk
Copy link
Owner

Koenkk commented Dec 14, 2018

@arcsyst how did the no converter available message look like, I think we can reuse https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/fromZigbee.js#L988

@ekaats
Copy link

ekaats commented Dec 14, 2018

Thanks, that seems to do the job.
Now I get information from the sensor:

MQTT publish: topic 'zigbee2mqtt/0x00158d0001cc708f', payload '{"occupancy":true,"tamper":false,"battery_low":false,"linkquality":131}'

occupancy was false before I triggered the sensor, so the sensor relays information just fine. However, the error is also still popping up in the logs:

Failed to configure 0x00158d0001cc708f 0x00158d0001cc708f

@Koenkk
Copy link
Owner

Koenkk commented Dec 14, 2018

The failed to configure happen because the device is probably sleeping (and zigbee2mqtt tries to configure on every startup, you can ignore this).

@arcsyst
Copy link
Author

arcsyst commented Dec 15, 2018

Contact Closed:
zigbee2mqtt:debug 2018-12-15 10:51:30 Received zigbee message of type 'statusChange' with data '{"cid":"ssIasZone","zoneStatus":32}' of device 'CSW_ADUROLIGHT' (0x00158d000202bb30)
'

Contact Opened:
zigbee2mqtt:debug 2018-12-15 10:51:33 Received zigbee message of type 'statusChange' with data '{"cid":"ssIasZone","zoneStatus":33}' of device 'CSW_ADUROLIGHT' (0x00158d000202bb30)

I think we need :
ias_contact_status_change: {
cid: 'ssIasZone',
type: 'statusChange',
convert: (model, msg, publish, options) => {
const zoneStatus = msg.data.zoneStatus;
return {
contact: (zoneStatus & 1) > 0, // Bit 1 = Alarm 2: Presence Indication
};
},
},

I have tried reducing the battery voltage to the point of failure, there doesn't appear to be any change in the status so I guess there's no battery info.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Dec 15, 2018
@Koenkk
Copy link
Owner

Koenkk commented Dec 15, 2018

Can you check if everything work in the latest: https://github.com/Koenkk/zigbee-shepherd-converters ?

@Koenkk
Copy link
Owner

Koenkk commented Dec 15, 2018

Also supported in the dev branch now.

@ekaats
Copy link

ekaats commented Dec 15, 2018

It works perfectly for me. In Home Assistant it is detected as a binary sensor that resets to 'clear' after not detecting movement for about 15 seconds. No mention of any other settings in the manual so I suppose it is fully functional right now. Thanks!

@arcsyst
Copy link
Author

arcsyst commented Dec 16, 2018

Thanks, works for me too, just get:
zigbee2mqtt:error 2018-12-16 13:49:31 Failed to configure Trust_PIR_1 0x00158d0001cc9439
zigbee2mqtt:error 2018-12-16 13:49:36 Failed to configure Trust_Contact_1 0x00158d000202bb30
zigbee2mqtt:error 2018-12-16 13:49:47 Cannot get the Node Descriptor of the Device: 0x00158d0001cc9439 (Error: Timed out after 10000 ms)

But I guess we can ignore these.

@Koenkk
Copy link
Owner

Koenkk commented Dec 16, 2018

Ok, great :)

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

No branches or pull requests

3 participants