Update zigbee-herdsman-converters to 12.0.225 (#4850)

* Update zigbee-herdsman-converters to 12.0.225

* Update homeassistant.js

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
This commit is contained in:
github-actions[bot] 2020-11-02 18:00:58 +01:00 committed by GitHub
parent 195d56d4ef
commit 2ee3b5f12b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 70 deletions

View File

@ -65,24 +65,6 @@ const cfg = {
value_template: '{{ value_json.click }}',
},
},
'sensor_power': {
type: 'sensor',
object_id: 'power',
discovery_payload: {
unit_of_measurement: 'W',
icon: 'mdi:flash',
value_template: '{{ value_json.power }}',
},
},
'sensor_energy': {
type: 'sensor',
object_id: 'energy',
discovery_payload: {
unit_of_measurement: 'kWh',
icon: 'mdi:power-plug',
value_template: '{{ value_json.energy }}',
},
},
'sensor_brightness': {
type: 'sensor',
object_id: 'brightness',
@ -187,6 +169,7 @@ const cfg = {
},
};
/* istanbul ignore next */
const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heating_setpoint',
tempStep=1, systemModes=['off', 'auto', 'heat'], fanModes=[], holdModes=[],
temperatureLowStateTopic=false, temperatureHighStateTopic=false, endpoint=null ) => {
@ -278,47 +261,6 @@ const climate = (minTemp=7, maxTemp=30, temperatureStateProperty='occupied_heati
// Map Home Assistant configurations to devices.
const manualMaping = {
'1TST-EU': [climate(), cfg.sensor_battery],
'AV2010/32': [climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_battery],
'SPZB0001': [climate(5, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_battery],
'ST218': [
climate(5, 30, 'occupied_heating_setpoint', 0.5),
cfg.sensor_local_temperature,
cfg.lock_keypad_lockout,
],
'TH1123ZB': [
climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_local_temperature,
cfg.lock_keypad_lockout, cfg.sensor_power, cfg.sensor_energy,
],
'TH1124ZB': [
climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_local_temperature,
cfg.lock_keypad_lockout, cfg.sensor_power, cfg.sensor_energy,
],
'TH1300ZB': [
climate(7, 30, 'occupied_heating_setpoint', 0.5), cfg.sensor_local_temperature,
cfg.lock_keypad_lockout,
],
'TH1400ZB': [climate()],
'TH1500ZB': [climate()],
'Zen-01-W': [climate(10, 30, 'occupied_heating_setpoint', 0.5)],
'UK7004240': [climate(), cfg.sensor_battery],
'WV704R0A0902': [climate()],
'STZB402': [
climate(5, 30, 'occupied_heating_setpoint', 0.5),
cfg.sensor_local_temperature,
cfg.lock_keypad_lockout,
],
'SMT402': [
climate(5, 30, 'occupied_heating_setpoint', 0.5),
cfg.sensor_local_temperature,
cfg.lock_keypad_lockout,
],
'SMT402AD': [
climate(5, 30, 'occupied_heating_setpoint', 0.5),
cfg.sensor_local_temperature,
cfg.lock_keypad_lockout,
],
'SLR1b': [climate()],
'GS361A-H04': [
cfg.lock_child_lock,
cfg.switch_window_detection,
@ -350,9 +292,6 @@ const manualMaping = {
climate(5, 35, 'current_heating_setpoint', 0.5,
['off', 'heat', 'auto'], [], ['none', 'away']),
],
'ZK03840': [climate()],
'U86KWF-ZPSJ': [climate(5, 30, 'current_heating_setpoint', 0.5)],
'D3-DPWK-TY': [climate(5, 30, 'current_heating_setpoint', 0.5)],
'BHT-002-GCLZB': [
cfg.lock_child_lock, climate(5, 30, 'current_heating_setpoint', 1, ['off', 'heat'], [], ['hold', 'program']),
],
@ -368,7 +307,6 @@ const manualMaping = {
cfg.binary_sensor_battery_low,
climate(5, 30, 'current_heating_setpoint', 0.5, ['off', 'heat'], [], ['manual', 'auto']),
],
'HY08WE': [climate(5, 30, 'current_heating_setpoint', 0.5)],
};
const defaultStatusTopic = 'homeassistant/status';
@ -463,18 +401,74 @@ class HomeAssistant extends Extension {
command_topic_prefix: expose.endpoint ? expose.endpoint : undefined,
},
};
} else if (expose.type === 'climate') {
assert(!expose.endpoint, `Endpoint not supported for climate type`);
const setpointProperties = ['occupied_heating_setpoint', 'current_heating_setpoint'];
const setpoint = expose.features.find((f) => setpointProperties.includes(f.name));
assert(setpoint, 'No setpoint found');
const temperature = expose.features.find((f) => f.name === 'local_temperature');
assert(temperature, 'No temperature found');
const mode = expose.features.find((f) => f.name === 'system_mode');
assert(mode, 'No mode found');
const state = expose.features.find((f) => f.name === 'running_state');
assert(state, 'No state found');
discoveryEntry = {
type: 'climate',
object_id: expose.endpoint ? `climate_${expose.endpoint}` : 'climate',
discovery_payload: {
// Static
state_topic: false,
temperature_unit: 'C',
// Setpoint
temp_step: setpoint.value_step,
min_temp: setpoint.value_min.toString(),
max_temp: setpoint.value_max.toString(),
temperature_command_topic: setpoint.property,
temperature_state_template: `{{ value_json.${setpoint.property} }}`,
temperature_state_topic: true,
// Temperature
current_temperature_topic: true,
current_temperature_template: `{{ value_json.${temperature.property} }}`,
// Mode
mode_state_topic: true,
mode_state_template: `{{ value_json.${mode.property} }}`,
modes: mode.values,
mode_command_topic: true,
// State
action_topic: true,
action_template: `{% set values = ` +
`{'idle':'off','heat':'heating','cool':'cooling','fan only':'fan'}` +
` %}{{ values[value_json.${state.property}] }}`,
},
};
} else if (expose.type === 'lock') {
assert(!expose.endpoint, `Endpoint not supported for lock type`);
const state = expose.features.find((f) => f.name === 'state');
assert(state, 'No state found');
discoveryEntry = {
type: 'lock',
object_id: 'lock',
discovery_payload: {
command_topic: true,
value_template: '{{ value_json.state }}',
state_locked: 'LOCK',
state_unlocked: 'UNLOCK',
value_template: `{{ value_json.${state.property} }}`,
},
};
if (state.property === 'keypad_lockout') {
// deprecated: keypad_lockout is messy, but changing is breaking
discoveryEntry.discovery_payload.payload_lock = state.value_on;
discoveryEntry.discovery_payload.payload_unlock = state.value_off;
discoveryEntry.discovery_payload.state_topic = true;
discoveryEntry.object_id = 'keypad_lock';
} else {
discoveryEntry.discovery_payload.state_locked = state.value_on;
discoveryEntry.discovery_payload.state_unlocked = state.value_off;
}
if (state.property !== 'state') {
discoveryEntry.discovery_payload.command_topic_postfix = state.property;
}
} else if (expose.type === 'cover') {
assert(!expose.endpoint, `Endpoint not supported for cover type`);
const hasPosition = expose.features.find((e) => e.name === 'position');
@ -582,6 +576,7 @@ class HomeAssistant extends Extension {
requested_brightness_percent: {icon: 'mdi:brightness-5'},
eco2: {icon: 'mdi:molecule-co2'},
co2: {icon: 'mdi:molecule-co2'},
local_temperature: {device_class: 'temperature'},
};
assert(!expose.endpoint, `Endpoint not supported for numeric type`);

6
npm-shrinkwrap.json generated
View File

@ -14576,9 +14576,9 @@
}
},
"zigbee-herdsman-converters": {
"version": "12.0.224",
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.224.tgz",
"integrity": "sha512-Iej1T5biRrXuKOdC6bsT8HDpayZSao/I4DWNstYlSyJhpa3QM0vZLbS4QexVmkG35gebrs1MSC7RVT4kUqizrw==",
"version": "12.0.225",
"resolved": "https://registry.npmjs.org/zigbee-herdsman-converters/-/zigbee-herdsman-converters-12.0.225.tgz",
"integrity": "sha512-jm3R5de5lQu8mh6WZFQ44vxrhnlqYjHX+NFF2983y+K0yLf1ZSWWtqna54TM+JM18drOeMEEYlDONAZijkzFqg==",
"requires": {
"axios": "^0.21.0",
"buffer-crc32": "^0.2.13",

View File

@ -53,7 +53,7 @@
"winston-syslog": "^2.4.4",
"ws": "^7.3.1",
"zigbee-herdsman": "0.13.26",
"zigbee-herdsman-converters": "12.0.224",
"zigbee-herdsman-converters": "12.0.225",
"zigbee2mqtt-frontend": "0.2.68"
},
"devDependencies": {