Conversation
Contributor
|
We need 2 different entities for IR emitter and receiver. These entities will also require a |
Contributor
|
If the diff --git a/lib/extension/homeassistant.ts b/lib/extension/homeassistant.ts
index b1185cb0..01730a37 100644
--- a/lib/extension/homeassistant.ts
+++ b/lib/extension/homeassistant.ts
@@ -381,6 +381,10 @@ const applyHomeAssistantExposeMetadata = (payload: DiscoveryEntry, homeAssistant
payload.type = homeAssistant.type;
}
+ if (homeAssistant.property !== undefined) {
+ payload.discovery_payload.schema = homeAssistant.schema;
+ }
+
if (homeAssistant.entityCategory !== undefined) {
payload.discovery_payload.entity_category = homeAssistant.entityCategory;
}
@@ -1424,6 +1428,14 @@ export class HomeAssistant extends Extension {
delete entry.discovery_payload.entity_category;
}
+ if (entry.type === "infrared") {
+ if (entry.discovery_payload.schema === "receiver") {
+ entry.discovery_payload.value_template = "{{ value_json.learned_ir_timings | tojson }}";
+ } else {
+ delete entry.discovery_payload.value_template;
+ }
+ }
+
// Let Home Assistant generate entity name when device_class is present.
// preserve_name allows device_class and explicit name to coexist (e.g. derived sensors).
if (entry.discovery_payload.device_class && !NUMERIC_DISCOVERY_LOOKUP[firstExpose.name]?.preserve_name) {Then this could work. |
Contributor
|
This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR enables overriding the HA discovery type through
expose.withHomeAssistant(). Implemented for the use-case of @jbouwh to expose IR entities, example:The
typeoverrides the the type in the topic on which the HA discovery payload is published.CC: @MaxRink