Skip to content

Commit

Permalink
Fix cover state in Home Assistant for multi channel cover controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Sep 12, 2022
1 parent 3f7e994 commit d38b8ff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/extension/homeassistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ export default class HomeAssistant extends Extension {

discoveryEntries.push(discoveryEntry);
} else if (firstExpose.type === 'cover') {
const state = exposes.find((expose) => expose.features.find((e) => e.name === 'state'));
const position = exposes.find((expose) => expose.features.find((e) => e.name === 'position'));
const tilt = exposes.find((expose) => expose.features.find((e) => e.name === 'tilt'));
const motorState = definitionExposes?.find((e) => e.type === 'enum' && e.name === 'motor_state' &&
Expand All @@ -385,6 +386,7 @@ export default class HomeAssistant extends Extension {
command_topic_prefix: endpoint,
command_topic: true,
state_topic: true,
value_template: `{{ value_json.${state.property} }}`,
},
};

Expand Down

0 comments on commit d38b8ff

Please sign in to comment.