Подключение погодной станции CWT-UWD-SDTHNPMIAP с Алиэкспресс

Хочу поделиться готовыми конфигами для погодной станции CWT-UWD-SDTHNPMIAP купленной на Алиэкспресс, может кому пригодиться. Само устройство работает нормально, только, кажется, неверно показывает скорость ветра, занижает. Но так как померить реальную нечем, то не могу утверждать это.

  1. Конфиг устройства /usr/share/wb-homa-modbus/templates/config-cwt-uwd.json
{
    "device_type": "CWT-UWD",
    "device": {
        "name": "CWT-UWD",
        "id": "cwt-uwd",
        "channels": [
            {
                "name": "Wind speed",
                "reg_type": "input",
                "address": 500,
                "type": "wind_speed",
                "format": "u16",
                "scale": 0.01,
                "error_value": "0x7FFF"
            },
            {
                "name": "Wind strength",
                "reg_type": "input",
                "address": 501,
                "type": "value",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            { 
                "name": "Wind direction",
                "reg_type": "input",
                "address": 502,
                "type": "wind_direction",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "Wind direction dg",
                "reg_type": "input",
                "address": 503,
                "type": "wind_direction_dg",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "Humidity",
                "reg_type": "input",
                "address": 504,
                "type": "rel_humidity",
                "scale": 0.1,
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "Temperature",
                "reg_type": "input",
                "address": 505,
                "type": "temperature",
                "scale": 0.1,
                "format": "s16"
            },
            {
                "name": "Noise",
                "reg_type": "input",
                "address": 506,
                "type": "noise",
                "format": "u16",
                "scale": 0.1,
                "error_value": "0x7FFF"
            },
            {
                "name": "PM2.5",
                "reg_type": "input",
                "address": 507,
                "type": "concentration",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "PM10",
                "reg_type": "input",
                "address": 508,
                "type": "concentration",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "Atmospheric pressure",
                "reg_type": "input",
                "address": 509,
                "type": "atmospheric_pressure_kpa",
                "format": "u16",
                "scale": 0.1,
                "error_value": "0x7FFF"
            },
            {
                "name": "Illuminance (0-200000 Lux) high 16 byte",
                "reg_type": "input",
                "address": 510,
                "type": "lux",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "Illuminance (0-200000 Lux) low 16 byte",
                "reg_type": "input",
                "address": 511,
                "type": "lux",
                "format": "u16",
                "error_value": "0x7FFF"
            },
            {
                "name": "Illuminance (0-200000 Lux)",
                "reg_type": "input",
                "address": 512,
                "type": "lux",
                "format": "u16",
                "scale": 100,
                "error_value": "0x7FFF"
            }
        ]
    }
}

config-cwt-uwd.json (3.5 КБ)

Далее для правильного отображения в интерфейсе

  1. В файл /var/www/views/widgets/templates/control-value.html нужно добавить недостающие строки
<span ng-switch-when="temperature">°C</span>
<span ng-switch-when="rel_humidity">%, RH</span>
<span ng-switch-when="atmospheric_pressure">millibar (100 Pa)</span>
<span ng-switch-when="atmospheric_pressure_kpa">kPa</span>
<span ng-switch-when="rainfall">mm/h</span>
<span ng-switch-when="wind_speed">m/s</span>
<span ng-switch-when="wind_direction_"></span>
<span ng-switch-when="wind_direction_dg">°</span>
<span ng-switch-when="noise">dB</span>
<span ng-switch-when="water_flow">m<sup>3</sup> / h</span>
<span ng-switch-when="water_consumption">m<sup>3</sup></span>
<span ng-switch-when="resistance"> Ohm</span>
<span ng-switch-when="concentration">ppm</span>
<span ng-switch-when="lux">lux</span> 

control-value.html (1.0 КБ)

  1. В файл /var/www/views/devices/device-control.html нужно добавить недостающие строки
<div control-switch ng-switch-when="switch"></div>
<div control-value ng-switch-when="temperature"></div>
<div control-value ng-switch-when="rel_humidity"></div>
<div control-value ng-switch-when="atmospheric_pressure"></div>
<div control-value ng-switch-when="atmospheric_pressure_kpa"></div>
<div control-value ng-switch-when="rainfall"></div>
<div control-value ng-switch-when="wind_speed"></div>
<div control-value ng-switch-when="wind_direction"></div>
<div control-value ng-switch-when="wind_direction_dg"></div>
<div control-value ng-switch-when="noise"></div>
<div control-value ng-switch-when="water_flow"></div>
<div control-value ng-switch-when="water_consumption"></div>
<div control-value ng-switch-when="resistance"></div>
<div control-value ng-switch-when="concentration"></div>
<div control-value ng-switch-when="lux"></div>

device-control.html (1.4 КБ)

  1. В файл /var/www/views/devices/controls/control-value.html нужно добавить недостающие строки
<span class="control-value" ng-switch-when="temperature">{{control.value}} &deg;C</span>
<span class="control-value" ng-switch-when="rel_humidity">{{control.value}} % RH</span>
<span class="control-value" ng-switch-when="atmospheric_pressure">{{control.value}} mbar</span>
<span class="control-value" ng-switch-when="atmospheric_pressure_kpa">{{control.value}} kPa</span>
<span class="control-value" ng-switch-when="rainfall">{{control.value}} mm/h</span>
<span class="control-value" ng-switch-when="wind_speed">{{control.value}} m/s</span>
<span class="control-value" ng-switch-when="wind_direction">{{control.value}}</span>
<span class="control-value" ng-switch-when="wind_direction_dg">{{control.value}} &deg;</span>
<span class="control-value" ng-switch-when="noise">{{control.value}} dB</span>
<span class="control-value" ng-switch-when="water_flow">{{control.value}} m<sup>3</sup>/s</span>
<span class="control-value" ng-switch-when="water_consumption">{{control.value}} m<sup>3</sup></span>
<span class="control-value" ng-switch-when="resistance">{{control.value}} Ohm</span>
<span class="control-value" ng-switch-when="concentration">{{control.value}} ppm</span>
<span class="control-value" ng-switch-when="lux">{{control.value}} lux</span>

control-value.html (2.0 КБ)

2 Likes

Прямо хорошо. Судя по путям - это WB5 со старым-старым ПО? Сейчас единицы измерения (units) чуть по другому работают, но шаблон - отличный.

Нет, это вообще WB4. :upside_down_face: Но имея основу проще переделать, поэтому может кому то пригодиться!

1 Like