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