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

Xiaomi special attribute in DDF #6919

Merged
merged 47 commits into from Jun 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3710e26
Aqara temperature/humidity/air pressure sensor
ebaauw Apr 21, 2023
131e993
Update lumi_weather.json
ebaauw Apr 21, 2023
5700835
Create generic script to parse Xiaomi special attribute
ebaauw Apr 21, 2023
1679e8c
lumi.sensor_magnet.aq2
ebaauw Apr 21, 2023
8e2e802
Update lumi_weather.json
ebaauw Apr 21, 2023
8a14d0d
Update lumi_airmonitor_acn01.json
ebaauw Apr 21, 2023
f66fc1d
Use generic `attr/swversion` details.
ebaauw Apr 21, 2023
0055a68
Delete fcc0_airmonitor_acn01.js
ebaauw Apr 22, 2023
01c130a
Update lumi_airmonitor_acn01.json
ebaauw Apr 22, 2023
892cbf4
Update 0000_xiaomi_special.js
ebaauw Apr 22, 2023
b5e0f79
Define dummy items
ebaauw Apr 22, 2023
17a5c5c
Update 0001_battery.js
ebaauw Apr 22, 2023
c62c049
Update xiaomi_battery.js
ebaauw Apr 22, 2023
827ae68
Update lumi_weather.json
ebaauw Apr 22, 2023
d6ba871
Update lumi_airmonitor_acn01.json
ebaauw Apr 22, 2023
4eeda9e
Update lumi_sensor_magnet_aq2.json
ebaauw Apr 22, 2023
0380674
Update lumi_motion_ac01.json
ebaauw Apr 22, 2023
8bdd88d
Update lumi_curtain_acn002.json
ebaauw Apr 22, 2023
003ce3c
Delete 0000_xiaomi_special.js
ebaauw Apr 22, 2023
83f0c8e
More items
ebaauw Apr 22, 2023
37a18f4
Update config_triggerdistance_bis_item.json
ebaauw Apr 22, 2023
26d549b
Update rest_sensors.cpp
ebaauw Apr 22, 2023
7ef1f16
Update lumi_motion_ac01.json
ebaauw Apr 22, 2023
6c561ae
Update lumi_sensor_magnet_aq2.json
ebaauw Apr 22, 2023
317af04
Add `state/water_bis`
ebaauw Apr 30, 2023
23dbc9f
Update lumi_airmonitor_acn01.json
ebaauw Apr 30, 2023
d5aa221
Update lumi_sensor_magnet_aq2.json
ebaauw Apr 30, 2023
049eeb5
Create lumi_sensor_wleak_aq1.json
ebaauw Apr 30, 2023
11abe06
Update lumi_sensor_wleak_aq1.json
ebaauw Apr 30, 2023
87e8d27
Update lumi_weather.json
ebaauw Apr 30, 2023
0cf9908
Update lumi_sensor_wleak_aq1.json
ebaauw Apr 30, 2023
ead5031
Update lumi_sensor_magnet_aq2.json
ebaauw Apr 30, 2023
fca0d4e
Update lumi_motion_ac01.json
ebaauw Apr 30, 2023
c92f43c
Fix orientation items.
ebaauw Apr 30, 2023
7368bbc
Create 0101_orientation.js
ebaauw Apr 30, 2023
6f733cc
Create lumi_vibration_aq1.json
ebaauw Apr 30, 2023
035ac0c
Delete aq1_vibration_sensor.json
ebaauw Apr 30, 2023
d6323fb
Delete aq1_vibration_sensor_orientation.js
ebaauw Apr 30, 2023
9317567
Update lumi_vibration_aq1.json
ebaauw Apr 30, 2023
428f91f
Update rest_sensors.cpp
ebaauw Apr 30, 2023
91405ab
Update lumi_sensor_magnet_aq2.json
ebaauw May 6, 2023
7812d73
Update lumi_weather.json
ebaauw May 6, 2023
17bfe30
Use indent of two spaces
ebaauw May 14, 2023
f2d50ee
Update lumi_curtain.json
ebaauw May 20, 2023
481b767
Update constants.json
ebaauw May 20, 2023
eb76a1c
Merge remote-tracking branch 'upstream/master' into lumi_weather
ebaauw May 20, 2023
3d9e7f2
Merge remote-tracking branch 'upstream/master' into lumi_weather
ebaauw May 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions devices/generic/constants.json
Expand Up @@ -32,8 +32,10 @@
"$TYPE_LIGHT_LEVEL_SENSOR": "ZHALightLevel",
"$TYPE_MOISTURE_SENSOR": "ZHAMoisture",
"$TYPE_ON_OFF_LIGHT": "On/Off light",
"$TYPE_ON_OFF_LIGHT_SWITCH": "On/Off light switch",
"$TYPE_ON_OFF_OUTPUT": "On/Off output",
"$TYPE_ON_OFF_PLUGIN_UNIT": "On/Off plug-in unit",
"$TYPE_ON_OFF_SWITCH": "On/Off switch",
"$TYPE_OPEN_CLOSE_SENSOR": "ZHAOpenClose",
"$TYPE_POWER_SENSOR": "ZHAPower",
"$TYPE_PRESENCE_SENSOR": "ZHAPresence",
Expand Down
8 changes: 0 additions & 8 deletions devices/generic/items/attr_xiaomi_item.json

This file was deleted.

