Skip to content
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: 7 additions & 0 deletions front/src/components/boxs/device-in-room/DeviceRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import SetpointDeviceFeature from './device-features/SetpointDeviceFeature';
import AirConditioningModeDeviceFeature from './device-features/AirConditioningModeDeviceFeature';
import PilotWireModeDeviceFeature from './device-features/PilotWireModeDeviceFeature';
import LMHVolumeDeviceFeature from './device-features/LMHVolumeDeviceFeature';
import SirenModeDeviceFeature from './device-features/SirenModeDeviceFeature';
import SirenLevelDeviceFeature from './device-features/SirenLevelDeviceFeature';
import PushDeviceFeature from './device-features/PushDeviceFeature';

const ROW_TYPE_BY_FEATURE_TYPE = {
Expand All @@ -34,6 +36,11 @@ const ROW_TYPE_BY_FEATURE_TYPE = {
[DEVICE_FEATURE_TYPES.HEATER.PILOT_WIRE_MODE]: PilotWireModeDeviceFeature,
[DEVICE_FEATURE_TYPES.LOCK.BINARY]: BinaryDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.LMH_VOLUME]: LMHVolumeDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.MODE]: SirenModeDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.LEVEL]: SirenLevelDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.STROBE_LEVEL]: SirenLevelDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.STROBE]: BinaryDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.STROBE_DUTY_CYCLE]: NumberDeviceFeature,
[DEVICE_FEATURE_TYPES.SIREN.MELODY]: NumberDeviceFeature,
[DEVICE_FEATURE_TYPES.DURATION.DECIMAL]: MultiLevelDeviceFeature,
[DEVICE_FEATURE_TYPES.BUTTON.PUSH]: PushDeviceFeature,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import get from 'get-value';
import { Text } from 'preact-i18n';

import { DeviceFeatureCategoriesIcon } from '../../../../utils/consts';
import { SIREN_LMH_VOLUME } from '../../../../../../server/utils/constants';

const SirenLevelDeviceFeature = ({ children, ...props }) => {
const { deviceFeature } = props;
const { category, type } = deviceFeature;

function updateValue(e) {
props.updateValueWithDebounce(deviceFeature, e.currentTarget.value);
}

return (
<tr>
<td>
<i class={`fe fe-${get(DeviceFeatureCategoriesIcon, `${category}.${type}`, { default: 'sliders' })}`} />
</td>
<td>{props.rowName}</td>

<td class="py-0">
<div class="justify-content-end">
<div class="form-group mb-0">
<select value={props.deviceFeature.last_value} onChange={updateValue} class="form-control form-control-sm">
<option value={SIREN_LMH_VOLUME.LOW}>
<Text id={`deviceFeatureAction.category.${category}.${type}.low`} />
</option>
<option value={SIREN_LMH_VOLUME.MEDIUM}>
<Text id={`deviceFeatureAction.category.${category}.${type}.medium`} />
</option>
<option value={SIREN_LMH_VOLUME.HIGH}>
<Text id={`deviceFeatureAction.category.${category}.${type}.high`} />
</option>
<option value={SIREN_LMH_VOLUME.VERY_HIGH}>
<Text id={`deviceFeatureAction.category.${category}.${type}.very_high`} />
</option>
</select>
</div>
</div>
</td>
</tr>
);
};

export default SirenLevelDeviceFeature;
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import get from 'get-value';
import { Text } from 'preact-i18n';

import { DeviceFeatureCategoriesIcon } from '../../../../utils/consts';
import { SIREN_MODE } from '../../../../../../server/utils/constants';

const SirenModeDeviceFeature = ({ children, ...props }) => {
const { deviceFeature } = props;
const { category, type } = deviceFeature;

function updateValue(e) {
props.updateValueWithDebounce(deviceFeature, e.currentTarget.value);
}

return (
<tr>
<td>
<i class={`fe fe-${get(DeviceFeatureCategoriesIcon, `${category}.${type}`, { default: 'sliders' })}`} />
</td>
<td>{props.rowName}</td>

<td class="py-0">
<div class="justify-content-end">
<div class="form-group mb-0">
<select value={props.deviceFeature.last_value} onChange={updateValue} class="form-control form-control-sm">
<option value={SIREN_MODE.STOP}>
<Text id={`deviceFeatureAction.category.${category}.${type}.stop`} />
</option>
<option value={SIREN_MODE.BURGLAR}>
<Text id={`deviceFeatureAction.category.${category}.${type}.burglar`} />
</option>
<option value={SIREN_MODE.FIRE}>
<Text id={`deviceFeatureAction.category.${category}.${type}.fire`} />
</option>
<option value={SIREN_MODE.EMERGENCY}>
<Text id={`deviceFeatureAction.category.${category}.${type}.emergency`} />
</option>
<option value={SIREN_MODE.POLICE_PANIC}>
<Text id={`deviceFeatureAction.category.${category}.${type}.police_panic`} />
</option>
<option value={SIREN_MODE.FIRE_PANIC}>
<Text id={`deviceFeatureAction.category.${category}.${type}.fire_panic`} />
</option>
<option value={SIREN_MODE.EMERGENCY_PANIC}>
<Text id={`deviceFeatureAction.category.${category}.${type}.emergency_panic`} />
</option>
</select>
</div>
</div>
</td>
</tr>
);
};

