mirror of
https://github.com/lasthead0/yandex2mqtt.git
synced 2025-08-08 09:01:00 +03:00
test
This commit is contained in:
@@ -34,13 +34,15 @@ class Device {
|
||||
room: options.room || '',
|
||||
type: options.type || 'devices.types.light',
|
||||
custom_data: {
|
||||
allowedUsers: options.allowedUsers || [1],
|
||||
mqtt: options.mqtt || [],
|
||||
valueMapping: options.valueMapping || [],
|
||||
},
|
||||
capabilities: (options.capabilities || []).map(c => Object.assign({}, c, {state: (c.state == undefined) ? this.initState(c) : c.state})),
|
||||
properties: (options.properties || []).map(p => Object.assign({}, p, {state: (p.state == undefined) ? this.initState(p) : p.state}))
|
||||
}
|
||||
properties: (options.properties || []).map(p => Object.assign({}, p, {state: (p.state == undefined) ? this.initState(p) : p.state})),
|
||||
};
|
||||
this.meta = {
|
||||
allowedUsers: options.allowedUsers || [1],
|
||||
};
|
||||
}
|
||||
|
||||
/* Create init state (for capabilities and properties) on device object create */
|
||||
|
@@ -35,8 +35,7 @@ module.exports.devices = [
|
||||
};
|
||||
|
||||
for (const d of global.devices) {
|
||||
console.log(d);
|
||||
const {allowedUsers} = d.custom_data;
|
||||
const {allowedUsers} = d.meta;
|
||||
if (Array.isArray(allowedUsers) && allowedUsers.indexOf(userId)) {
|
||||
console.log(d.getInfo());
|
||||
r.payload.devices.push(d.getInfo());
|
||||
|
Reference in New Issue
Block a user