Some configuration improvements

This commit is contained in:
Evgenii Abramov
2021-03-30 23:53:57 +03:00
parent 91eaf86b83
commit 976d997c20

148
README.md
View File

@@ -97,7 +97,7 @@ mqtt: {
host: 'localhost', host: 'localhost',
port: 1883, port: 1883,
user: 'user', user: 'user',
password: 'password' password: 'password',
}, },
``` ```
@@ -120,7 +120,7 @@ clients: [
name: 'Yandex', name: 'Yandex',
clientId: 'client', clientId: 'client',
clientSecret: 'secret', clientSecret: 'secret',
isTrusted: false isTrusted: false,
}, },
], ],
``` ```
@@ -129,16 +129,16 @@ clients: [
``` ```
users: [ users: [
{ {
id: "1", id: '1',
username: "admin", username: 'admin',
password: "admin", password: 'admin',
name: "Administrator" name: 'Administrator',
}, },
{ {
id: "2", id: '2',
username: "user1", username: 'user1',
password: "user1", password: 'user1',
name: "User" name: 'User',
}, },
], ],
``` ```
@@ -147,73 +147,125 @@ users: [
``` ```
devices: [ devices: [
{ {
id: "lvr-003-switch", id: 'haw-002-switch',
name: "Основной свет", name: 'Свет в коридоре',
room: "Гостиная", room: 'Коридор',
type: "devices.types.light", type: 'devices.types.light',
allowedUsers: ['2'],
mqtt: [ mqtt: [
{ {
instance: "on", instance: 'on',
set: "/yandex/controls/light_LvR_003/state/on", set: '/yandex/controls/light_HaW_002/on',
state: "/yandex/controls/light_LvR_003/state" state: '/yandex/controls/light_HaW_002/on/state',
}, },
], ],
/* mapping значений между yandex и УД */
valueMapping: [
{
type: "on_off",
mapping: [[false, true], [0, 1]] // [yandex, mqtt]
}
],
capabilities: [ capabilities: [
{ {
type: "devices.capabilities.on_off", type: 'devices.capabilities.on_off',
retrievable: true, retrievable: true,
}, },
], ],
}, },
{ {
id: "lvr-001-weather", id: 'lvr-003-switch',
name: "В гостиной", name: 'Основной свет',
room: "Гостиная", room: 'Гостиная',
type: "devices.types.sensor", type: 'devices.types.light',
allowedUsers: ['2'],
mqtt: [ mqtt: [
{ {
instance: "temperature", instance: 'on',
state: "/yandex/sensors/LvR_001_Weather/temperature" set: '/yandex/controls/light_LvR_003/on',
state: '/yandex/controls/light_LvR_003/on/state',
},
],
valueMapping: [
{
type: 'on_off',
mapping: [[false, true], [0, 1]], // [yandex, mqtt]
},
],
capabilities: [
{
type: 'devices.capabilities.on_off',
retrievable: true,
},
],
},
{
id: 'lvr-001-weather',
name: 'В гостиной',
room: 'Гостиная',
type: 'devices.types.sensor',
allowedUsers: ['2'],
mqtt: [
{
instance: 'temperature',
state: '/yandex/sensors/LvR_001_Weather/temperature',
}, },
{ {
instance: "humidity", instance: 'humidity',
state: "/yandex/sensors/LvR_001_Weather/humidity" state: '/yandex/sensors/LvR_001_Weather/humidity',
} },
], ],
properties: [ properties: [
{ {
type: "devices.properties.float", type: 'devices.properties.float',
retrievable: true, retrievable: true,
parameters: { parameters: {
instance: "temperature", instance: 'temperature',
unit: "unit.temperature.celsius" unit: 'unit.temperature.celsius',
}, },
}, },
{ {
type: "devices.properties.float", type: 'devices.properties.float',
retrievable: true, retrievable: true,
parameters: { parameters: {
instance: "humidity", instance: 'humidity',
unit: "unit.percent" unit: 'unit.percent',
}, },
/* Блок state указывать не обязательно */ },
state: { ],
instance: "humidity", },
value: 0
} {
} id: 'plug-001-flower',
] name: 'Розетка для цветка',
room: 'Гостиная',
type: 'devices.types.socket',
allowedUsers: ['2'],
mqtt: [
{
instance: 'on',
set: '/yandex/controls/socket_LvR_002/on',
state: '/yandex/controls/socket_LvR_002/on/state',
},
{
instance: 'power',
state: '/yandex/controls/socket_LvR_002/power',
},
],
capabilities: [
{
type: 'devices.capabilities.on_off',
retrievable: true,
},
],
properties: [
{
type: 'devices.properties.float',
retrievable: true,
parameters: {
instance: 'power',
unit: 'unit.watt',
},
},
],
}, },
/* --- end */ /* --- end */
] ],
``` ```
*Рекомендую указывать id в конфиге, чтобы исключить "наложение" новых устройств на "старые", которые уже добавлены в навык.* *Рекомендую указывать id в конфиге, чтобы исключить "наложение" новых устройств на "старые", которые уже добавлены в навык.*