mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-02 18:11:36 +00:00
feat: Use labels in Home Assistant entity naming (#18678)
* feat: Use labels in Home Assistant entity naming * tweak comment
This commit is contained in:
@@ -16,6 +16,7 @@ const sensorClick: DiscoveryEntry = {
|
||||
object_id: 'click',
|
||||
mockProperties: [{property: 'click', value: null}],
|
||||
discovery_payload: {
|
||||
name: 'Click',
|
||||
icon: 'mdi:toggle-switch',
|
||||
value_template: '{{ value_json.click }}',
|
||||
},
|
||||
@@ -42,6 +43,7 @@ const legacyMapping = [
|
||||
mockProperties: [{property: 'brightness', value: null}],
|
||||
object_id: 'brightness',
|
||||
discovery_payload: {
|
||||
name: 'Brightness',
|
||||
unit_of_measurement: 'brightness',
|
||||
icon: 'mdi:brightness-5',
|
||||
value_template: '{{ value_json.brightness }}',
|
||||
@@ -142,6 +144,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `light_${endpoint}` : 'light',
|
||||
mockProperties: [{property: state.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? utils.capitalize(endpoint) : null,
|
||||
brightness: !!hasBrightness,
|
||||
schema: 'json',
|
||||
command_topic: true,
|
||||
@@ -187,6 +190,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `switch_${endpoint}` : 'switch',
|
||||
mockProperties: [{property: property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? utils.capitalize(endpoint) : null,
|
||||
payload_off: state.value_off,
|
||||
payload_on: state.value_on,
|
||||
value_template: `{{ value_json.${property} }}`,
|
||||
@@ -197,6 +201,7 @@ export default class HomeAssistant extends Extension {
|
||||
|
||||
const different = ['valve_detection', 'window_detection', 'auto_lock', 'away_mode'];
|
||||
if (different.includes(property)) {
|
||||
discoveryEntry.discovery_payload.name = firstExpose.label;
|
||||
discoveryEntry.discovery_payload.command_topic_postfix = property;
|
||||
discoveryEntry.discovery_payload.state_off = state.value_off;
|
||||
discoveryEntry.discovery_payload.state_on = state.value_on;
|
||||
@@ -220,6 +225,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `climate_${endpoint}` : 'climate',
|
||||
mockProperties: [],
|
||||
discovery_payload: {
|
||||
name: endpoint ? utils.capitalize(endpoint) : null,
|
||||
// Static
|
||||
state_topic: false,
|
||||
temperature_unit: 'C',
|
||||
@@ -308,6 +314,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `${tempCalibration.name}_${endpoint}` : `${tempCalibration.name}`,
|
||||
mockProperties: [{property: tempCalibration.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${tempCalibration.label} ${endpoint}` : tempCalibration.label,
|
||||
value_template: `{{ value_json.${tempCalibration.property} }}`,
|
||||
command_topic: true,
|
||||
command_topic_prefix: endpoint,
|
||||
@@ -334,6 +341,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `${piHeatingDemand.name}_${endpoint}` : `${piHeatingDemand.name}`,
|
||||
mockProperties: [{property: piHeatingDemand.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${piHeatingDemand.label} ${endpoint}` : piHeatingDemand.label,
|
||||
value_template: `{{ value_json.${piHeatingDemand.property} }}`,
|
||||
...(piHeatingDemand.unit && {unit_of_measurement: piHeatingDemand.unit}),
|
||||
entity_category: 'diagnostic',
|
||||
@@ -354,6 +362,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: 'lock',
|
||||
mockProperties: [{property: state.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: null,
|
||||
command_topic: true,
|
||||
value_template: `{{ value_json.${state.property} }}`,
|
||||
},
|
||||
@@ -361,12 +370,14 @@ export default class HomeAssistant extends Extension {
|
||||
|
||||
if (state.property === 'keypad_lockout') {
|
||||
// deprecated: keypad_lockout is messy, but changing is breaking
|
||||
discoveryEntry.discovery_payload.name = firstExpose.label;
|
||||
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 if (state.property === 'child_lock') {
|
||||
// deprecated: child_lock is messy, but changing is breaking
|
||||
discoveryEntry.discovery_payload.name = firstExpose.label;
|
||||
discoveryEntry.discovery_payload.payload_lock = state.value_on;
|
||||
discoveryEntry.discovery_payload.payload_unlock = state.value_off;
|
||||
discoveryEntry.discovery_payload.state_locked = 'LOCK';
|
||||
@@ -399,6 +410,7 @@ export default class HomeAssistant extends Extension {
|
||||
mockProperties: [{property: state.property, value: null}],
|
||||
object_id: endpoint ? `cover_${endpoint}` : 'cover',
|
||||
discovery_payload: {
|
||||
name: endpoint ? utils.capitalize(endpoint) : null,
|
||||
command_topic_prefix: endpoint,
|
||||
command_topic: true,
|
||||
state_topic: true,
|
||||
@@ -473,6 +485,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: 'fan',
|
||||
mockProperties: [{property: 'fan_state', value: null}],
|
||||
discovery_payload: {
|
||||
name: null,
|
||||
state_topic: true,
|
||||
state_value_template: '{{ value_json.fan_state }}',
|
||||
command_topic: true,
|
||||
@@ -584,6 +597,7 @@ export default class HomeAssistant extends Extension {
|
||||
`switch_${firstExpose.name}_${endpoint}` :
|
||||
`switch_${firstExpose.name}`,
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: typeof firstExpose.value_on === 'boolean' ?
|
||||
`{% if value_json.${firstExpose.property} %} true {% else %} false {% endif %}` :
|
||||
`{{ value_json.${firstExpose.property} }}`,
|
||||
@@ -595,6 +609,10 @@ export default class HomeAssistant extends Extension {
|
||||
...(lookup[firstExpose.name] || {}),
|
||||
},
|
||||
};
|
||||
|
||||
// Let Home Assistant generate entity name when device_class is present
|
||||
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
|
||||
|
||||
discoveryEntries.push(discoveryEntry);
|
||||
} else {
|
||||
const discoveryEntry: DiscoveryEntry = {
|
||||
@@ -602,12 +620,17 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `${firstExpose.name}_${endpoint}` : `${firstExpose.name}`,
|
||||
mockProperties: [{property: firstExpose.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: `{{ value_json.${firstExpose.property} }}`,
|
||||
payload_on: firstExpose.value_on,
|
||||
payload_off: firstExpose.value_off,
|
||||
...(lookup[firstExpose.name] || {}),
|
||||
},
|
||||
};
|
||||
|
||||
// Let Home Assistant generate entity name when device_class is present
|
||||
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
|
||||
|
||||
discoveryEntries.push(discoveryEntry);
|
||||
}
|
||||
} else if (firstExpose.type === 'numeric') {
|
||||
@@ -755,6 +778,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `${firstExpose.name}_${endpoint}` : `${firstExpose.name}`,
|
||||
mockProperties: [{property: firstExpose.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: `{{ value_json.${firstExpose.property} }}`,
|
||||
enabled_by_default: !allowsSet,
|
||||
...(firstExpose.unit && {unit_of_measurement: firstExpose.unit}),
|
||||
@@ -776,6 +800,9 @@ export default class HomeAssistant extends Extension {
|
||||
delete discoveryEntry.discovery_payload.device_class;
|
||||
}
|
||||
|
||||
// Let Home Assistant generate entity name when device_class is present
|
||||
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
|
||||
|
||||
discoveryEntries.push(discoveryEntry);
|
||||
|
||||
/**
|
||||
@@ -789,6 +816,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: endpoint ? `${firstExpose.name}_${endpoint}` : `${firstExpose.name}`,
|
||||
mockProperties: [{property: firstExpose.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: `{{ value_json.${firstExpose.property} }}`,
|
||||
command_topic: true,
|
||||
command_topic_prefix: endpoint,
|
||||
@@ -805,6 +833,9 @@ export default class HomeAssistant extends Extension {
|
||||
delete discoveryEntry.discovery_payload.device_class;
|
||||
}
|
||||
|
||||
// Let Home Assistant generate entity name when device_class is present
|
||||
if (discoveryEntry.discovery_payload.device_class) delete discoveryEntry.discovery_payload.name;
|
||||
|
||||
if (firstExpose.value_min != null) discoveryEntry.discovery_payload.min = firstExpose.value_min;
|
||||
if (firstExpose.value_max != null) discoveryEntry.discovery_payload.max = firstExpose.value_max;
|
||||
|
||||
@@ -856,6 +887,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: firstExpose.property,
|
||||
mockProperties: [{property: firstExpose.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: valueTemplate,
|
||||
enabled_by_default: !(firstExpose.access & ACCESS_SET),
|
||||
...lookup[firstExpose.name],
|
||||
@@ -874,6 +906,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: firstExpose.property,
|
||||
mockProperties: [], // Already mocked above in case access STATE is supported
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: valueTemplate,
|
||||
state_topic: !!(firstExpose.access & ACCESS_STATE),
|
||||
command_topic_prefix: endpoint,
|
||||
@@ -899,6 +932,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: firstExpose.property,
|
||||
mockProperties: [{property: firstExpose.property, value: null}],
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
value_template: `{{ value_json.${firstExpose.property} }}`,
|
||||
enabled_by_default: !settableText,
|
||||
...lookup[firstExpose.name],
|
||||
@@ -912,6 +946,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: firstExpose.property,
|
||||
mockProperties: [], // Already mocked above in case access STATE is supported
|
||||
discovery_payload: {
|
||||
name: endpoint ? `${firstExpose.label} ${endpoint}` : firstExpose.label,
|
||||
state_topic: firstExpose.access & ACCESS_STATE,
|
||||
value_template: `{{ value_json.${firstExpose.property} }}`,
|
||||
command_topic_prefix: endpoint,
|
||||
@@ -1087,6 +1122,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: 'last_seen',
|
||||
mockProperties: [{property: 'last_seen', value: null}],
|
||||
discovery_payload: {
|
||||
name: 'Last seen',
|
||||
value_template: '{{ value_json.last_seen }}',
|
||||
icon: 'mdi:clock',
|
||||
enabled_by_default: false,
|
||||
@@ -1108,6 +1144,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: 'update_state',
|
||||
mockProperties: [], // update is mocked below with updateSensor
|
||||
discovery_payload: {
|
||||
name: 'Update state',
|
||||
icon: 'mdi:update',
|
||||
value_template: `{{ value_json['update']['state'] }}`,
|
||||
enabled_by_default: false,
|
||||
@@ -1121,6 +1158,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: 'update_available',
|
||||
mockProperties: [{property: 'update_available', value: null}],
|
||||
discovery_payload: {
|
||||
name: null,
|
||||
payload_on: true,
|
||||
payload_off: false,
|
||||
value_template: `{{ value_json['update']['state'] == "available" }}`,
|
||||
@@ -1135,6 +1173,7 @@ export default class HomeAssistant extends Extension {
|
||||
object_id: 'update',
|
||||
mockProperties: [{property: 'update', value: {state: null}}],
|
||||
discovery_payload: {
|
||||
name: null,
|
||||
entity_picture: 'https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png',
|
||||
latest_version_topic: true,
|
||||
state_topic: true,
|
||||
@@ -1223,16 +1262,12 @@ export default class HomeAssistant extends Extension {
|
||||
|
||||
const devicePayload = this.getDevicePayload(entity);
|
||||
|
||||
// Set (unique) name, separate by space if device name contains space.
|
||||
if (!payload.device_class || ['timestamp'].includes(payload.device_class)) {
|
||||
const nameSeparator = devicePayload.name.includes('_') ? '_' : ' ';
|
||||
if (config.object_id.startsWith(config.type) && config.object_id.includes('_')) {
|
||||
payload.name = `${config.object_id.split(/_(.+)/)[1]}`;
|
||||
} else if (!config.object_id.startsWith(config.type)) {
|
||||
payload.name = `${config.object_id.replace(/_/g, nameSeparator)}`;
|
||||
} else {
|
||||
payload.name = null;
|
||||
}
|
||||
// Suggest object_id (entity_id) for entity
|
||||
payload.object_id = devicePayload.name.replace(/\s+/g, '_').toLowerCase();
|
||||
if (config.object_id.startsWith(config.type) && config.object_id.includes('_')) {
|
||||
payload.object_id += `_${config.object_id.split(/_(.+)/)[1]}`;
|
||||
} else if (!config.object_id.startsWith(config.type)) {
|
||||
payload.object_id += `_${config.object_id}`;
|
||||
}
|
||||
|
||||
// Set unique_id
|
||||
|
||||
Vendored
+2
-2
@@ -98,12 +98,12 @@ declare global {
|
||||
meta: {state: KeyValue, logger: Logger, device: zh.Device}) => Promise<KeyValue>,
|
||||
}
|
||||
|
||||
interface DefinitionExposeFeature {name: string, endpoint?: string,
|
||||
interface DefinitionExposeFeature {name: string, label: string, endpoint?: string,
|
||||
property: string, value_max?: number, value_min?: number, unit?: string,
|
||||
value_off?: string, value_on?: string, value_step?: number, values: string[], access: number}
|
||||
|
||||
interface DefinitionExpose {
|
||||
type: string, name?: string, features?: DefinitionExposeFeature[],
|
||||
type: string, name?: string, label?: string, features?: DefinitionExposeFeature[],
|
||||
endpoint?: string, values?: string[], value_off?: string, value_on?: string, value_step?: number,
|
||||
access: number, property: string, unit?: string,
|
||||
value_min?: number, value_max?: number}
|
||||
|
||||
@@ -111,6 +111,7 @@ describe('HomeAssistant extension', () => {
|
||||
"stop_effect",
|
||||
"stop_hue_effect",
|
||||
],
|
||||
"object_id":"ha_discovery_group",
|
||||
"unique_id":"9_light_zigbee2mqtt"
|
||||
};
|
||||
|
||||
@@ -134,6 +135,7 @@ describe('HomeAssistant extension', () => {
|
||||
"payload_off":"OFF",
|
||||
"payload_on":"ON",
|
||||
"state_topic":"zigbee2mqtt/ha_discovery_group",
|
||||
"object_id":"ha_discovery_group",
|
||||
"unique_id":"9_switch_zigbee2mqtt",
|
||||
"value_template":"{{ value_json.state }}"
|
||||
};
|
||||
@@ -152,6 +154,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -178,6 +181,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.humidity }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_humidity',
|
||||
'unique_id': '0x0017880104e45522_humidity_zigbee2mqtt',
|
||||
'enabled_by_default': true,
|
||||
'device': {
|
||||
@@ -204,6 +208,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.pressure }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_pressure',
|
||||
'unique_id': '0x0017880104e45522_pressure_zigbee2mqtt',
|
||||
'enabled_by_default': true,
|
||||
'device': {
|
||||
@@ -230,6 +235,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.battery }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_battery',
|
||||
'unique_id': '0x0017880104e45522_battery_zigbee2mqtt',
|
||||
'enabled_by_default': true,
|
||||
'entity_category': 'diagnostic',
|
||||
@@ -259,7 +265,8 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.linkquality }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'name': 'linkquality',
|
||||
'name': 'Linkquality',
|
||||
'object_id': 'weather_sensor_linkquality',
|
||||
'unique_id': '0x0017880104e45522_linkquality_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -291,10 +298,11 @@ describe('HomeAssistant extension', () => {
|
||||
"sw_version": null
|
||||
},
|
||||
"json_attributes_topic":"zigbee2mqtt/wall_switch_double",
|
||||
"name":"left",
|
||||
"name":"Left",
|
||||
"payload_off":"OFF",
|
||||
"payload_on":"ON",
|
||||
"state_topic":"zigbee2mqtt/wall_switch_double",
|
||||
"object_id":"wall_switch_double_left",
|
||||
"unique_id":"0x0017880104e45542_switch_left_zigbee2mqtt",
|
||||
"value_template":"{{ value_json.state_left }}"
|
||||
};
|
||||
@@ -319,10 +327,11 @@ describe('HomeAssistant extension', () => {
|
||||
"sw_version": null
|
||||
},
|
||||
"json_attributes_topic":"zigbee2mqtt/wall_switch_double",
|
||||
"name":"right",
|
||||
"name":"Right",
|
||||
"payload_off":"OFF",
|
||||
"payload_on":"ON",
|
||||
"state_topic":"zigbee2mqtt/wall_switch_double",
|
||||
"object_id":"wall_switch_double_right",
|
||||
"unique_id":"0x0017880104e45542_switch_right_zigbee2mqtt",
|
||||
"value_template":"{{ value_json.state_right }}"
|
||||
};
|
||||
@@ -365,6 +374,7 @@ describe('HomeAssistant extension', () => {
|
||||
"name":null,
|
||||
"schema":"json",
|
||||
"state_topic":"zigbee2mqtt/bulb",
|
||||
"object_id":"bulb",
|
||||
"unique_id":"0x000b57fffec6a5b2_light_zigbee2mqtt",
|
||||
};
|
||||
|
||||
@@ -398,6 +408,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': "{{ value_json.temperature }}",
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -423,6 +434,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.humidity }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_humidity',
|
||||
'unique_id': '0x0017880104e45522_humidity_zigbee2mqtt',
|
||||
'enabled_by_default': true,
|
||||
'device': {
|
||||
@@ -450,6 +462,7 @@ describe('HomeAssistant extension', () => {
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'enabled_by_default': true,
|
||||
'object_id': 'weather_sensor_pressure',
|
||||
'unique_id': '0x0017880104e45522_pressure_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -506,6 +519,7 @@ describe('HomeAssistant extension', () => {
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'enabled_by_default': true,
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -544,6 +558,7 @@ describe('HomeAssistant extension', () => {
|
||||
'availability': [{topic: 'zigbee2mqtt/bridge/state'}],
|
||||
'expire_after': 30,
|
||||
'icon': 'mdi:test',
|
||||
'object_id': 'weather_sensor_humidity'
|
||||
};
|
||||
|
||||
expect(MQTT.publish).toHaveBeenCalledWith(
|
||||
@@ -575,6 +590,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -601,6 +617,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.humidity }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_humidity',
|
||||
'unique_id': '0x0017880104e45522_humidity_zigbee2mqtt',
|
||||
'enabled_by_default': true,
|
||||
'device': {
|
||||
@@ -658,6 +675,7 @@ describe('HomeAssistant extension', () => {
|
||||
"payload_off": "OFF",
|
||||
"payload_on": "ON",
|
||||
"state_topic": "zigbee2mqtt/my_switch",
|
||||
"object_id": "my_switch",
|
||||
"unique_id": "0x0017880104e45541_light_zigbee2mqtt",
|
||||
"value_template": "{{ value_json.state }}"
|
||||
}
|
||||
@@ -722,6 +740,7 @@ describe('HomeAssistant extension', () => {
|
||||
"speed_range_max":4,
|
||||
"json_attributes_topic":"zigbee2mqtt/fan",
|
||||
"name":null,
|
||||
"object_id": "fan",
|
||||
"unique_id":"0x0017880104e45548_fan_zigbee2mqtt",
|
||||
"device":{
|
||||
"identifiers":[
|
||||
@@ -794,6 +813,7 @@ describe('HomeAssistant extension', () => {
|
||||
"temperature_state_template":"{{ value_json.current_heating_setpoint }}",
|
||||
"temperature_state_topic":"zigbee2mqtt/TS0601_thermostat",
|
||||
"temperature_unit":"C",
|
||||
"object_id": "ts0601_thermostat",
|
||||
"unique_id":"0x0017882104a44559_climate_zigbee2mqtt"
|
||||
};
|
||||
|
||||
@@ -821,6 +841,7 @@ describe('HomeAssistant extension', () => {
|
||||
state_stopped: 'STOP',
|
||||
json_attributes_topic: 'zigbee2mqtt/smart vent',
|
||||
name: null,
|
||||
object_id: 'smart_vent',
|
||||
unique_id: '0x0017880104e45551_cover_zigbee2mqtt',
|
||||
device:
|
||||
{
|
||||
@@ -851,7 +872,7 @@ describe('HomeAssistant extension', () => {
|
||||
"sw_version": null
|
||||
},
|
||||
"json_attributes_topic": "zigbee2mqtt/zigfred_plus/l6",
|
||||
"name": "l6",
|
||||
"name": "L6",
|
||||
"position_template": "{{ value_json.position }}",
|
||||
"position_topic": "zigbee2mqtt/zigfred_plus/l6",
|
||||
"set_position_template": "{ \"position_l6\": {{ position }} }",
|
||||
@@ -863,6 +884,7 @@ describe('HomeAssistant extension', () => {
|
||||
"tilt_command_topic": "zigbee2mqtt/zigfred_plus/l6/set/tilt",
|
||||
"tilt_status_template": "{{ value_json.tilt }}",
|
||||
"tilt_status_topic": "zigbee2mqtt/zigfred_plus/l6",
|
||||
"object_id": "zigfred_plus_l6",
|
||||
"unique_id": "0xf4ce368a38be56a1_cover_l6_zigbee2mqtt",
|
||||
"value_template": "{{ value_json.state }}"
|
||||
}
|
||||
@@ -889,6 +911,7 @@ describe('HomeAssistant extension', () => {
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'enabled_by_default': true,
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -1015,6 +1038,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -1150,6 +1174,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -1231,6 +1256,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor_renamed',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor_renamed',
|
||||
'object_id': 'weather_sensor_renamed_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -1320,6 +1346,7 @@ describe('HomeAssistant extension', () => {
|
||||
"stop_effect",
|
||||
"stop_hue_effect",
|
||||
],
|
||||
"object_id":"ha_discovery_group_new",
|
||||
"unique_id":"9_light_zigbee2mqtt"
|
||||
};
|
||||
|
||||
@@ -1358,6 +1385,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor_renamed',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor_renamed',
|
||||
'object_id': 'weather_sensor_renamed_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
@@ -1385,6 +1413,8 @@ describe('HomeAssistant extension', () => {
|
||||
"enabled_by_default": false,
|
||||
"state_topic":"zigbee2mqtt/bulb",
|
||||
"json_attributes_topic":"zigbee2mqtt/bulb",
|
||||
"name":null,
|
||||
"object_id":"bulb_update_available",
|
||||
"unique_id":"0x000b57fffec6a5b2_update_available_zigbee2mqtt",
|
||||
"device":{
|
||||
"identifiers":[
|
||||
@@ -1787,6 +1817,7 @@ describe('HomeAssistant extension', () => {
|
||||
'state_class': 'measurement',
|
||||
'value_template': '{{ value_json.temperature }}',
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'enabled_by_default': true,
|
||||
'device': {
|
||||
@@ -1846,6 +1877,7 @@ describe('HomeAssistant extension', () => {
|
||||
"stop_effect",
|
||||
"stop_hue_effect",
|
||||
],
|
||||
"object_id":"ha_discovery_group",
|
||||
"unique_id":"9_light_zigbee2mqtt"
|
||||
};
|
||||
|
||||
@@ -1895,6 +1927,7 @@ describe('HomeAssistant extension', () => {
|
||||
"stop_effect",
|
||||
"stop_hue_effect",
|
||||
],
|
||||
"object_id":"ha_discovery_group",
|
||||
"unique_id":"9_light_zigbee2mqtt"
|
||||
};
|
||||
|
||||
@@ -1949,6 +1982,7 @@ describe('HomeAssistant extension', () => {
|
||||
"supported_color_modes":[
|
||||
"color_temp"
|
||||
],
|
||||
"object_id":"bulb",
|
||||
"unique_id":"0x000b57fffec6a5b2_light_zigbee2mqtt"
|
||||
};
|
||||
|
||||
@@ -1982,8 +2016,9 @@ describe('HomeAssistant extension', () => {
|
||||
"enabled_by_default":false,
|
||||
"icon":"mdi:clock",
|
||||
"json_attributes_topic":"zigbee2mqtt/bulb",
|
||||
"name":"last seen",
|
||||
"name":"Last seen",
|
||||
"state_topic":"zigbee2mqtt/bulb",
|
||||
"object_id": "bulb_last_seen",
|
||||
"unique_id":"0x000b57fffec6a5b2_last_seen_zigbee2mqtt",
|
||||
"value_template":"{{ value_json.last_seen }}",
|
||||
"device_class": "timestamp",
|
||||
@@ -2014,6 +2049,7 @@ describe('HomeAssistant extension', () => {
|
||||
'value_template': "{{ value_json.temperature }}",
|
||||
'state_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'json_attributes_topic': 'zigbee2mqtt/weather_sensor',
|
||||
'object_id': 'weather_sensor_temperature',
|
||||
'unique_id': '0x0017880104e45522_temperature_zigbee2mqtt',
|
||||
'device': {
|
||||
'identifiers': ['zigbee2mqtt_0x0017880104e45522'],
|
||||
|
||||
Reference in New Issue
Block a user