mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-22 14:01:20 +00:00
Also use state converter when value is open, close, stop, lock and unlock. #4123
This commit is contained in:
1 parent
b7409295b5
commit
a20c6728b8
1 file changed
+2
-1
@@ -8,6 +8,7 @@ const Extension = require('./extension');
|
||||
const stringify = require('json-stable-stringify');
|
||||
|
||||
const topicRegex = new RegExp(`^(.+?)(?:/(${utils.getEndpointNames().join('|')}))?/(get|set)(?:/(.+))?`);
|
||||
const stateValues = ['on', 'off', 'toggle', 'open', 'close', 'stop', 'lock', 'unlock'];
|
||||
|
||||
const groupConverters = [
|
||||
zigbeeHerdsmanConverters.toZigbeeConverters.light_onoff_brightness,
|
||||
@@ -112,7 +113,7 @@ class EntityPublish extends Extension {
|
||||
try {
|
||||
json = JSON.parse(message);
|
||||
} catch (e) {
|
||||
if (['on', 'off', 'toggle'].includes(message.toLowerCase())) {
|
||||
if (stateValues.includes(message.toLowerCase())) {
|
||||
json = {state: message};
|
||||
} else {
|
||||
logger.error(`Invalid JSON '${message}', skipping...`);
|
||||
|
||||
Reference in new issue
Block a user