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

Added support for xfinity uei xhk1 ue #1873

Closed

Conversation

dettrick
Copy link
Contributor

@dettrick dettrick commented Dec 7, 2020

No description provided.

key: ['set_status'],
convertSet: async (entity, key, value, meta) => {
const panelStatus = utils.getKeyByValue(common.panStat, value.panelstatus, undefined);
const secondsRemain = value.secondsremain = 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen this syntax before, what does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one set's the indicator LED's and the beeping tones for the keypad. It's different to arm mode which is simply keeps the keypad mode in sync with the server mode but doesn't actually change any indications on the panel

set_status: {
key: ['set_status'],
convertSet: async (entity, key, value, meta) => {
const panelStatus = utils.getKeyByValue(common.panStat, value.panelstatus, undefined);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make everything in value snake case, e.g. panelStatus -> panel_status.

devices.js Show resolved Hide resolved
Koenkk added a commit to Koenkk/zigbee2mqtt that referenced this pull request Dec 8, 2020
@github-actions
Copy link
Contributor

This pull request 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 label Jan 10, 2021
@cjsteward
Copy link

@Koenkk @dettrick Hey guys, is there anything else that needs to be done for this before it can be merged? I'm not a developer, but I've dabbled. If there's anything I can help with to get this merged please let me know. This integration is something I've been looking forward to for a long time now

@github-actions github-actions bot removed the stale label Jan 15, 2021
@Multipage
Copy link
Contributor

Multipage commented Jan 20, 2021

@Koenkk @dettrick When will this be merged? I'm trying to merge this with the dev version of zigbee2mqtt and can't get it to work as it should.
Also : why is there a common.js when there is no common.js in the branch. Am i missing something here?

[EDIT]: As far as i can see the merge is incompatible because of the common.js. Some of the code has moved to /lib/constants.js
Is there some way we can make the changes ( if possible) and then merged asap? Otherwise we must update the code every release and it will never get merged. Kind of useless then.

@dettrick
Copy link
Contributor Author

Ok not sure how to close this one out now. Can someone please help

@dettrick dettrick closed this Jan 20, 2021
@dettrick dettrick deleted the Added-support-for-Xfinity-UEI-XHK1-UE branch January 20, 2021 11:42
@Multipage
Copy link
Contributor

@dettrick I'm sorry to bother you but i have some changes for your code but since i can't get it to work on dev right now because of troubles on my setup(i think) maybe you can take a look at it and get you on track faster?

In devices.js:
await bind(endpoint, coordinatorEndpoint, clusters);
await configureReporting.temperature(endpoint);
await configureReporting.batteryVoltage(endpoint);

Must be:
await reporting.bind(endpoint, coordinatorEndpoint, clusters);
await reporting.temperature(endpoint);
await reporting.batteryVoltage(endpoint);

The changes you made to common.js must now be done in constants.js

The set_status must be ..i think..from:
`
set_status: {
key: ['set_status'],
convertSet: async (entity, key, value, meta) => {
const panelStatus = utils.getKeyByValue(common.panStat, value.panelstatus, undefined);
const secondsRemain = value.secondsremain = 0;
const audibleNotif = value.audiblenotif = 0;
const alarmStatus = value.alarmstatus = 0;

        if (panelStatus === undefined) {
            throw new Error(
                `Unsupported status: '${value.panelstatus}', should be one of: ${Object.values(common.panStat)}`,
            );
        }

        globalStore.putValue(entity, 'panelStatus', panelStatus);
        const payload = {panelstatus: panelStatus, secondsremain: secondsRemain, audiblenotif: audibleNotif, alarmstatus: alarmStatus};
        entity.commandResponse('ssIasAce', 'panelStatusChanged', payload);
    },
},            

to: set_status: {
key: ['set_status'],
convertSet: async (entity, key, value, meta) => {
const panel_status = utils.getKey(constant.panStat, value.panelstatus, undefined);
const seconds_remain = value.secondsremain = 0;
const audible_notif = value.audiblenotif = 0;
const alarm_status = value.alarmstatus = 0;

        if (panelStatus === undefined) {
            throw new Error(
                `Unsupported status: '${value.panelstatus}', should be one of: ${Object.values(constant.panStat)}`,
            );
        }

        globalStore.putValue(entity, 'panelStatus', panel_status);
        const payload = {panelstatus: panel_status, secondsremain: seconds_remain, audiblenotif: audible_notif, alarmstatus: alarm_status};
        entity.commandResponse('ssIasAce', 'panelStatusChanged', payload);
    },
},`

@dettrick
Copy link
Contributor Author

Thanks i've added this to the new PR

@Multipage
Copy link
Contributor

The PR isn't done yet so that's why i will post my findings here. I'll hope you don't mind and i hop it's usefull

Another fix:
const panel_status = utils.getKey(constant.panStat, value.panelstatus, undefined);
must be:
const panel_status = utils.getKey(constant.panStat, value.panelstatus, undefined, Number);

Currently on the last dev version i get this error when i try to set the status through MQTT:
Zigbee2MQTT:error 2021-01-20 13:20:01: Failed to call 'EntityPublish' 'onMQTTMessage' (TypeError: Cannot read property 'key' of undefined
at /app/lib/extension/publish.js:185:56
at Array.find ()
at EntityPublish.onMQTTMessage (/app/lib/extension/publish.js:185:42)
at Controller.callExtensionMethod (/app/lib/controller.js:382:44)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5))
`

I can't figure out what's wrong but maybe you can!

zigbee2mqtt version: current dev
herdsman-converters version 14.0.25

@GSzabados
Copy link

I have look all along what @dettrick has proposed, and I think that the arm_mode and panel_status should have been separated as he suggested. There is a decent overlap between the two, but they are not the same.
The most obvious difference is the invalid_code vs exit_delay. If an exit_delay is sent to the panel with a /zigbee2mqtt/FRIENDLYNAME/set command when a wrong code has been entered the panel will react as it has received ArmNotification as E_CLD_IASACE_ARM_NOTIF_INVALID_ARM_DISARM_CODE according to the ZigBee Cluster Library User Guide, but as the arm_mode was set, then next time when the panel asks for panelStatus the exit_delay will be responded, and the panel will show Exit Delay.

I know there is a bit quirky solution to fix this outside of Z2M as after sending the 'exit_delay' the last arm mode has to be resent as well. But @dettrick's suggested way was providing a full solution for panel status and arm mode.

@thecobra666
Copy link

thecobra666 commented Jun 17, 2021

I have look all along what @dettrick has proposed, and I think that the arm_mode and panel_status should have been separated as he suggested. There is a decent overlap between the two, but they are not the same.
The most obvious difference is the invalid_code vs exit_delay. If an exit_delay is sent to the panel with a /zigbee2mqtt/FRIENDLYNAME/set command when a wrong code has been entered the panel will react as it has received ArmNotification as E_CLD_IASACE_ARM_NOTIF_INVALID_ARM_DISARM_CODE according to the ZigBee Cluster Library User Guide, but as the arm_mode was set, then next time when the panel asks for panelStatus the exit_delay will be responded, and the panel will show Exit Delay.

I know there is a bit quirky solution to fix this outside of Z2M as after sending the 'exit_delay' the last arm mode has to be resent as well. But @dettrick's suggested way was providing a full solution for panel status and arm mode.

Would love for this to be implemented. There is also a difference when the keypad is used with ZHA. In ZHA when pushing one of the zone buttons: the zone selected lights up. So when typing in the code, you know what zone is going to be activated. I don't know how they do it in zha because in the mqtt messages in Z2M I'm unable to get the zone status before the arming code has been typed in.

When I first go to the keypad the following message gets send:

debug 2021-06-16 07:55:15: Received Zigbee message from '0x000d6f0014a6fe0a', type 'commandGetPanelStatus', cluster 'ssIasAce', data '{}' from endpoint 1 with groupID null info 2021-06-16 07:55:15: MQTT publish: topic 'zigbee2mqtt/0x000d6f0014a6fe0a', payload '{"action":null,"action_code":null,"action_zone":null,"battery":100,"battery_low":false,"contact":true,"linkquality":255,"occupancy":true,"presence":null,"tamper":false,"temperature":24,"voltage":7000}'

Then when I have selected the zone and entered the code, this gets send.

debug 2021-06-16 07:55:17: Received Zigbee message from '0x000d6f0014a6fe0a', type 'commandArm', cluster 'ssIasAce', data '{"armmode":3,"code":"9999","zoneid":23}' from endpoint 1 with groupID null info 2021-06-16 07:55:17: MQTT publish: topic 'zigbee2mqtt/0x000d6f0014a6fe0a', payload '{"action":"arm_all_zones","action_code":"9999","action_zone":23,"battery":100,"battery_low":false,"contact":true,"linkquality":255,"occupancy":true,"presence":null,"tamper":false,"temperature":24,"voltage":7000}' info 2021-06-16 07:55:17: MQTT publish: topic 'zigbee2mqtt/0x000d6f0014a6fe0a', payload '{"action":"","action_code":null,"action_zone":null,"battery":100,"battery_low":false,"contact":true,"linkquality":255,"occupancy":true,"presence":null,"tamper":false,"temperature":24,"voltage":7000}' info 2021-06-16 07:55:17: MQTT publish: topic 'zigbee2mqtt/0x000d6f0014a6fe0a/action', payload 'arm_all_zones'

So I wonder how they intercept the zone option. Would anyone know? When sending the the entry or exit_delay mode I'm unable to stop it from beeping. The only way to stop the keypad from beeping is sending a disarm code. That is something I don't want when the keypad is arming.

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.

7 participants