mirror of
https://github.com/lasthead0/yandex2mqtt.git
synced 2025-08-07 16:50:30 +03:00
Some configuration improvements
This commit is contained in:
232
README.md
232
README.md
@@ -94,10 +94,10 @@ module.exports = {
|
||||
Указать данные Вашего MQTT сервера
|
||||
```
|
||||
mqtt: {
|
||||
host: 'localhost',
|
||||
port: 1883,
|
||||
user: 'user',
|
||||
password: 'password'
|
||||
host: 'localhost',
|
||||
port: 1883,
|
||||
user: 'user',
|
||||
password: 'password',
|
||||
},
|
||||
```
|
||||
|
||||
@@ -115,105 +115,157 @@ https: {
|
||||
Здесь используются произвольные данные, далее они понадобятся для подключения к УД Yandex.
|
||||
```
|
||||
clients: [
|
||||
{
|
||||
id: '1',
|
||||
name: 'Yandex',
|
||||
clientId: 'client',
|
||||
clientSecret: 'secret',
|
||||
isTrusted: false
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
name: 'Yandex',
|
||||
clientId: 'client',
|
||||
clientSecret: 'secret',
|
||||
isTrusted: false,
|
||||
},
|
||||
],
|
||||
```
|
||||
|
||||
###### Блок настройки пользователей
|
||||
```
|
||||
users: [
|
||||
{
|
||||
id: "1",
|
||||
username: "admin",
|
||||
password: "admin",
|
||||
name: "Administrator"
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
username: "user1",
|
||||
password: "user1",
|
||||
name: "User"
|
||||
},
|
||||
{
|
||||
id: '1',
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
name: 'Administrator',
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
username: 'user1',
|
||||
password: 'user1',
|
||||
name: 'User',
|
||||
},
|
||||
],
|
||||
```
|
||||
|
||||
###### Блок настройки устройств
|
||||
```
|
||||
devices: [
|
||||
{
|
||||
id: "lvr-003-switch",
|
||||
name: "Основной свет",
|
||||
room: "Гостиная",
|
||||
type: "devices.types.light",
|
||||
mqtt: [
|
||||
{
|
||||
instance: "on",
|
||||
set: "/yandex/controls/light_LvR_003/state/on",
|
||||
state: "/yandex/controls/light_LvR_003/state"
|
||||
},
|
||||
],
|
||||
/* mapping значений между yandex и УД */
|
||||
valueMapping: [
|
||||
{
|
||||
type: "on_off",
|
||||
mapping: [[false, true], [0, 1]] // [yandex, mqtt]
|
||||
}
|
||||
],
|
||||
capabilities: [
|
||||
{
|
||||
type: "devices.capabilities.on_off",
|
||||
retrievable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'haw-002-switch',
|
||||
name: 'Свет в коридоре',
|
||||
room: 'Коридор',
|
||||
type: 'devices.types.light',
|
||||
allowedUsers: ['2'],
|
||||
mqtt: [
|
||||
{
|
||||
instance: 'on',
|
||||
set: '/yandex/controls/light_HaW_002/on',
|
||||
state: '/yandex/controls/light_HaW_002/on/state',
|
||||
},
|
||||
],
|
||||
capabilities: [
|
||||
{
|
||||
type: 'devices.capabilities.on_off',
|
||||
retrievable: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
id: "lvr-001-weather",
|
||||
name: "В гостиной",
|
||||
room: "Гостиная",
|
||||
type: "devices.types.sensor",
|
||||
mqtt: [
|
||||
{
|
||||
instance: "temperature",
|
||||
state: "/yandex/sensors/LvR_001_Weather/temperature"
|
||||
},
|
||||
{
|
||||
instance: "humidity",
|
||||
state: "/yandex/sensors/LvR_001_Weather/humidity"
|
||||
}
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
type: "devices.properties.float",
|
||||
retrievable: true,
|
||||
parameters: {
|
||||
instance: "temperature",
|
||||
unit: "unit.temperature.celsius"
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "devices.properties.float",
|
||||
retrievable: true,
|
||||
parameters: {
|
||||
instance: "humidity",
|
||||
unit: "unit.percent"
|
||||
},
|
||||
/* Блок state указывать не обязательно */
|
||||
state: {
|
||||
instance: "humidity",
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
/* --- end */
|
||||
]
|
||||
{
|
||||
id: 'lvr-003-switch',
|
||||
name: 'Основной свет',
|
||||
room: 'Гостиная',
|
||||
type: 'devices.types.light',
|
||||
allowedUsers: ['2'],
|
||||
mqtt: [
|
||||
{
|
||||
instance: 'on',
|
||||
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',
|
||||
state: '/yandex/sensors/LvR_001_Weather/humidity',
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
type: 'devices.properties.float',
|
||||
retrievable: true,
|
||||
parameters: {
|
||||
instance: 'temperature',
|
||||
unit: 'unit.temperature.celsius',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'devices.properties.float',
|
||||
retrievable: true,
|
||||
parameters: {
|
||||
instance: 'humidity',
|
||||
unit: 'unit.percent',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
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 */
|
||||
],
|
||||
```
|
||||
*Рекомендую указывать id в конфиге, чтобы исключить "наложение" новых устройств на "старые", которые уже добавлены в навык.*
|
||||
|
||||
|
Reference in New Issue
Block a user