export default SirenModeDeviceFeature;
32 changes: 31 additions & 1 deletion front/src/config/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3310,6 +3310,27 @@
"low": "Niedrig",
"medium": "Mittel",
"high": "Hoch"
},
"mode": {
"stop": "Stopp",
"burglar": "Einbruch",
"fire": "Feuer",
"emergency": "Notfall",
"police_panic": "Polizei-Panik",
"fire_panic": "Feuer-Panik",
"emergency_panic": "Notfall-Panik"
},
"level": {
"low": "Niedrig",
"medium": "Mittel",
"high": "Hoch",
"very_high": "Sehr hoch"
},
"strobe_level": {
"low": "Niedrig",
"medium": "Mittel",
"high": "Hoch",
"very_high": "Sehr hoch"
}
}
}
Expand Down Expand Up @@ -3517,6 +3538,10 @@
}
},
"deviceFeatureCategory": {
"ac-connected": {
"shortCategoryName": "Netzbetrieb",
"binary": "Netzstrom verbunden (ja/nein)"
},
"light": {
"shortCategoryName": "Licht",
"binary": "Licht: ein/aus",
Expand Down Expand Up @@ -3622,7 +3647,12 @@
"shortCategoryName": "Sirene",
"binary": "Sirene",
"lmh_volume": "Lautstärke der Sirene",
"melody": "Melodie"
"melody": "Melodie",
"mode": "Warnmodus",
"level": "Lautstärke",
"strobe": "Blitzlicht",
"strobe_level": "Blitzintensität",
"strobe_duty_cycle": "Blitzzyklus"
},
"cube": {
"shortCategoryName": "Würfel",
Expand Down
32 changes: 31 additions & 1 deletion front/src/config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3310,6 +3310,27 @@
"low": "Low",
"medium": "Medium",
"high": "High"
},
"mode": {
"stop": "Stop",
"burglar": "Burglar",
"fire": "Fire",
"emergency": "Emergency",
"police_panic": "Police panic",
"fire_panic": "Fire panic",
"emergency_panic": "Emergency panic"
},
"level": {
"low": "Low",
"medium": "Medium",
"high": "High",
"very_high": "Very high"
},
"strobe_level": {
"low": "Low",
"medium": "Medium",
"high": "High",
"very_high": "Very high"
}
}
}
Expand Down Expand Up @@ -3517,6 +3538,10 @@
}
},
"deviceFeatureCategory": {
"ac-connected": {
"shortCategoryName": "AC Connected",
"binary": "AC Connected (yes/no)"
},
"light": {
"shortCategoryName": "Light",
"binary": "Light On/Off",
Expand Down Expand Up @@ -3622,7 +3647,12 @@
"shortCategoryName": "Siren",
"binary": "Siren",
"lmh_volume": "Siren volume",
"melody": "Melody"
"melody": "Melody",
"mode": "Warning mode",
"level": "Sound level",
"strobe": "Strobe light",
"strobe_level": "Strobe intensity",
"strobe_duty_cycle": "Strobe duty cycle"
},
"cube": {
"shortCategoryName": "Cube",
Expand Down
32 changes: 31 additions & 1 deletion front/src/config/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -3310,6 +3310,27 @@
"low": "Faible",
"medium": "Moyen",
"high": "Fort"
},
"mode": {
"stop": "Stop",
"burglar": "Intrusion",
"fire": "Incendie",
"emergency": "Urgence",
"police_panic": "Panique police",
"fire_panic": "Panique incendie",
"emergency_panic": "Panique urgence"
},
"level": {
"low": "Faible",
"medium": "Moyen",
"high": "Fort",
"very_high": "Très fort"
},
"strobe_level": {
"low": "Faible",
"medium": "Moyen",
"high": "Fort",
"very_high": "Très fort"
}
}
}
Expand Down Expand Up @@ -3517,6 +3538,10 @@
}
},
"deviceFeatureCategory": {
"ac-connected": {
"shortCategoryName": "Secteur Connecté",
"binary": "Secteur Connecté (Oui/Non)"
},
"light": {
"shortCategoryName": "Lumière",
"binary": "Eclairage On/Off",
Expand Down Expand Up @@ -3622,7 +3647,12 @@
"shortCategoryName": "Sirène",
"binary": "Sirène On/Off",
"lmh_volume": "Volume de la sirène",
"melody": "Mélodie"
"melody": "Mélodie",
"mode": "Mode d'alerte",
"level": "Niveau sonore",
"strobe": "Flash stroboscopique",
"strobe_level": "Intensité du flash",
"strobe_duty_cycle": "Cycle du flash"
},
"cube": {
"shortCategoryName": "Cube",
Expand Down
10 changes: 9 additions & 1 deletion front/src/utils/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ export const DeviceFeatureCategoriesIcon = {
[DEVICE_FEATURE_CATEGORIES.SIREN]: {
[DEVICE_FEATURE_TYPES.SIREN.BINARY]: 'bell',
[DEVICE_FEATURE_TYPES.SIREN.LMH_VOLUME]: 'volume-1',
[DEVICE_FEATURE_TYPES.SIREN.MELODY]: 'music'
[DEVICE_FEATURE_TYPES.SIREN.MELODY]: 'music',
[DEVICE_FEATURE_TYPES.SIREN.MODE]: 'alert-triangle',
[DEVICE_FEATURE_TYPES.SIREN.LEVEL]: 'volume-2',
[DEVICE_FEATURE_TYPES.SIREN.STROBE]: 'zap',
[DEVICE_FEATURE_TYPES.SIREN.STROBE_LEVEL]: 'zap',
[DEVICE_FEATURE_TYPES.SIREN.STROBE_DUTY_CYCLE]: 'clock'
},
[DEVICE_FEATURE_CATEGORIES.TAMPER]: {
[DEVICE_FEATURE_TYPES.SENSOR.BINARY]: 'shield'
Expand Down Expand Up @@ -482,6 +487,9 @@ export const DeviceFeatureCategoriesIcon = {
[DEVICE_FEATURE_TYPES.ELECTRICAL_VEHICLE_STATE.ODOMETER]: 'trending-up',
[DEVICE_FEATURE_TYPES.ELECTRICAL_VEHICLE_STATE.TIRE_PRESSURE]: 'disc',
[DEVICE_FEATURE_TYPES.ELECTRICAL_VEHICLE_STATE.WINDOW_OPENED]: 'square'
},
[DEVICE_FEATURE_CATEGORIES.AC_CONNECTED]: {
[DEVICE_FEATURE_TYPES.AC_CONNECTED.BINARY]: 'zap'
}
};

Expand Down
14 changes: 14 additions & 0 deletions server/services/zigbee2mqtt/exposes/binaryType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../utils/constants');

const names = {
ac_connected: {
feature: {
category: DEVICE_FEATURE_CATEGORIES.AC_CONNECTED,
type: DEVICE_FEATURE_TYPES.AC_CONNECTED.BINARY,
},
},
alarm: {
feature: {
category: DEVICE_FEATURE_CATEGORIES.SIREN,
Expand Down Expand Up @@ -108,6 +114,14 @@ const names = {
type: DEVICE_FEATURE_TYPES.INPUT.BINARY,
},
},
strobe: {
types: {
composite: {
category: DEVICE_FEATURE_CATEGORIES.SIREN,
type: DEVICE_FEATURE_TYPES.SIREN.STROBE,
},
},
},
};

module.exports = {
Expand Down
12 changes: 9 additions & 3 deletions server/services/zigbee2mqtt/exposes/compositeType.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../../../ut
module.exports = {
type: 'composite',
writeValue: (expose, value) => {
const [r, g, b] = intToRgb(parseInt(value, 10));
return { rgb: `${r},${g},${b}` };
if (expose && expose.name === 'color_xy') {
const [r, g, b] = intToRgb(parseInt(value, 10));
return { rgb: `${r},${g},${b}` };
}
return value;
},
readValue: (expose, value) => {
return xyToInt(value.x, value.y);
if (expose && expose.name === 'color_xy') {
return xyToInt(value.x, value.y);
}
return value;
},
names: {
color_xy: {
Expand Down
Loading
Loading