Skip to content

Commit

Permalink
feat: hass discovery (#20)
Browse files Browse the repository at this point in the history
* feat: bind target values to current

* feat(wip): hass discovery

* fix: better discovery support

* fix: hass socket apis

* fix: alarmType and meterType mapping

* fix: use commandClasses instead of hardCoded numbers

* refactor: better docs on methods

* fix: converted some values in hass devices.js

* fix: converted some more values in devices.js

* feat: skip discovety flag

* fix: lint issues

* fix: ignore discovery

* fix: converted some more valueIds of devices.json

* fix: lint issues

* fix: push target value in values

* fix: mode_map and fan _mode_map

* fix: allow empty json device

* fix: added ccSpecific to value meta

* fix: setpoints valueIds

* fix: commandclasses import

* fix: set defaiult endpoint to 0

* feat: added ccSpecific

* fix: undefined in num2hex

* fix: use 5.4.1-alpha.0

* fix: probably fix to map template bug

* fix: mode_map template creation

* fix: added brackets to keys

* fix: added comments

* fix: getMappedValuesTemplate check type of value

* fix: lint errors

* docs: fixed hass docs

* docs: migration and why zwavejs

* docs: bitmask and color values

* fix: lint issues

* docs: fix for review

* fix: typo

* fix: lint on readme

* docs: fix

* docs: added some points to why zwavejs section

* fix: payload parse of modes when discovery is enabled

* fix: missing ccSpecific values (#35)

* fix: binary sensors, units and undefined labels (#36)

* fix: lint issues

Co-authored-by: V Aretakis <[email protected]>
  • Loading branch information
robertsLando and varet80 authored Nov 30, 2020
1 parent 1ccab66 commit 3794e34
Show file tree
Hide file tree
Showing 11 changed files with 623 additions and 422 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CHANGELOG.md
README.md
.github/ISSUE_TEMPLATE
dist
store
store
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"wallaby.startAutomatically": true,
"[vue]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
272 changes: 130 additions & 142 deletions README.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,25 @@ app.startSocket = function (server) {
socket.on('HASS_API', async function (data) {
switch (data.apiName) {
case 'delete':
gw.publishDiscovery(data.device, data.node_id, true, true)
gw.publishDiscovery(data.device, data.nodeId, true, true)
break
case 'discover':
gw.publishDiscovery(data.device, data.node_id, false, true)
gw.publishDiscovery(data.device, data.nodeId, false, true)
break
case 'rediscoverNode':
gw.rediscoverNode(data.node_id)
gw.rediscoverNode(data.nodeId)
break
case 'disableDiscovery':
gw.disableDiscovery(data.node_id)
gw.disableDiscovery(data.nodeId)
break
case 'update':
gw.zwave.updateDevice(data.device, data.node_id)
gw.zwave.updateDevice(data.device, data.nodeId)
break
case 'add':
gw.zwave.addDevice(data.device, data.node_id)
gw.zwave.addDevice(data.device, data.nodeId)
break
case 'store':
await gw.zwave.storeDevices(data.devices, data.node_id, data.remove)
await gw.zwave.storeDevices(data.devices, data.nodeId, data.remove)
break
}
})
Expand Down
22 changes: 16 additions & 6 deletions hass/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

module.exports = {
// Binary sensor https://www.home-assistant.io/components/binary_sensor.mqtt
binary_sensor_occupancy: {
binary_sensor_motion: {
type: 'binary_sensor',
object_id: 'occupancy',
object_id: 'motion',
discovery_payload: {
payload_on: true,
payload_off: false,
Expand Down Expand Up @@ -43,9 +43,9 @@ module.exports = {
device_class: 'lock'
}
},
binary_sensor_water_leak: {
binary_sensor_water: {
type: 'binary_sensor',
object_id: 'water_leak',
object_id: 'water',
discovery_payload: {
payload_on: true,
payload_off: false,
Expand Down Expand Up @@ -73,9 +73,19 @@ module.exports = {
device_class: 'gas'
}
},
binary_sensor_carbon_monoxide: {
binary_sensor_co: {
type: 'binary_sensor',
object_id: 'carbon_monoxide',
object_id: 'co',
discovery_payload: {
payload_on: true,
payload_off: false,
value_template: '{{ value_json.value }}',
device_class: 'safety'
}
},
binary_sensor_co2: {
type: 'binary_sensor',
object_id: 'co2',
discovery_payload: {
payload_on: true,
payload_off: false,
Expand Down
Loading

0 comments on commit 3794e34

Please sign in to comment.