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
56 changes: 41 additions & 15 deletions src/devices/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,26 @@ const fzLocal = {
} satisfies Fz.Converter,
ikea_dots_click_v2: {
// For remotes with firmware 1.0.32 (20221219)
cluster: 'heimanSpecificScenes',
Copy link
Owner

Choose a reason for hiding this comment

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

I think this doesn't work anymore in the latest dev branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me as well. Must be an error from fetching upstream.

Copy link
Owner

Choose a reason for hiding this comment

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

Try with:

        cluster: 'tradfriButton',
        type: ['commandAction1', 'commandAction2', 'commandAction3', 'commandAction4', 'commandAction6'],

type: 'raw',
convert: (model, msg, publish, options, meta) => {
const button = utils.getFromLookup(msg.endpoint.ID, {2: '1', 3: '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: `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, {2: '1', 3: '2'});
const button = utils.getFromLookup(msg.endpoint.ID, {1: '1', 2: '2'});
const lookup = {
commandAction1: 'initial_press',
commandAction2: 'long_press',
Expand Down Expand Up @@ -597,10 +613,7 @@ const definitions: Definition[] = [
model: 'LED1624G9',
vendor: 'IKEA',
description: 'TRADFRI LED bulb E14/E26/E27 600 lumen, dimmable, color, opal white',
extend: tradfriExtend.light_onoff_brightness_colortemp_color({
disableColorTempStartup: true,
colorTempRange: [153, 500], // light is pure RGB (XY), advertise 2000K-6500K
}),
extend: tradfriExtend.light_onoff_brightness_colortemp_color(),
toZigbee: utils.replaceInArray(
tradfriExtend.light_onoff_brightness_colortemp_color().toZigbee,
[tz.light_color_colortemp],
Expand Down Expand Up @@ -1019,15 +1032,7 @@ const definitions: Definition[] = [
model: 'LED1923R5/LED1925G6',
vendor: 'IKEA',
description: 'TRADFRI LED bulb GU10 345 lumen, dimmable, white spectrum, color spectrum',
extend: tradfriExtend.light_onoff_brightness_colortemp_color({
disableColorTempStartup: true,
colorTempRange: [153, 500],
}),
toZigbee: utils.replaceInArray(
tradfriExtend.light_onoff_brightness_colortemp_color().toZigbee,
[tz.light_color_colortemp],
[tz.light_color_and_colortemp_via_color],
),
extend: tradfriExtend.light_onoff_brightness_colortemp_color({colorTempRange: [250, 454]}),
},
{
zigbeeModel: ['TRADFRI bulb E27 WS globe 1055lm'],
Expand Down Expand Up @@ -1066,7 +1071,7 @@ const definitions: Definition[] = [
extend: tradfriExtend.light_onoff_brightness_colortemp(),
},
{
zigbeeModel: ['TRADFRI_bulb_GU10_WS_345lm', 'TRADFRI bulb GU10 WW 345lm'],
zigbeeModel: ['TRADFRI_bulb_GU10_WS_345lm'],
model: 'LED2106R3',
vendor: 'IKEA',
description: 'TRADFRI LED bulb GU10 345 lumen, dimmable, white spectrum',
Expand Down Expand Up @@ -1274,6 +1279,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