wb_editors
131
правка
Строка 162: | Строка 162: | ||
====Пример с датчиком Вега ТД-11==== | ====Пример с датчиком Вега ТД-11==== | ||
<syntaxhighlight lang="json"> | <syntaxhighlight lang="json"> | ||
defineVirtualDevice('lora-device', { | defineVirtualDevice('lora-device', { | ||
title: ' | title: 'Vega DT11' , | ||
cells: { | cells: { | ||
temperature: { | |||
title: " | title: "Temperature", | ||
type: "value", | type: "value", | ||
value: "0", | value: "0", | ||
units:" | units:"deg C", | ||
scale:0.1 | |||
}, | |||
battery:{ | |||
title: "Battery", | |||
type: "range", | |||
value: "0", | |||
readonly:true | |||
} | } | ||
} | } | ||
}); | }); | ||
trackMqtt("/Lavritech_L1/ | trackMqtt("/Lavritech_L1/lors0102", function(message) { | ||
dev["lora-device/ | dev["lora-device/battery"]=Number(message.value); | ||
}); | |||
trackMqtt("/Lavritech_L1/lors0105", function(message) { | |||
dev["lora-device/temperature"]=Number(message.value); | |||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> | ||