12 changes: 12 additions & 0 deletions devices/generic/items/config_battery_bis_item.json
@@ -0,0 +1,12 @@
{
"schema": "resourceitem1.schema.json",
"id": "config/battery_bis",
"datatype": "UInt8",
"access": "R",
"public": false,
"range": [
0,
100
],
"description": "The current device battery level in 0–100 %."
}
8 changes: 8 additions & 0 deletions devices/generic/items/config_devicemode_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "config/devicemode_bis",
"datatype": "String",
"access": "R",
"public": false,
"description": "Mode of the Hue wall switch module with possible values 'singlerocker', 'singlepushbutton', 'dualrocker', 'dualpushbutton'. Xiaomi devices have possible values of 'compatibility' and 'zigbee', but DO NOT CHANGE UNLESS YOU KNOW EXACTLY, WHAT YOU'RE DOING"
}
9 changes: 9 additions & 0 deletions devices/generic/items/config_reportgrid_item.json
@@ -0,0 +1,9 @@
{
"schema": "resourceitem1.schema.json",
"id": "config/reportgrid",
"datatype": "Bool",
"access": "RW",
"public": true,
"description": "Report detailed presence detection grid data (e.g. Aqara FP1).",
"default": true
}
8 changes: 8 additions & 0 deletions devices/generic/items/config_sensitivity_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "config/sensitivity_bis",
"datatype": "UInt8",
"access": "R",
"public": false,
"description": "The sensor sensitivity."
}
8 changes: 8 additions & 0 deletions devices/generic/items/config_triggerdistance_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "config/triggerdistance_bis",
"datatype": "String",
"access": "R",
"public": false,
"description": "A device specific distance setting when it triggers the associated function (e.g. detect presence or motion)."
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_airquality_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/airquality_bis",
"datatype": "String",
"access": "R",
"public": false,
"description": "Text representation of the air quality based on tVOC level."
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_airqualityppb_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/airqualityppb_bis",
"datatype": "UInt16",
"access": "R",
"public": false,
"description": "Measured tVOC level in ppb."
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_humidity_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/humidity_bis",
"datatype": "UInt16",
"access": "R",
"public": false,
"description": "The current relative humidity in percent."
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_open_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/open_bis",
"datatype": "Bool",
"access": "R",
"public": false,
"description": "True when open is detected."
}
9 changes: 0 additions & 9 deletions devices/generic/items/state_orientation_item.json

This file was deleted.

5 changes: 2 additions & 3 deletions devices/generic/items/state_orientation_x_item.json
Expand Up @@ -3,7 +3,6 @@
"id": "state/orientation_x",
"datatype": "Int16",
"access": "R",
"public": false,
"range": [-65535, 65535],
"public": true,
"description": "The X orientation of a gyro."
}
}
5 changes: 2 additions & 3 deletions devices/generic/items/state_orientation_y_item.json
Expand Up @@ -3,7 +3,6 @@
"id": "state/orientation_y",
"datatype": "Int16",
"access": "R",
"public": false,
"range": [-65535, 65535],
"public": true,
"description": "The Y orientation of a gyro."
}
}
5 changes: 2 additions & 3 deletions devices/generic/items/state_orientation_z_item.json
Expand Up @@ -3,7 +3,6 @@
"id": "state/orientation_z",
"datatype": "Int16",
"access": "R",
"public": false,
"range": [-65535, 65535],
"public": true,
"description": "The Z orientation of a gyro."
}
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_pressure_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/pressure_bis",
"datatype": "Int16",
"access": "R",
"public": false,
"description": "The current air pressure (mBar)."
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_temperature_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/temperature_bis",
"datatype": "Int16",
"access": "R",
"public": false,
"description": "The current temperature in °C × 100."
}
8 changes: 8 additions & 0 deletions devices/generic/items/state_water_bis_item.json
@@ -0,0 +1,8 @@
{
"schema": "resourceitem1.schema.json",
"id": "state/water_bis",
"datatype": "Bool",
"access": "R",
"public": false,
"description": "True when water is detected."
}
6 changes: 3 additions & 3 deletions devices/xiaomi/0001_battery.js
@@ -1,7 +1,7 @@
/* global Attr, Item */
/* global Attr, R */

const vmin = 27
const vmax = 30
const v = Math.max(vmin, Math.min(Attr.val, vmax))
const bat = ((v - vmin) / (vmax - vmin)) * 100
Item.val = Math.max(0, Math.min(bat, 100))
const bat = Math.round(((v - vmin) / (vmax - vmin)) * 100)
R.Item('config/battery').val = Math.max(0, Math.min(bat, 100))
8 changes: 8 additions & 0 deletions devices/xiaomi/0101_orientation.js
@@ -0,0 +1,8 @@
/* global Attr, R */

const x = Attr.val << 16 >> 16
const y = Attr.val >> 16
const z = (Attr.val / 0x10000) >> 16
R.item('state/orientation_x').val = Math.round(Math.atan(x / Math.sqrt(z * z + y * y)) * 180 / Math.PI)
R.item('state/orientation_y').val = Math.round(Math.atan(y / Math.sqrt(x * x + z * z)) * 180 / Math.PI)
R.item('state/orientation_z').val = Math.round(Math.atan(z / Math.sqrt(x * x + y * y)) * 180 / Math.PI)
137 changes: 0 additions & 137 deletions devices/xiaomi/aq1_vibration_sensor.json

This file was deleted.

15 changes: 0 additions & 15 deletions devices/xiaomi/aq1_vibration_sensor_orientation.js

This file was deleted.