This commit is contained in:
Koen Kanters
2019-08-12 19:13:18 +02:00
parent c9f56f0bbf
commit c55691daec
+11 -4
View File
@@ -137,7 +137,6 @@ class Groups {
updateDeviceGroup(ID, cmd, groupID) {
let payload = null;
const orignalCmd = cmd;
if (cmd === 'add') {
payload = {groupid: groupID, groupname: ''};
cmd = 'add';
@@ -159,10 +158,18 @@ class Groups {
logger.info(`Successfully ${cmd} ${ieeeAddr} to ${groupID}`);
// Log to MQTT
const lookup = {
'add': 'device_group_add',
'remove': 'device_group_remove',
'removeAll': 'device_group_remove_all',
};
this.mqtt.log({
device: settings.getDevice(ieeeAddr).friendly_name,
group: groupID,
action: orignalCmd,
type: lookup[cmd],
message: {
device: settings.getDevice(ieeeAddr).friendly_name,
group: groupID,
},
});
// Update group cache