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

Add new device: IKEA SOMRIG E2213 #6574

Merged
merged 15 commits into from
Dec 10, 2023
41 changes: 39 additions & 2 deletions src/devices/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,22 @@ const fzLocal = {
return {action: `dots_${button}_${action}`};
},
} satisfies Fz.Converter,
ikea_dots_click_v2_somrig: {
cluster: 'tradfriButton',
type: ['commandAction1', 'commandAction2', 'commandAction3', 'commandAction4', 'commandAction6'],
convert: (model, msg, publish, options, meta) => {
const button = utils.getFromLookup(msg.endpoint.ID, {1: '1', 2: '2'});
const lookup = {
commandAction1: 'initial_press',
commandAction2: 'long_press',
commandAction3: 'short_release',
commandAction4: 'long_release',
commandAction6: 'double_press',
};
const action = utils.getFromLookup(msg.type, lookup);
return {action: `${button}_${action}`};
},
} satisfies Fz.Converter,
ikea_volume_click: {
cluster: 'genLevelCtrl',
type: 'commandMoveWithOnOff',
Expand Down Expand Up @@ -1220,10 +1236,10 @@ const definitions: Definition[] = [
const endpoint3 = device.getEndpoint(3);
await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff', 'genLevelCtrl', 'genPollCtrl']);
if (endpoint2) {
await reporting.bind(endpoint2, coordinatorEndpoint, ['heimanSpecificScenes']);
await reporting.bind(endpoint2, coordinatorEndpoint, ['tradfriButton']);
}
if (endpoint3) {
await reporting.bind(endpoint3, coordinatorEndpoint, ['heimanSpecificScenes']);
await reporting.bind(endpoint3, coordinatorEndpoint, ['tradfriButton']);
}
await reporting.batteryVoltage(endpoint1);
},
Expand Down Expand Up @@ -1274,6 +1290,27 @@ const definitions: Definition[] = [
await reporting.illuminance(endpoint3);
},
},
{
zigbeeModel: ['SOMRIG shortcut button'],
model: 'E2213',
vendor: 'IKEA',
description: 'SOMRIG shortcut button',
fromZigbee: [fz.battery, fzLocal.ikea_dots_click_v2_somrig],
toZigbee: [tz.battery_percentage_remaining],
exposes: [
e.battery().withAccess(ea.STATE_GET), e.action(['dots_1_initial_press',
'dots_2_initial_press', 'dots_1_long_press', 'dots_2_long_press',
'dots_1_short_release', 'dots_2_short_release', 'dots_1_long_release']),
],
ota: ota.tradfri,
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint1 = device.getEndpoint(1);
const endpoint2 = device.getEndpoint(2);
await reporting.bind(endpoint1, coordinatorEndpoint, ['tradfriButton', 'genPollCtrl']);
await reporting.bind(endpoint2, coordinatorEndpoint, ['tradfriButton']);
await reporting.batteryVoltage(endpoint1);
},
},
{
zigbeeModel: ['PARASOLL Door/Window Sensor'],
model: 'E2013',
Expand Down