-
Acute
-
-
Вне сайта
-
Администратор
-
- Сообщений: 3104
- Спасибо получено: 459
-
Репутация: 70
-
|
Я не уверен, что вообще правильно излагаюсь, называя шаблонами подгружаемые верой файлы для того или иного устройства, но выглядит это следующим образом: после включения устройства и прохождения интервью в интерфейсе появляется одно или несколько устройств, в настройках которых можно увидеть разные .xml и .json файлы. Вот раньше удавалось их немного править, чтобы заставить устройство работать нужным образом или вообще подменять. На примере глаза фибаро это выглядит так:
при включении появляется три устройства, в настройках которых можно увидеть
1. у датчика температуры файлы D_TemperatureSensor1.xml и D_TemperatureSensor1.json
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-micasaverde-com:device:TemperatureSensor:1</deviceType>
<staticJson>D_TemperatureSensor1.json</staticJson>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:TemperatureSensor:1</serviceType>
<serviceId>urn:upnp-org:serviceId:TemperatureSensor1</serviceId>
<SCPDURL>S_TemperatureSensor1.xml</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-micasaverde-com:service:HaDevice:1</serviceType>
<serviceId>urn:micasaverde-com:serviceId:HaDevice1</serviceId>
<SCPDURL>S_HaDevice1.xml</SCPDURL>
</service>
</serviceList>
<eventList>
{
"event_1":{
"label": "Temperature is reached",
"serviceId": "urn:upnp-org:serviceId:TemperatureSensor1",
"argumentList" :
{
"argument_1" :
{
"dataType": "i4",
"name": "CurrentTemperature",
"comparisson": ">",
"prefix": "temperature: ",
"suffix": " degrees"
}
}
}
}
</eventList>
</device>
</root>
{
"flashicon": "icons/Temperature_Sensor.swf",
"imgIconBody": "",
"imgIconDimmable": "",
"imgIconTurnable": "",
"imgIconMin": "",
"imgIconMax": "",
"halloIconsDir": "pics/hallo",
"x": "2",
"y": "3",
"inScene": "0",
"DisplayStatus": {
"Service": "urn:upnp-org:serviceId:TemperatureSensor1",
"Variable": "CurrentTemperature",
"MinValue": "-22",
"MaxValue": "100"
},
"doc_url": {
"doc_language": 1,
"doc_manual": 1,
"doc_version": 1,
"doc_platform": 0,
"doc_page": "sensors"
},
"Tabs": [
{
"Label": {
"lang_tag": "tabname_control",
"text": "Control"
},
"Position": "0",
"TabType": "flash",
"ControlGroup": [
{
"id": "1",
"scenegroup": "1"
}
],
"SceneGroup": [
{
"id": "1",
"top": "1.5",
"left": "0.25",
"x": "1.5",
"y": "2"
}
],
"Control": [
{
"ControlGroup": "1",
"ControlType": "label",
"top": "0",
"left": "0",
"Label": {
"lang_tag": "temperature",
"text": "Temperature"
},
"Display": {
"Top": 60,
"Left": 50,
"Width": 75,
"Height": 20
}
},
{
"ControlGroup": "1",
"ControlType": "variable",
"top": "1",
"left": "0",
"Display": {
"Service": "urn:upnp-org:serviceId:TemperatureSensor1",
"Variable": "CurrentTemperature",
"Top": 60,
"Left": 145,
"Width": 75,
"Height": 20
}
}
]
},
{
"Label": {
"lang_tag": "settings",
"text": "Settings"
},
"Position": "1",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "simple_device"
},
{
"Label": {
"lang_tag": "advanced",
"text": "Advanced"
},
"Position": "2",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "advanced_device"
},
{
"Label": {
"lang_tag": "device_options",
"text": "Device Options"
},
"Position": "3",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_zwave_options"
},
{
"Label": {
"lang_tag": "logs",
"text": "Logs"
},
"Position": "4",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_logs"
},
{
"Label": {
"lang_tag": "notifications",
"text": "Notifications"
},
"Position": "5",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_notifications"
}
],
"eventList2": [
{
"id": 1,
"label": {
"lang_tag": "temperature_goes_above",
"text": "Temperature goes above"
},
"serviceId": "urn:upnp-org:serviceId:TemperatureSensor1",
"norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "CurrentTemperature",
"comparisson": ">",
"prefix": {
"lang_tag": "temperature",
"text": "Temperature"
},
"suffix": {
"lang_tag": "degrees",
"text": "degrees"
},
"HumanFriendlyText": {
"lang_tag": "hft_temperature_goes_above",
"text": "_DEVICE_NAME_ temperature goes above _ARGUMENT_VALUE_ degrees"
}
}
]
},
{
"id": 2,
"label": {
"lang_tag": "temperature_goes_below",
"text": "Temperature goes below"
},
"serviceId": "urn:upnp-org:serviceId:TemperatureSensor1",
"norepeat": "1",
"argumentList": [
{
"id": 1,
"dataType": "i4",
"name": "CurrentTemperature",
"comparisson": "<",
"prefix": {
"lang_tag": "temperature",
"text": "Temperature"
},
"suffix": {
"lang_tag": "degrees",
"text": "degrees"
},
"HumanFriendlyText": {
"lang_tag": "hft_temperature_goes_below",
"text": "_DEVICE_NAME_ temperature goes below _ARGUMENT_VALUE_ degrees"
}
}
]
},
{
"id": 3,
"label": {
"lang_tag": "battery_level_goes_below",
"text": "Battery level goes below"
},
"serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
"argumentList": [
{
"id": 1,
"prefix": {
"lang_tag": "Level",
"text": "Level"
},
"dataType": "i4",
"name": "BatteryLevel",
"comparisson": "<",
"suffix": {
"lang_tag": "percent_sign",
"text": "%"
},
"HumanFriendlyText": {
"lang_tag": "hft_battery_level_goes_below",
"text": "Battery level for _DEVICE_NAME_ go below _ARGUMENT_VALUE_%"
}
}
]
}
],
"DeviceType": "urn:schemas-micasaverde-com:device:TemperatureSensor:1"
}
2. у датчика освещенности файлы D_LightSensor1.xml и D_LightSensor1.json
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-micasaverde-com:device:LightSensor:1</deviceType>
<staticJson>D_LightSensor1.json</staticJson>
<serviceList>
<service>
<serviceType>urn:schemas-micasaverde-com:service:LightSensor:1</serviceType>
<serviceId>urn:micasaverde-com:serviceId:LightSensor1</serviceId>
<controlURL>/upnp/control/LightSensor1</controlURL>
<eventSubURL>/upnp/event/LightSensor1</eventSubURL>
<SCPDURL>S_LightSensor1.xml</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-micasaverde-com:service:HaDevice:1</serviceType>
<serviceId>urn:micasaverde-com:serviceId:HaDevice1</serviceId>
<SCPDURL>S_HaDevice1.xml</SCPDURL>
</service>
</serviceList>
<eventList>
{
"event_1":{
"label": "Brightness reached",
"serviceId": "urn:micasaverde-com:serviceId:LightSensor1",
"argumentList" :
{
"argument_1" :
{
"dataType": "i4",
"defaultValue": "",
"name": "CurrentLevel",
"comparisson": "<,>",
"prefix": "Which level",
"suffix": ""
}
}
}
}
</eventList>
</device>
</root>
{
"flashicon": "icons\/Light_Sensor.swf",
"imgIconBody": "",
"imgIconDimmable": "",
"imgIconTurnable": "",
"imgIconMin": "",
"imgIconMax": "",
"halloIconsDir": "pics\/hallo",
"x":"2",
"y":"4",
"inScene":"0",
"DisplayStatus": {
"Service": "urn:micasaverde-com:serviceId:LightSensor1",
"Variable": "CurrentLevel",
"MinValue": "0",
"MaxValue": "100"
},
"doc_url": {
"doc_language": 1,
"doc_manual": 1,
"doc_version": 1,
"doc_platform": 0,
"doc_page": "sensors"
},
"Tabs": [
{
"Label": {
"lang_tag": "tabname_control",
"text": "Control"
},
"Position": "0",
"TabType": "flash",
"ControlGroup":[
{
"id": "1",
"scenegroup": "1"
}
],
"SceneGroup":[
{
"id": "1",
"top": "1.5",
"left": "0.25",
"x": "1.5",
"y": "2"
}
],
"Control": [
{
"ControlGroup":"1",
"ControlType": "label",
"top": "0",
"left": "0",
"Label": {
"lang_tag": "level",
"text": "Level"
},
"Display": {
"Top": 60,
"Left": 50,
"Width": 75,
"Height": 20
}
},
{
"ControlGroup":"1",
"ControlType": "variable",
"top": "1",
"left": "0",
"Display": {
"Service": "urn:micasaverde-com:serviceId:LightSensor1",
"Variable": "CurrentLevel",
"Top": 60,
"Left": 145,
"Width": 75,
"Height": 20
}
}
]
},
{
"Label": {
"lang_tag": "settings",
"text": "Settings"
},
"Position": "1",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "simple_device"
},
{
"Label": {
"lang_tag": "advanced",
"text": "Advanced"
},
"Position": "2",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "advanced_device"
},
{
"Label": {
"lang_tag": "device_options",
"text": "Device Options"
},
"Position": "3",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_zwave_options"
},
{
"Label": {
"lang_tag": "logs",
"text": "Logs"
},
"Position": "4",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_logs"
},
{
"Label": {
"lang_tag": "notifications",
"text": "Notifications"
},
"Position": "5",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_notifications"
}
],
"eventList2": [
{
"id":1,
"label": {
"lang_tag":"brightness_reached",
"text":"Brightness reached"
},
"serviceId": "urn:micasaverde-com:serviceId:LightSensor1",
"argumentList" :[
{
"id" :1,
"dataType": "i4",
"defaultValue": "",
"name": "CurrentLevel",
"comparisson": "<,>",
"prefix": {
"lang_tag":"level",
"text":"Level"
},
"suffix": {},
"HumanFriendlyText": {
"lang_tag": "hft_brightness_reached",
"text": "_DEVICE_NAME_ brightness reach _ARGUMENT_VALUE_"
}
}
]
},
{
"id": 2,
"label": {
"lang_tag": "battery_level_goes_below",
"text": "Battery level goes below"
},
"serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
"argumentList": [
{
"id": 1,
"prefix": {
"lang_tag": "Level",
"text": "Level"
},
"dataType": "i4",
"name": "BatteryLevel",
"comparisson": "<",
"suffix": {
"lang_tag": "percent_sign",
"text": "%"
},
"HumanFriendlyText": {
"lang_tag": "hft_battery_level_goes_below",
"text": "Battery level for _DEVICE_NAME_ go below _ARGUMENT_VALUE_%"
}
}
]
}
],
"DeviceType": "urn:schemas-micasaverde-com:device:LightSensor:1"
}
3. ну и у датчика движения файлы D_MotionSensor1.xml и D_MotionSensorWithTamper1.json
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-micasaverde-com:device:MotionSensor:1</deviceType>
<staticJson>D_MotionSensor1.json</staticJson>
<serviceList>
<service>
<serviceType>urn:schemas-micasaverde-com:service:SecuritySensor:1</serviceType>
<serviceId>urn:micasaverde-com:serviceId:SecuritySensor1</serviceId>
<SCPDURL>S_SecuritySensor1.xml</SCPDURL>
</service>
<service>
<serviceType>urn:schemas-micasaverde-com:service:HaDevice:1</serviceType>
<serviceId>urn:micasaverde-com:serviceId:HaDevice1</serviceId>
<SCPDURL>S_HaDevice1.xml</SCPDURL>
</service>
</serviceList>
<sceneList>
{
"group_1":{
"cmd_1":
{
"label": "Arm",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"action": "SetArmed",
"arguments":
{
"newArmedValue": "1"
}
},
"cmd_2":
{
"label": "Bypass",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"action": "SetArmed",
"arguments":
{
"newArmedValue": "0"
}
}
}
}
</sceneList>
<eventList>
{
"event_1":{
"label": "A sensor (door\/window\/motion\/etc.) is tripped",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"argumentList" :
{
"argument_1" :
{
"dataType": "boolean",
"defaultValue": "",
"allowedValueList" :
{
"Yes" : "1",
"No" : "0"
},
"name": "Tripped",
"comparisson": "=",
"prefix": "Tripped?",
"suffix": ""
}
}
},
"event_2":{
"label": "An armed sensor is tripped",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"serviceStateTable" :
{
"Armed":
{
"value": "1",
"comparisson": "="
}
},
"argumentList" :
{
"argument_1" :
{
"dataType": "boolean",
"allowedValueList" :
{
"Yes" : "1",
"No" : "0"
},
"name": "Tripped",
"comparisson": "=",
"prefix": "Tripped?",
"suffix": " "
}
}
}
}
</eventList>
</device>
</root>
{
"default_icon": "security_sensor_default.png",
"state_icons": [
{
"img": "motion_sensor_tripped.png",
"conditions": [
{
"service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"variable": "Tripped",
"operator": "==",
"value": 1,
"subcategory_num": 3
}
]
},
{
"img": "motion_sensor_untripped.png",
"conditions": [
{
"service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"variable": "Tripped",
"operator": "==",
"value": 0,
"subcategory_num": 3
}
]
}
],
"inScene": "1",
"ToggleButton": 1,
"Tabs": [
{
"Label": {
"lang_tag": "ui7_tabname_control",
"text": "Control"
},
"Position": "0",
"TabType": "flash",
"top_navigation_tab": 1,
"ControlGroup": [
{
"id": "1",
"isSingle": "1",
"scenegroup": "1"
},
{
"id": "2",
"isSingle": "1",
"scenegroup": "1"
}
],
"SceneGroup": [
{
"id": "1",
"top": "2",
"left": "0",
"x": "2",
"y": "1"
}
],
"Control": [
{
"ControlGroup": "1",
"ControlType": "multi_state_button",
"top": "0",
"left": "1",
"states": [
{
"Label": {
"lang_tag": "ui7_cmd_arm",
"text": "Armed"
},
"ControlGroup": "1",
"Display": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Variable": "Armed",
"Value": "1"
},
"Command": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Action": "SetArmed",
"Parameters": [
{
"Name": "newArmedValue",
"Value": "1"
}
]
},
"ControlCode": "arm"
},
{
"Label": {
"lang_tag": "ui7_cmd_bypass",
"text": "Disarmed"
},
"ControlGroup": "1",
"Display": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Variable": "Armed",
"Value": "0"
},
"Command": {
"Service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"Action": "SetArmed",
"Parameters": [
{
"Name": "newArmedValue",
"Value": "0"
}
]
},
"ControlCode": "bypass"
}
]
}
]
},
{
"Label": {
"lang_tag": "ui7_settings",
"text": "Settings"
},
"Position": "1",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "simple_device"
},
{
"Label": {
"lang_tag": "ui7_advanced",
"text": "Advanced"
},
"Position": "2",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "advanced_device"
},
{
"Label": {
"lang_tag": "ui7_device_options",
"text": "Device Options"
},
"Position": "3",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_zwave_options"
},
{
"Label": {
"lang_tag": "ui7_logs",
"text": "Logs"
},
"Position": "4",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_logs"
},
{
"Label": {
"lang_tag": "ui7_notifications",
"text": "Notifications"
},
"Position": "5",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_notifications"
},
{
"Label": {
"lang_tag": "ui7_device_scenes",
"text": "Scenes"
},
"Position": "6",
"TabType": "javascript",
"ScriptName": "shared.js",
"Function": "device_scenes"
}
],
"sceneList": {
"group_1": {
"cmd_1": {
"label": "Arm",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"action": "SetArmed",
"arguments": {
"newArmedValue": "1"
},
"display": {
"service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"variable": "Armed",
"value": "1"
}
},
"cmd_2": {
"label": "Bypass",
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"action": "SetArmed",
"arguments": {
"newArmedValue": "0"
},
"display": {
"service": "urn:micasaverde-com:serviceId:SecuritySensor1",
"variable": "Armed",
"value": "0"
}
}
}
},
"eventList2": [
{
"id": 1,
"label": {
"lang_tag": "ui7_an_armed_sensor_is_tripped",
"text": "Whenever _DEVICE_NAME_ is armed and detects motion"
},
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"serviceStateTable": {
"Armed": {
"value": "1",
"comparisson": "="
},
"Tripped": {
"value": "1",
"comparisson": "="
}
}
},
{
"id": 2,
"label": {
"lang_tag": "ui7_an_armed_sensor_is_not_tripped",
"text": "Whenever _DEVICE_NAME_ is armed and stops detecting motion"
},
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"serviceStateTable": {
"Armed": {
"value": "1",
"comparisson": "="
},
"Tripped": {
"value": "0",
"comparisson": "="
}
}
},
{
"id": 3,
"label": {
"lang_tag": "ui7_door_window_motion_sensor_is_tripped",
"text": "Whenever _DEVICE_NAME_ detects motion whether is armed or disarmed"
},
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"serviceStateTable": {
"Tripped": {
"value": "1",
"comparisson": "="
}
}
},
{
"id": 4,
"label": {
"lang_tag": "ui7_door_window_motion_sensor_is_not_tripped",
"text": "Whenever _DEVICE_NAME_ stops detecting motion whether is armed or disarmed"
},
"serviceId": "urn:micasaverde-com:serviceId:SecuritySensor1",
"serviceStateTable": {
"Tripped": {
"value": "0",
"comparisson": "="
}
}
},
{
"id": 5,
"label": {
"lang_tag": "ui7_battery_level_goes_below",
"text": "Battery level goes below"
},
"serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
"argumentList": [
{
"id": 1,
"prefix": {
"lang_tag": "ui7_Level",
"text": "Level"
},
"dataType": "i4",
"name": "BatteryLevel",
"comparisson": "<",
"minValue": "1",
"maxValue": "99",
"suffix": {
"lang_tag": "ui7_percent_sign",
"text": "%"
},
"HumanFriendlyText": {
"lang_tag": "ui7_hft_battery_level_goes_below",
"text": "Battery level for _DEVICE_NAME_ goes below _ARGUMENT_VALUE_%"
}
}
]
},
{
"id": 6,
"label": {
"lang_tag": "ui7_sensor_tampered",
"text": "Whenever _DEVICE_NAME_ is being tampered with"
},
"serviceId": "urn:micasaverde-com:serviceId:HaDevice1",
"serviceStateTable": {
"sl_TamperAlarm": {
"value": "1",
"comparisson": "="
}
}
}
],
"device_type": "urn:schemas-micasaverde-com:device:MotionSensor:1"
}
Каким образом вера выбирает какие файлы устройству подсовывать я не знаю, да и вообще мне все эти xml и json как свинье апельсины, но полагаю программистам то это все понятно как дважды два.
|