Skip to content

Commit da63ae2

Browse files
committed
Add support for Aqara FP1E.
1 parent 8a7f4e6 commit da63ae2

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

src/devices/lumi.ts

+27
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,33 @@ const definitions: DefinitionWithExtend[] = [
18911891
},
18921892
extend: [lumiZigbeeOTA()],
18931893
},
1894+
{
1895+
zigbeeModel: ['lumi.sensor_occupy.agl1'],
1896+
model: 'lumi.sensor_occupy.agl1',
1897+
vendor: 'Aqara',
1898+
description: 'Presence sensor FP1E',
1899+
fromZigbee: [lumi.fromZigbee.lumi_specific],
1900+
toZigbee: [lumi.toZigbee.lumi_motion_sensitivity],
1901+
exposes: [
1902+
e.device_temperature(),
1903+
e.power_outage_count(),
1904+
e.motion_sensitivity_select(['low', 'medium', 'high']).withDescription('Select motion sensitivity to use.'),
1905+
],
1906+
configure: async (device, coordinatorEndpoint) => {
1907+
// Retrieve motion sensitivity value
1908+
const endpoint = device.getEndpoint(1);
1909+
await endpoint.read('manuSpecificLumi', [0x010c], {manufacturerCode: manufacturerCode});
1910+
},
1911+
extend: [
1912+
lumiZigbeeOTA(),
1913+
lumi.lumiModernExtend.fp1ePresence(),
1914+
lumi.lumiModernExtend.fp1eMovement(),
1915+
lumi.lumiModernExtend.fp1eTargetDistance(),
1916+
lumi.lumiModernExtend.fp1eDetectionRange(),
1917+
lumi.lumiModernExtend.fp1eSpatialLearning(),
1918+
lumi.lumiModernExtend.fp1eRestartDevice(),
1919+
],
1920+
},
18941921
{
18951922
zigbeeModel: ['lumi.sensor_magnet'],
18961923
model: 'MCCGQ01LM',

src/lib/lumi.ts

+75
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,81 @@ export const lumiModernExtend = {
22152215

22162216
return {exposes, fromZigbee, isModernExtend: true};
22172217
},
2218+
fp1ePresence: () => {
2219+
const attribute = {ID: 0x0142, type: 0x20};
2220+
return modernExtend.binary({
2221+
name: 'presence',
2222+
valueOn: [true, 1],
2223+
valueOff: [false, 0],
2224+
access: 'STATE_GET',
2225+
cluster: 'manuSpecificLumi',
2226+
attribute: attribute,
2227+
description: 'Indicates whether the device detected presence',
2228+
});
2229+
},
2230+
fp1eMovement: () =>
2231+
modernExtend.enumLookup({
2232+
name: 'movement',
2233+
lookup: {unknown_0: 0, unknown_1: 1, no_presence: 2, movement: 3, no_movement: 4},
2234+
cluster: 'manuSpecificLumi',
2235+
attribute: {ID: 0x0160, type: 0x20},
2236+
zigbeeCommandOptions: {disableDefaultResponse: true},
2237+
description: 'Is movement detected?',
2238+
access: 'STATE_GET',
2239+
}),
2240+
fp1eTargetDistance: () =>
2241+
modernExtend.numeric({
2242+
name: 'target_distance',
2243+
cluster: 'manuSpecificLumi',
2244+
attribute: {ID: 0x015f, type: 0x23},
2245+
access: 'STATE_GET',
2246+
description: 'Distance to the detected target',
2247+
scale: 100,
2248+
precision: 2,
2249+
unit: 'm',
2250+
}),
2251+
fp1eDetectionRange: () =>
2252+
modernExtend.numeric({
2253+
name: 'detection_range',
2254+
cluster: 'manuSpecificLumi',
2255+
attribute: {ID: 0x015b, type: 0x23},
2256+
access: 'ALL',
2257+
description: 'The device will monitor presence within the detection range',
2258+
scale: 100,
2259+
precision: 2,
2260+
unit: 'm',
2261+
valueMin: 0,
2262+
valueMax: 6.0,
2263+
valueStep: 0.3,
2264+
}),
2265+
fp1eSpatialLearning: () => {
2266+
return {
2267+
isModernExtend: true,
2268+
exposes: [e.enum('spatial_learning', ea.SET, ['Start Learning']).withDescription('Initiate AI Spatial Learning.')],
2269+
toZigbee: [
2270+
{
2271+
key: ['spatial_learning'],
2272+
convertSet: async (entity, key, value, meta) => {
2273+
await entity.write('manuSpecificLumi', {0x0157: {value: 1, type: 0x20}}, manufacturerOptions.lumi);
2274+
},
2275+
},
2276+
],
2277+
} satisfies ModernExtend;
2278+
},
2279+
fp1eRestartDevice: () => {
2280+
return {
2281+
isModernExtend: true,
2282+
exposes: [e.enum('restart_device', ea.SET, ['Restart Device']).withDescription('Restarts the device.')],
2283+
toZigbee: [
2284+
{
2285+
key: ['restart_device'],
2286+
convertSet: async (entity, key, value, meta) => {
2287+
await entity.write('manuSpecificLumi', {0x00e8: {value: 0x00, type: 0x10}}, manufacturerOptions.lumi);
2288+
},
2289+
},
2290+
],
2291+
} satisfies ModernExtend;
2292+
},
22182293
};
22192294

22202295
export {lumiModernExtend as modernExtend};

0 commit comments

Comments
 (0)