Skip to content

Commit

Permalink
Add angle and side properties the sensor cube (Koenkk#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-hellhake authored Mar 12, 2021
1 parent 8674ba2 commit 8f17496
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,8 @@ const devices = [
description: 'Mi/Aqara smart home cube',
meta: {battery: {voltageToPercentage: '3V_2100'}},
fromZigbee: [fz.xiaomi_battery, fz.MFKZQ01LM_action_multistate, fz.MFKZQ01LM_action_analog],
exposes: [e.battery(), e.battery_voltage(),
exposes: [e.battery(), e.battery_voltage(), e.angle('action_angle'),
e.cube_side('action_from_side'), e.cube_side('action_side'), e.cube_side('action_to_side'),
e.action(['shake', 'wakeup', 'fall', 'tap', 'slide', 'flip180', 'flip90', 'rotate_left', 'rotate_right'])],
toZigbee: [],
},
Expand Down
2 changes: 2 additions & 0 deletions lib/exposes.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ module.exports = {
text: (name, access) => new Text(name, access),
presets: {
action: (values) => new Enum('action', access.STATE, values).withDescription('Triggered action (e.g. a button click)'),
angle: (name) => new Numeric(name, access.STATE).withValueMin(-360).withValueMax(360),
aqi: () => new Numeric('aqi', access.STATE).withDescription('Air quality index'),
auto_lock: () => new Switch().withState('auto_lock', false, 'Enable/disable auto lock', access.STATE_SET, 'AUTO', 'MANUAL'),
away_mode: () => new Switch().withState('away_mode', false, 'Enable/disable away mode', access.STATE_SET),
Expand All @@ -460,6 +461,7 @@ module.exports = {
cover_position: () => new Cover().withPosition(),
cover_position_tilt: () => new Cover().withPosition().withTilt(),
cpu_temperature: () => new Numeric('cpu_temperature', access.STATE).withUnit('°C').withDescription('Temperature of the CPU'),
cube_side: (name) => new Numeric(name, access.STATE).withDescription('Side of the cube').withValueMin(0).withValueMax(6).withValueStep(1),
current: () => new Numeric('current', access.STATE).withUnit('A').withDescription('Instantaneous measured electrical current'),
current_phase_b: () => new Numeric('current_phase_b', access.STATE).withUnit('A').withDescription('Instantaneous measured electrical current on phase B'),
current_phase_c: () => new Numeric('current_phase_c', access.STATE).withUnit('A').withDescription('Instantaneous measured electrical current on phase C'),
Expand Down

0 comments on commit 8f17496

Please sign in to comment.