Fix for issue discussed im #198. Scene device triggers were not unique from Scenes and device_trigger /config topic was too long
This commit is contained in:
parent
e97aed904c
commit
9cf3b3bdd6
1 changed files with 3 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ const getTopicName = (
|
||||||
) => `${getBaseTopic(uniqueId, mqttDeviceType)}/${topicType}`;
|
) => `${getBaseTopic(uniqueId, mqttDeviceType)}/${topicType}`;
|
||||||
|
|
||||||
const getButtonEventTopic = (/** @type {string} */ deviceId) => `${getTopicName(deviceId, MQTT_TYPES.DEVICE_AUTOMATION, TOPIC_TYPES.STATE)}`;
|
const getButtonEventTopic = (/** @type {string} */ deviceId) => `${getTopicName(deviceId, MQTT_TYPES.DEVICE_AUTOMATION, TOPIC_TYPES.STATE)}`;
|
||||||
const getTriggerUniqueId = (/** @type { string } */ uniqueId) => `${uniqueId}_trigger`;
|
const getTriggerUniqueId = (/** @type { string } */ uniqueId) => `${uniqueId}_trig`;
|
||||||
const getSceneEventTopic = (/** @type {string} */ sceneId) => `${getTopicName(getTriggerUniqueId(sceneId), MQTT_TYPES.DEVICE_AUTOMATION, TOPIC_TYPES.STATE)}`;
|
const getSceneEventTopic = (/** @type {string} */ sceneId) => `${getTopicName(getTriggerUniqueId(sceneId), MQTT_TYPES.DEVICE_AUTOMATION, TOPIC_TYPES.STATE)}`;
|
||||||
const getSubscribePath = () => `${discoveryPrefix}/+/${nodeId}/#`;
|
const getSubscribePath = () => `${discoveryPrefix}/+/${nodeId}/#`;
|
||||||
|
|
||||||
|
|
@ -110,13 +110,13 @@ const getSceneDeviceTriggerhDiscoveryPayload = (
|
||||||
/** @type {import('./types/DeviceRegistry').OutputDevice} */ sceneDevice,
|
/** @type {import('./types/DeviceRegistry').OutputDevice} */ sceneDevice,
|
||||||
) => ({
|
) => ({
|
||||||
automation_type: 'trigger',
|
automation_type: 'trigger',
|
||||||
'~': getBaseTopic(sceneDevice.uniqueId, MQTT_TYPES.DEVICE_AUTOMATION),
|
'~': getBaseTopic(`${sceneDevice.uniqueId}_trig`, MQTT_TYPES.DEVICE_AUTOMATION),
|
||||||
qos: 1,
|
qos: 1,
|
||||||
topic: `~/${TOPIC_TYPES.STATE}`,
|
topic: `~/${TOPIC_TYPES.STATE}`,
|
||||||
type: 'scene',
|
type: 'scene',
|
||||||
subtype: 'trigger',
|
subtype: 'trigger',
|
||||||
device: {
|
device: {
|
||||||
identifiers: `${sceneDevice.uniqueId}`,
|
identifiers: `${sceneDevice.uniqueId}_trigger`,
|
||||||
manufacturer: 'Plejd',
|
manufacturer: 'Plejd',
|
||||||
model: sceneDevice.typeName,
|
model: sceneDevice.typeName,
|
||||||
name: sceneDevice.name,
|
name: sceneDevice.name,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue