Skip to content

Commit

Permalink
feat: Parse lock/unlock payloads coming from hass #294
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Mar 4, 2020
1 parent a45900a commit 30f5b35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ Gateway.prototype.parsePayload = function (payload, valueId, valueConf) {
if (this.discovered[valueId.value_id]) {
// parse payload for switchs
if ((valueId.type === 'bool' || this.discovered[valueId.value_id].object_id === 'rgb_dimmer') && typeof payload === 'string') {
if (/\btrue\b|\bon\b/gi.test(payload)) payload = true
else if (/\bfalse\b|\boff\b/gi.test(payload)) payload = false
if (/\btrue\b|\bon\b|\block\b/gi.test(payload)) payload = true
else if (/\bfalse\b|\boff\b|\bunlock\b/gi.test(payload)) payload = false
}

if (this.discovered[valueId.value_id].object_id === 'rgb_dimmer') {
Expand Down

0 comments on commit 30f5b35

Please sign in to comment.