mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-02 10:01:37 +00:00
endpoint support for binary and numeric discovery entries (#5771)
* endpoint support for binary and numeric exposes * endpoint support for binary and numeric exposes
This commit is contained in:
@@ -319,11 +319,9 @@ class HomeAssistant extends Extension {
|
||||
presence: {device_class: 'presence'},
|
||||
};
|
||||
|
||||
assert(!expose.endpoint, `Endpoint not supported for binary type`);
|
||||
|
||||
discoveryEntry = {
|
||||
type: 'binary_sensor',
|
||||
object_id: expose.name,
|
||||
object_id: expose.endpoint ? `${expose.name}_${expose.endpoint}` : `${expose.name}`,
|
||||
discovery_payload: {
|
||||
value_template: `{{ value_json.${expose.property} }}`,
|
||||
payload_on: expose.value_on,
|
||||
@@ -364,11 +362,9 @@ class HomeAssistant extends Extension {
|
||||
local_temperature: {device_class: 'temperature'},
|
||||
};
|
||||
|
||||
assert(!expose.endpoint, `Endpoint not supported for numeric type`);
|
||||
|
||||
discoveryEntry = {
|
||||
type: 'sensor',
|
||||
object_id: expose.name,
|
||||
object_id: expose.endpoint ? `${expose.name}_${expose.endpoint}` : `${expose.name}`,
|
||||
discovery_payload: {
|
||||
unit_of_measurement: expose.unit ? expose.unit : '-',
|
||||
value_template: `{{ value_json.${expose.property} }}`,
|
||||
|
||||
Reference in New Issue
Block a user