Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mqtt-ad): expose Scene Activation CC #3580

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions api/hass/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type HassDeviceKey =
| 'sound_switch'
| 'config_switch'
| 'config_number'
| 'scene_activation'

const configurations: Record<HassDeviceKey, HassDevice> = {
// Binary sensor https://www.home-assistant.io/components/binary_sensor.mqtt
Expand Down Expand Up @@ -245,6 +246,15 @@ const configurations: Record<HassDeviceKey, HassDevice> = {
entity_category: 'config',
},
},

scene_activation: {
type: 'number',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type: 'number',
type: 'sensor',

Changing the entity type to number is still a breaking change.

object_id: 'scene_activation',
discovery_payload: {
value_template: '{{ value_json.value }}',
command_topic: true,
},
},
}

export default configurations
10 changes: 10 additions & 0 deletions api/lib/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,16 @@ export default class Gateway {
cfg = this._addRgbColorSwitch(node, valueId)
} else return
break
case CommandClasses['Scene Activation']:
cfg = utils.copy(hassCfg.scene_activation)

// Combine unique Object id, by using all possible scenarios
cfg.object_id = utils.joinProps(
cfg.object_id,
valueId.property,
valueId.propertyKey,
)
break
case CommandClasses['Central Scene']:
if (!valueId.readable || valueId.writeable) {
return
Expand Down
Loading