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

feat(z2m): Add Tuya Rain #2241

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion front/src/config/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,10 @@
"shortCategoryName": "Anwesenheitssensor",
"push": "Anwesenheit"
},
"rain-sensor": {
"shortCategoryName": "Regensensor",
"binary": "Regenerkennung Ja/Nein"
},
"light-sensor": {
"shortCategoryName": "Helligkeitssensor",
"integer": "Helligkeit (ganze Zahl)",
Expand Down Expand Up @@ -3270,7 +3274,8 @@
},
"precipitation-sensor": {
"shortCategoryName": "Niederschlagssensor",
"decimal": "Niederschlag"
"decimal": "Niederschlag",
"integer": "Intensität (mV)"
},
"uv-sensor": {
"shortCategoryName": "UV-Sensor",
Expand Down
7 changes: 6 additions & 1 deletion front/src/config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,10 @@
"shortCategoryName": "Presence sensor",
"push": "Presence"
},
"rain-sensor": {
"shortCategoryName": "Rain sensor",
"binary": "Rain detection Yes/No"
},
"light-sensor": {
"shortCategoryName": "Luminosity sensor",
"integer": "Luminosity (integer)",
Expand Down Expand Up @@ -3270,7 +3274,8 @@
},
"precipitation-sensor": {
"shortCategoryName": "Precipitation sensor",
"decimal": "Precipitation"
"decimal": "Precipitation",
"integer": "Intensity (mV)"
},
"uv-sensor": {
"shortCategoryName": "UV Sensor",
Expand Down
7 changes: 6 additions & 1 deletion front/src/config/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3026,6 +3026,10 @@
"shortCategoryName": "Détecteur de présence",
"push": "Présence"
},
"rain-sensor": {
"shortCategoryName": "Détecteur de pluie",
"binary": "Détection pluie Oui/Non"
},
"light-sensor": {
"shortCategoryName": "Capteur de luminosité",
"integer": "Luminosité entière",
Expand Down Expand Up @@ -3270,7 +3274,8 @@
},
"precipitation-sensor": {
"shortCategoryName": "Capteur de précipitations",
"decimal": "Précipitation"
"decimal": "Précipitation",
"integer": "Intensité (mV)"
},
"uv-sensor": {
"shortCategoryName": "Capteur d'UV",
Expand Down
6 changes: 5 additions & 1 deletion front/src/utils/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ export const DeviceFeatureCategoriesIcon = {
[DEVICE_FEATURE_CATEGORIES.LEAK_SENSOR]: {
[DEVICE_FEATURE_TYPES.SENSOR.BINARY]: 'droplet'
},
[DEVICE_FEATURE_CATEGORIES.RAIN_SENSOR]: {
[DEVICE_FEATURE_TYPES.SENSOR.BINARY]: 'umbrella'
},
[DEVICE_FEATURE_CATEGORIES.HUMIDITY_SENSOR]: {
[DEVICE_FEATURE_TYPES.SENSOR.DECIMAL]: 'droplet'
},
Expand Down Expand Up @@ -350,7 +353,8 @@ export const DeviceFeatureCategoriesIcon = {
[DEVICE_FEATURE_TYPES.UV_SENSOR.INTEGER]: 'sun'
},
[DEVICE_FEATURE_CATEGORIES.PRECIPITATION_SENSOR]: {
[DEVICE_FEATURE_TYPES.PRECIPITATION_SENSOR.DECIMAL]: 'umbrella'
[DEVICE_FEATURE_TYPES.PRECIPITATION_SENSOR.DECIMAL]: 'umbrella',
[DEVICE_FEATURE_TYPES.PRECIPITATION_SENSOR.INTEGER]: 'umbrella'
},
[DEVICE_FEATURE_CATEGORIES.CURRENCY]: {
[DEVICE_FEATURE_TYPES.CURRENCY.DECIMAL]: 'dollar-sign'
Expand Down
6 changes: 6 additions & 0 deletions server/services/zigbee2mqtt/exposes/binaryType.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ const names = {
type: DEVICE_FEATURE_TYPES.SENSOR.BINARY,
},
},
rain: {
feature: {
category: DEVICE_FEATURE_CATEGORIES.RAIN_SENSOR,
type: DEVICE_FEATURE_TYPES.SENSOR.BINARY,
},
},
smoke: {
feature: {
category: DEVICE_FEATURE_CATEGORIES.SMOKE_SENSOR,
Expand Down
7 changes: 7 additions & 0 deletions server/services/zigbee2mqtt/exposes/numericType.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ module.exports = {
unit: DEVICE_FEATURE_UNITS.HECTO_PASCAL,
},
},
rain_intensity: {
feature: {
category: DEVICE_FEATURE_CATEGORIES.PRECIPITATION_SENSOR,
type: DEVICE_FEATURE_TYPES.SENSOR.INTEGER,
unit: DEVICE_FEATURE_UNITS.MILLI_VOLT,
},
},
temperature: {
feature: {
category: DEVICE_FEATURE_CATEGORIES.TEMPERATURE_SENSOR,
Expand Down
3 changes: 3 additions & 0 deletions server/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ const DEVICE_FEATURE_CATEGORIES = {
PRECIPITATION_SENSOR: 'precipitation-sensor',
PRESENCE_SENSOR: 'presence-sensor',
PRESSURE_SENSOR: 'pressure-sensor',
RAIN_SENSOR: 'rain-sensor',
RISK: 'risk',
SHUTTER: 'shutter',
SIGNAL: 'signal',
Expand Down Expand Up @@ -724,6 +725,7 @@ const DEVICE_FEATURE_TYPES = {
},
PRECIPITATION_SENSOR: {
DECIMAL: 'decimal',
INTEGER: 'integer',
},
VOLUME_SENSOR: {
DECIMAL: 'decimal',
Expand Down Expand Up @@ -948,6 +950,7 @@ const DEVICE_FEATURE_UNITS_BY_CATEGORY = {
[DEVICE_FEATURE_CATEGORIES.PRECIPITATION_SENSOR]: [
DEVICE_FEATURE_UNITS.MILLIMETER_PER_HOUR,
DEVICE_FEATURE_UNITS.MILLIMETER_PER_DAY,
DEVICE_FEATURE_UNITS.MILLI_VOLT,
],
[DEVICE_FEATURE_CATEGORIES.UV_SENSOR]: [DEVICE_FEATURE_UNITS.UV_INDEX],
[DEVICE_FEATURE_CATEGORIES.DURATION]: [
Expand Down
Loading