По поводу дверного сенсора Xiaomi
Нужно три раза щёлкнуть хвостом и плюнуть через левое плечо.
Высота и азимут прыжков:
1. Advanced -> device_file: D_DoorSensor1.xml
2. Advanced -> device_json: D_DoorSensor1.json
Станет тем, кем его создали.
Далее 2 типовые проблемы:
1. Вера видит статус (переменная Status) устройства, но от секурити-сенсора ожидает tripped
2. Вера видит уровень батарей (PowerSourceLevel), но работает с BatteryLevel
Помогаем Вере избавиться от шизы:
Apps -> Develop -> Startup Lua
function updateSecurityStatus(dev_id, service, variable, oldValue, newValue)
if tonumber(oldValue) ~= tonumber(newValue) then
luup.variable_set( "urn:micasaverde-com:serviceId:SecuritySensor1", "Tripped", newValue, dev_id)
end
end
function updateBatteryLevel(dev_id, service, variable, oldValue, newValue)
if tonumber(oldValue) ~= tonumber(newValue) then
luup.variable_set( "urn:micasaverde-com:serviceId:HaDevice1", "BatteryLevel", newValue, dev_id)
end
end
luup.variable_watch("updateSecurityStatus", "urn:upnp-org:serviceId:SwitchPower1", "Status", <!!!!!!!!!!!device id!!!!!!!!!!!!!!>)
luup.variable_watch("updateBatteryLevel", "urn:micasaverde-com:serviceId:ZigbeeDevice1", "PowerSourceLevel", !!!!!!!!!!!!!!!device id!!!!!!!!!!!!!!!!!!!)
Вот и всё. Геркон Сяоми становится почти родным. Только нелья взводить (arm|disarm) из меню настройки режимов дома.