mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-22 14:01:20 +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:
1 parent
5050ca0dc0
commit
bbe4f9cd5f
1 file changed
+2
-6
@@ -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