From f72c9ef1d1cf82c206816ca35b6d70ac551ec984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnoud=20Th=C3=B6rig?= <39429596+noud-github@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:07:08 +0100 Subject: [PATCH] IKEA SOMRIG Shortcut Button support (#7511) --- button_maps.json | 21 +++++ devices/ikea/somrig_shortcut_button.json | 100 +++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 devices/ikea/somrig_shortcut_button.json diff --git a/button_maps.json b/button_maps.json index cbeda9f204..30cb388fa8 100644 --- a/button_maps.json +++ b/button_maps.json @@ -338,6 +338,27 @@ [1, "0x03", "FC80", "COMMAND_6", "0", "S_BUTTON_7", "S_BUTTON_ACTION_DOUBLE_PRESS", "0x06"] ] }, + "ikeaSomrigMap": { + "vendor": "IKEA of Sweden", + "doc": "IKEA SOMRIG Shortcut Button", + "modelids": ["SOMRIG shortcut button"], + "buttons": [ + {"S_BUTTON_1": "One Dot"}, + {"S_BUTTON_2": "Two Dots"} + ], + "map": [ + [1, "0x01", "FC80", "COMMAND_1", "0", "S_BUTTON_1", "S_BUTTON_ACTION_INITIAL_PRESS", "0x01"], + [1, "0x01", "FC80", "COMMAND_2", "0", "S_BUTTON_1", "S_BUTTON_ACTION_HOLD", "0x02"], + [1, "0x01", "FC80", "COMMAND_3", "0", "S_BUTTON_1", "S_BUTTON_ACTION_SHORT_RELEASED", "0x03"], + [1, "0x01", "FC80", "COMMAND_4", "0", "S_BUTTON_1", "S_BUTTON_ACTION_LONG_RELEASED", "0x04"], + [1, "0x01", "FC80", "COMMAND_6", "0", "S_BUTTON_1", "S_BUTTON_ACTION_DOUBLE_PRESS", "0x06"], + [1, "0x02", "FC80", "COMMAND_1", "0", "S_BUTTON_2", "S_BUTTON_ACTION_INITIAL_PRESS", "0x01"], + [1, "0x02", "FC80", "COMMAND_2", "0", "S_BUTTON_2", "S_BUTTON_ACTION_HOLD", "0x02"], + [1, "0x02", "FC80", "COMMAND_3", "0", "S_BUTTON_2", "S_BUTTON_ACTION_SHORT_RELEASED", "0x03"], + [1, "0x02", "FC80", "COMMAND_4", "0", "S_BUTTON_2", "S_BUTTON_ACTION_LONG_RELEASED", "0x04"], + [1, "0x02", "FC80", "COMMAND_6", "0", "S_BUTTON_2", "S_BUTTON_ACTION_DOUBLE_PRESS", "0x06"] + ] + }, "osramMiniRemoteMap": { "vendor": "OSRAM", "doc": "Lightify Switch Mini", diff --git a/devices/ikea/somrig_shortcut_button.json b/devices/ikea/somrig_shortcut_button.json new file mode 100644 index 0000000000..a9481eaad0 --- /dev/null +++ b/devices/ikea/somrig_shortcut_button.json @@ -0,0 +1,100 @@ +{ + "schema": "devcap1.schema.json", + "manufacturername": "IKEA of Sweden", + "modelid": "SOMRIG shortcut button", + "product": "SOMRIG Shortcut Button", + "sleeper": true, + "status": "Gold", + "subdevices": [ + { + "type": "$TYPE_SWITCH", + "restapi": "/sensors", + "uuid": [ + "$address.ext", + "0x01", + "0xFC80" + ], + "items": [ + { + "name": "attr/id" + }, + { + "name": "attr/lastannounced" + }, + { + "name": "attr/lastseen" + }, + { + "name": "attr/manufacturername" + }, + { + "name": "attr/modelid" + }, + { + "name": "attr/name" + }, + { + "name": "attr/swversion" + }, + { + "name": "attr/type" + }, + { + "name": "attr/uniqueid" + }, + { + "name": "config/battery", + "refresh.interval": 86400, + "awake": true, + "parse": { + "at": "0x0021", + "cl": "0x0001", + "ep": 1, + "eval": "Item.val = Attr.val / 2;", + "fn": "zcl:attr" + } + }, + { + "name": "config/on" + }, + { + "name": "config/reachable" + }, + { + "name": "state/buttonevent" + }, + { + "name": "state/lastupdated" + } + ] + } + ], + "bindings": [ + { + "bind": "unicast", + "src.ep": 1, + "dst.ep": 1, + "cl": "0xFC80" + }, + { + "bind": "unicast", + "src.ep": 2, + "dst.ep": 1, + "cl": "0xFC80" + }, + { + "bind": "unicast", + "src.ep": 1, + "cl": "0x0001", + "report": [ + { + "at": "0x0021", + "dt": "0x20", + "min": 3200, + "max": 3600, + "change": "0x00000002" + } + ] + } + ] +}