mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-03 02:21:38 +00:00
Added support for Stelpro Ki & Stelpro Maestro (#2628)
* fix potential null exception * Added support for Stelpro Ki * Stelpro Ki: Added support for action_mode (cherry picked from commit 0f740f1aedbedb28d64245531f10a9bfd985e49b) * Stelpro Ki: fix "lock" status update (cherry picked from commit 6ac94411183d92d1f658a7d17a724e50587b8571) * Fixed lint issues * Stelpro: Fixed local_temperature sensor * Added support for Stelpro Maestro * Fix lint * HASS: Fixed support for action_topic/action_template * Prevent a non supported device from causing a null-ref * Update naming. Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
committed by
Koen Kanters
parent
d0e9889f7d
commit
e5b2f71fcd
@@ -13,11 +13,13 @@ class DeviceConfigure extends BaseExtension {
|
||||
}
|
||||
|
||||
shouldConfigure(device, mappedDevice) {
|
||||
if (!device) {
|
||||
if (!device || !mappedDevice) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (device.meta.hasOwnProperty('configured') && device.meta.configured === mappedDevice.meta.configureKey) {
|
||||
if (device.meta &&
|
||||
device.meta.hasOwnProperty('configured') &&
|
||||
device.meta.configured === mappedDevice.meta.configureKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
+37
@@ -154,6 +154,15 @@ const cfg = {
|
||||
value_template: '{{ value_json.temperature }}',
|
||||
},
|
||||
},
|
||||
'sensor_local_temperature': {
|
||||
type: 'sensor',
|
||||
object_id: 'local_temperature',
|
||||
discovery_payload: {
|
||||
unit_of_measurement: '°C',
|
||||
device_class: 'temperature',
|
||||
value_template: '{{ value_json.local_temperature }}',
|
||||
},
|
||||
},
|
||||
'sensor_pressure': {
|
||||
type: 'sensor',
|
||||
object_id: 'pressure',
|
||||
@@ -395,6 +404,18 @@ const cfg = {
|
||||
value_template: '{{ value_json.state }}',
|
||||
},
|
||||
},
|
||||
'lock_keypad_lockout': {
|
||||
type: 'lock',
|
||||
object_id: 'keypad_lock',
|
||||
discovery_payload: {
|
||||
state_topic: true,
|
||||
command_topic: true,
|
||||
command_topic_postfix: 'keypad_lockout',
|
||||
payload_unlock: '0',
|
||||
payload_lock: '1',
|
||||
value_template: '{{ value_json.keypad_lockout }}',
|
||||
},
|
||||
},
|
||||
|
||||
// Thermostat/HVAC
|
||||
'thermostat': (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heating_setpoint', tempStep=1) => {
|
||||
@@ -415,6 +436,8 @@ const cfg = {
|
||||
temperature_state_template: `{{ value_json.${temperatureStateProperty} }}`,
|
||||
temperature_command_topic: temperatureStateProperty,
|
||||
temp_step: tempStep,
|
||||
action_topic: true,
|
||||
action_template: '{{ value_json.operation }}',
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -1075,6 +1098,16 @@ const mapping = {
|
||||
'067771': [cfg.switch],
|
||||
'064873': [cfg.sensor_action],
|
||||
'K3004C': [cfg.switch],
|
||||
'STZB402': [
|
||||
cfg.thermostat(5, 30, 'occupied_heating_setpoint', 0.5),
|
||||
cfg.sensor_local_temperature,
|
||||
cfg.lock_keypad_lockout,
|
||||
],
|
||||
'SMT402': [
|
||||
cfg.thermostat(5, 30, 'occupied_heating_setpoint', 0.5),
|
||||
cfg.sensor_local_temperature,
|
||||
cfg.lock_keypad_lockout,
|
||||
],
|
||||
};
|
||||
|
||||
Object.keys(mapping).forEach((key) => {
|
||||
@@ -1239,6 +1272,10 @@ class HomeAssistant extends BaseExtension {
|
||||
payload.speed_command_topic = `${stateTopic}/set/fan_mode`;
|
||||
}
|
||||
|
||||
if (payload.action_topic) {
|
||||
payload.action_topic = stateTopic;
|
||||
}
|
||||
|
||||
// Override configuration with user settings.
|
||||
if (entity.hasOwnProperty('homeassistant')) {
|
||||
const add = (obj) => {
|
||||
|
||||
Reference in New Issue
Block a user