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] Detail on naming - Notifications Names #98

Merged
merged 3 commits into from
Dec 21, 2020
Merged
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: 7 additions & 3 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ function deviceInfo (node, nodeName) {
function getDiscoveryTopic (hassDevice, nodeName) {
return `${hassDevice.type}/${nodeName}/${hassDevice.object_id}/config`
}

/**
* Calculate the correct template string to use for modes templates
* based on gateway settings and mapped mode values
Expand Down Expand Up @@ -1471,7 +1470,12 @@ Gateway.prototype.discoverValue = function (node, vId) {
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/zwave-js/src/lib/commandclass/NotificationCC.ts
// https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/notifications.json
cfg = copy(hassCfg.sensor_generic)
cfg.object_id = 'notification_' + valueId.property
if (valueId.propertyKey) {
cfg.object_id =
'notification_' + valueId.property + '_' + valueId.propertyKey
} else {
cfg.object_id = 'notification_' + valueId.property
}
cfg.discovery_payload.icon = 'mdi:alarm-light'
break
case CommandClasses['Multilevel Sensor']:
Expand Down Expand Up @@ -1601,7 +1605,7 @@ Gateway.prototype.discoverValue = function (node, vId) {

// Check if another value already exists and add the index to object_id to make it unique
if (node.hassDevices[cfg.type + '_' + cfg.object_id]) {
cfg.object_id += '_' + valueId.property
cfg.object_id += '_' + valueId.endpoint
}

// Set a friendly name for this component
Expand Down