@deconz-community/ddf-validator 2.12.1 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ddf-schema.json +1 -1
- package/dist/ddf-validator.cjs +1 -1
- package/dist/ddf-validator.d.ts +2 -2
- package/dist/ddf-validator.mjs +170 -144
- package/package.json +1 -1
package/dist/ddf-schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$ref":"#/definitions/DDF","definitions":{"DDF":{"anyOf":[{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"devcap1.schema.json"},"uuid":{"type":"string"},"version":{"type":"string"},"version_deconz":{"type":"string"},"doc:path":{"type":"string"},"doc:hdr":{"type":"string"},"md:known_issues":{"type":"array","items":{"type":"string"},"description":"Know issues for this device, markdown file."},"manufacturername":{"anyOf":[{"type":"string","enum":["$MF_BOSCH","$MF_IKEA","$MF_LUMI","$MF_LUTRON","$MF_PHILIPS","$MF_SAMJIN","$MF_SIGNIFY","$MF_TUYA","$MF_XIAOMI"]},{"type":"string","pattern":"^(?!\\$MF_).*"},{"type":"array","items":{"anyOf":[{"type":"string","enum":["$MF_BOSCH","$MF_IKEA","$MF_LUMI","$MF_LUTRON","$MF_PHILIPS","$MF_SAMJIN","$MF_SIGNIFY","$MF_TUYA","$MF_XIAOMI"]},{"type":"string","pattern":"^(?!\\$MF_).*"}]}}],"description":"Manufacturer name from Basic Cluster."},"modelid":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Model ID from Basic Cluster."},"vendor":{"type":"string","description":"Friendly name of the manufacturer."},"comment":{"type":"string"},"matchexpr":{"type":"string","description":"Need to return true for the DDF be used."},"path":{"type":"string","description":"DDF path, useless, can be removed."},"product":{"type":"string","description":"Complements the model id to be shown in the UI."},"sleeper":{"type":"boolean","description":"Sleeping devices can only receive when awake."},"supportsMgmtBind":{"type":"boolean"},"status":{"type":"string","enum":["Draft","Bronze","Silver","Gold"],"description":"The code quality of the DDF file."},"subdevices":{"type":"array","items":{"type":"object","properties":{"type":{"anyOf":[{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_CARBONDIOXIDE_SENSOR","$TYPE_FORMALDEHYDE_SENSOR","$TYPE_PARTICULATEMATTER_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_MOISTURE_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_LIGHT_SWITCH","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$TYPE_ON_OFF_SWITCH","$TYPE_OPEN_CLOSE_SENSOR","$TYPE_POWER_SENSOR","$TYPE_PRESENCE_SENSOR","$TYPE_PRESSURE_SENSOR","$TYPE_RANGE_EXTENDER","$TYPE_RELATIVE_ROTARY","$TYPE_SMART_PLUG","$TYPE_SPECTRAL_SENSOR","$TYPE_SWITCH","$TYPE_TEMPERATURE_SENSOR","$TYPE_THERMOSTAT","$TYPE_VIBRATION_SENSOR","$TYPE_WARNING_DEVICE","$TYPE_WATER_LEAK_SENSOR","$TYPE_WINDOW_COVERING_DEVICE","$TYPE_ZGP_SWITCH"]},{"type":"string","pattern":"^(?!\\$TYPE_).*"}]},"restapi":{"type":"string","enum":["/lights","/sensors"]},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}]}]},"fingerprint":{"type":"object","properties":{"profile":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"device":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"endpoint":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}]},"in":{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}},"out":{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}},"required":["profile","device","endpoint"],"additionalProperties":false},"meta":{"type":"object","properties":{"values":{},"group.endpoints":{"type":"array","items":{"type":"number"}}},"additionalProperties":false},"buttons":{},"buttonevents":{},"items":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"],"description":"Data type of the item."},"access":{"type":"string","enum":["R","W","RW"],"description":"Access mode for this item, some of them are not editable."},"public":{"type":"boolean","description":"Item visible on the API."},"implicit":{"type":"boolean","description":"TODO: What is this ?"},"managed":{"type":"boolean","description":"TODO: What is this ?"},"awake":{"type":"boolean","description":"The device is considered awake when this item is set due a incoming command."},"static":{"type":["string","number","boolean"],"description":"A static default value is fixed and can be not changed."},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}],"description":"Values range limit."},"virtual":{"type":"boolean","description":"TODO: What is this ?"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."}},"required":["at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to read all Tuya datapoints. It has no parameters."}},"required":["fn"],"additionalProperties":false}],"description":"Fonction used to read value."},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus","description":"Generic function to parse IAS ZONE status change notifications or zone status from read/report command."},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}],"description":"Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr","description":"Generic function to to convert number to string."},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"],"description":"The source item holding the number."},"op":{"type":"string","enum":["lt","le","eq","gt","ge"],"description":"Comparison operator (lt | le | eq | gt | ge)"},"to":{"description":"Array of (num, string) mappings"}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time","description":"Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special","description":"Generic function to parse custom Xiaomi attributes and commands."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"},"idx":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"A 8-bit string hex value."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to parse Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid"],"additionalProperties":false}],"description":"Fonction used to parse incoming values."},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to write Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid","dt"],"additionalProperties":false}],"description":"Fonction used to write value."},"refresh.interval":{"type":"number","description":"Refresh interval used for read fonction, NEED to be superior at value used in binding part."},"values":{"description":"TODO: What is this ?"},"default":{"description":"Defaut value."},"name":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"],"description":"Item name."}},"required":["name"],"additionalProperties":false}},"example":{}},"required":["type","restapi","uuid","items"],"additionalProperties":false},"description":"Devices section."},"bindings":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"bind":{"type":"string","const":"unicast"},"src.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Source endpoint."},"dst.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Destination endpoint, generaly 0x01."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster."},"report":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"min":{"type":"number"},"max":{"type":"number"},"change":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]+$"},{"type":"number"}]}},"required":["at","dt","min","max"],"additionalProperties":false}}},"required":["bind","src.ep","cl"],"additionalProperties":false},{"type":"object","properties":{"bind":{"type":"string","const":"groupcast"},"src.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Source endpoint."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster."},"config.group":{"type":"number","minimum":0,"maximum":255}},"required":["bind","src.ep","cl","config.group"],"additionalProperties":false}]},"description":"Bindings section."}},"required":["schema","manufacturername","modelid","status","subdevices"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants1.schema.json"},"manufacturers":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$MF\\_"}},"device-types":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$TYPE\\_"}}},"required":["schema","manufacturers","device-types"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants2.schema.json"}},"required":["schema"],"additionalProperties":true},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"resourceitem1.schema.json"},"id":{"type":"string"},"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"],"description":"Data type of the item."},"access":{"type":"string","enum":["R","W","RW"],"description":"Access mode for this item, some of them are not editable."},"public":{"type":"boolean","description":"Item visible on the API."},"implicit":{"type":"boolean","description":"TODO: What is this ?"},"managed":{"type":"boolean","description":"TODO: What is this ?"},"awake":{"type":"boolean","description":"The device is considered awake when this item is set due a incoming command."},"static":{"type":["string","number","boolean"],"description":"A static default value is fixed and can be not changed."},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}],"description":"Values range limit."},"virtual":{"type":"boolean","description":"TODO: What is this ?"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."}},"required":["at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to read all Tuya datapoints. It has no parameters."}},"required":["fn"],"additionalProperties":false}],"description":"Fonction used to read value."},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus","description":"Generic function to parse IAS ZONE status change notifications or zone status from read/report command."},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}],"description":"Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr","description":"Generic function to to convert number to string."},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"],"description":"The source item holding the number."},"op":{"type":"string","enum":["lt","le","eq","gt","ge"],"description":"Comparison operator (lt | le | eq | gt | ge)"},"to":{"description":"Array of (num, string) mappings"}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time","description":"Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special","description":"Generic function to parse custom Xiaomi attributes and commands."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"},"idx":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"A 8-bit string hex value."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to parse Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid"],"additionalProperties":false}],"description":"Fonction used to parse incoming values."},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to write Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid","dt"],"additionalProperties":false}],"description":"Fonction used to write value."},"refresh.interval":{"type":"number","description":"Refresh interval used for read fonction, NEED to be superior at value used in binding part."},"values":{"description":"TODO: What is this ?"},"default":{"description":"Defaut value."}},"required":["schema","id"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"subdevice1.schema.json"},"type":{"anyOf":[{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_CARBONDIOXIDE_SENSOR","$TYPE_FORMALDEHYDE_SENSOR","$TYPE_PARTICULATEMATTER_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_MOISTURE_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_LIGHT_SWITCH","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$TYPE_ON_OFF_SWITCH","$TYPE_OPEN_CLOSE_SENSOR","$TYPE_POWER_SENSOR","$TYPE_PRESENCE_SENSOR","$TYPE_PRESSURE_SENSOR","$TYPE_RANGE_EXTENDER","$TYPE_RELATIVE_ROTARY","$TYPE_SMART_PLUG","$TYPE_SPECTRAL_SENSOR","$TYPE_SWITCH","$TYPE_TEMPERATURE_SENSOR","$TYPE_THERMOSTAT","$TYPE_VIBRATION_SENSOR","$TYPE_WARNING_DEVICE","$TYPE_WATER_LEAK_SENSOR","$TYPE_WINDOW_COVERING_DEVICE","$TYPE_ZGP_SWITCH"]},{"type":"string","pattern":"^(?!\\$TYPE_).*"}]},"name":{"type":"string"},"restapi":{"type":"string","enum":["/lights","/sensors"]},"order":{"type":"number"},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}]}]},"items":{"type":"array","items":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"]}},"items_optional":{"type":"array","items":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"]}}},"required":["schema","type","name","restapi","order","uuid","items"],"additionalProperties":false}]}},"$schema":"http://json-schema.org/draft-07/schema#"}
|
|
1
|
+
{"$ref":"#/definitions/DDF","definitions":{"DDF":{"anyOf":[{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"devcap1.schema.json"},"uuid":{"type":"string"},"version":{"type":"string"},"version_deconz":{"type":"string"},"doc:path":{"type":"string"},"doc:hdr":{"type":"string"},"md:known_issues":{"type":"array","items":{"type":"string"},"description":"Know issues for this device, markdown file."},"manufacturername":{"anyOf":[{"type":"string","enum":["$MF_BOSCH","$MF_IKEA","$MF_LUMI","$MF_LUTRON","$MF_PHILIPS","$MF_SAMJIN","$MF_SIGNIFY","$MF_TUYA","$MF_XIAOMI"]},{"type":"string","pattern":"^(?!\\$MF_).*"},{"type":"array","items":{"anyOf":[{"type":"string","enum":["$MF_BOSCH","$MF_IKEA","$MF_LUMI","$MF_LUTRON","$MF_PHILIPS","$MF_SAMJIN","$MF_SIGNIFY","$MF_TUYA","$MF_XIAOMI"]},{"type":"string","pattern":"^(?!\\$MF_).*"}]}}],"description":"Manufacturer name from Basic Cluster."},"modelid":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"Model ID from Basic Cluster."},"vendor":{"type":"string","description":"Friendly name of the manufacturer."},"comment":{"type":"string"},"matchexpr":{"type":"string","description":"Need to return true for the DDF be used."},"path":{"type":"string","description":"DDF path, useless, can be removed."},"product":{"type":"string","description":"Complements the model id to be shown in the UI."},"sleeper":{"type":"boolean","description":"Sleeping devices can only receive when awake."},"supportsMgmtBind":{"type":"boolean"},"status":{"type":"string","enum":["Draft","Bronze","Silver","Gold"],"description":"The code quality of the DDF file."},"subdevices":{"type":"array","items":{"type":"object","properties":{"type":{"anyOf":[{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_CARBONDIOXIDE_SENSOR","$TYPE_FORMALDEHYDE_SENSOR","$TYPE_PARTICULATEMATTER_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_ANCILLARY_CONTROL","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LEVEL_CONTROL_SWITCH","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_MOISTURE_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_LIGHT_SWITCH","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$TYPE_ON_OFF_SWITCH","$TYPE_OPEN_CLOSE_SENSOR","$TYPE_POWER_SENSOR","$TYPE_PRESENCE_SENSOR","$TYPE_PRESSURE_SENSOR","$TYPE_RANGE_EXTENDER","$TYPE_RELATIVE_ROTARY","$TYPE_SMART_PLUG","$TYPE_SPECTRAL_SENSOR","$TYPE_SWITCH","$TYPE_TEMPERATURE_SENSOR","$TYPE_THERMOSTAT","$TYPE_TIME","$TYPE_VIBRATION_SENSOR","$TYPE_WARNING_DEVICE","$TYPE_WATER_LEAK_SENSOR","$TYPE_WINDOW_COVERING_DEVICE","$TYPE_ZGP_SWITCH"]},{"type":"string","pattern":"^(?!\\$TYPE_).*"}]},"restapi":{"type":"string","enum":["/lights","/sensors"]},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}]}]},"fingerprint":{"type":"object","properties":{"profile":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"device":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"endpoint":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}]},"in":{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}},"out":{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}},"required":["profile","device","endpoint"],"additionalProperties":false},"meta":{"type":"object","properties":{"values":{},"group.endpoints":{"type":"array","items":{"type":"number"}}},"additionalProperties":false},"buttons":{},"buttonevents":{},"items":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"],"description":"Data type of the item."},"access":{"type":"string","enum":["R","W","RW"],"description":"Access mode for this item, some of them are not editable."},"public":{"type":"boolean","description":"Item visible on the API."},"implicit":{"type":"boolean","description":"TODO: What is this ?"},"managed":{"type":"boolean","description":"TODO: What is this ?"},"awake":{"type":"boolean","description":"The device is considered awake when this item is set due a incoming command."},"static":{"type":["string","number","boolean"],"description":"A static default value is fixed and can be not changed."},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}],"description":"Values range limit."},"virtual":{"type":"boolean","description":"TODO: What is this ?"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."}},"required":["at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to read all Tuya datapoints. It has no parameters."}},"required":["fn"],"additionalProperties":false}],"description":"Fonction used to read value."},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus","description":"Generic function to parse IAS ZONE status change notifications or zone status from read/report command."},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}],"description":"Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr","description":"Generic function to to convert number to string."},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"],"description":"The source item holding the number."},"op":{"type":"string","enum":["lt","le","eq","gt","ge"],"description":"Comparison operator (lt | le | eq | gt | ge)"},"to":{"description":"Array of (num, string) mappings"}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time","description":"Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special","description":"Generic function to parse custom Xiaomi attributes and commands."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"},"idx":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"A 8-bit string hex value."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to parse Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid"],"additionalProperties":false}],"description":"Fonction used to parse incoming values."},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to write Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid","dt"],"additionalProperties":false}],"description":"Fonction used to write value."},"refresh.interval":{"type":"number","description":"Refresh interval used for read fonction, NEED to be superior at value used in binding part."},"values":{"description":"TODO: What is this ?"},"default":{"description":"Defaut value."},"name":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"],"description":"Item name."}},"required":["name"],"additionalProperties":false}},"example":{}},"required":["type","restapi","uuid","items"],"additionalProperties":false},"description":"Devices section."},"bindings":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"bind":{"type":"string","const":"unicast"},"src.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Source endpoint."},"dst.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Destination endpoint, generaly 0x01."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster."},"report":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"min":{"type":"number"},"max":{"type":"number"},"change":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]+$"},{"type":"number"}]}},"required":["at","dt","min","max"],"additionalProperties":false}}},"required":["bind","src.ep","cl"],"additionalProperties":false},{"type":"object","properties":{"bind":{"type":"string","const":"groupcast"},"src.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Source endpoint."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster."},"config.group":{"type":"number","minimum":0,"maximum":255}},"required":["bind","src.ep","cl","config.group"],"additionalProperties":false}]},"description":"Bindings section."}},"required":["schema","manufacturername","modelid","status","subdevices"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants1.schema.json"},"manufacturers":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$MF\\_"}},"device-types":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$TYPE\\_"}}},"required":["schema","manufacturers","device-types"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants2.schema.json"}},"required":["schema"],"additionalProperties":true},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"resourceitem1.schema.json"},"id":{"type":"string"},"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"],"description":"Data type of the item."},"access":{"type":"string","enum":["R","W","RW"],"description":"Access mode for this item, some of them are not editable."},"public":{"type":"boolean","description":"Item visible on the API."},"implicit":{"type":"boolean","description":"TODO: What is this ?"},"managed":{"type":"boolean","description":"TODO: What is this ?"},"awake":{"type":"boolean","description":"The device is considered awake when this item is set due a incoming command."},"static":{"type":["string","number","boolean"],"description":"A static default value is fixed and can be not changed."},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}],"description":"Values range limit."},"virtual":{"type":"boolean","description":"TODO: What is this ?"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."}},"required":["at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to read all Tuya datapoints. It has no parameters."}},"required":["fn"],"additionalProperties":false}],"description":"Fonction used to read value."},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus","description":"Generic function to parse IAS ZONE status change notifications or zone status from read/report command."},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}],"description":"Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr","description":"Generic function to to convert number to string."},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"],"description":"The source item holding the number."},"op":{"type":"string","enum":["lt","le","eq","gt","ge"],"description":"Comparison operator (lt | le | eq | gt | ge)"},"to":{"description":"Array of (num, string) mappings"}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time","description":"Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special","description":"Generic function to parse custom Xiaomi attributes and commands."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"},"idx":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"A 8-bit string hex value."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to parse Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid"],"additionalProperties":false}],"description":"Fonction used to parse incoming values."},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to write Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid","dt"],"additionalProperties":false}],"description":"Fonction used to write value."},"refresh.interval":{"type":"number","description":"Refresh interval used for read fonction, NEED to be superior at value used in binding part."},"values":{"description":"TODO: What is this ?"},"default":{"description":"Defaut value."}},"required":["schema","id"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"subdevice1.schema.json"},"type":{"anyOf":[{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_CARBONDIOXIDE_SENSOR","$TYPE_FORMALDEHYDE_SENSOR","$TYPE_PARTICULATEMATTER_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_ANCILLARY_CONTROL","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LEVEL_CONTROL_SWITCH","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_MOISTURE_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_LIGHT_SWITCH","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$TYPE_ON_OFF_SWITCH","$TYPE_OPEN_CLOSE_SENSOR","$TYPE_POWER_SENSOR","$TYPE_PRESENCE_SENSOR","$TYPE_PRESSURE_SENSOR","$TYPE_RANGE_EXTENDER","$TYPE_RELATIVE_ROTARY","$TYPE_SMART_PLUG","$TYPE_SPECTRAL_SENSOR","$TYPE_SWITCH","$TYPE_TEMPERATURE_SENSOR","$TYPE_THERMOSTAT","$TYPE_TIME","$TYPE_VIBRATION_SENSOR","$TYPE_WARNING_DEVICE","$TYPE_WATER_LEAK_SENSOR","$TYPE_WINDOW_COVERING_DEVICE","$TYPE_ZGP_SWITCH"]},{"type":"string","pattern":"^(?!\\$TYPE_).*"}]},"name":{"type":"string"},"restapi":{"type":"string","enum":["/lights","/sensors"]},"order":{"type":"number"},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}]}]},"items":{"type":"array","items":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"]}},"items_optional":{"$ref":"#/definitions/DDF/anyOf/4/properties/items"}},"required":["schema","type","name","restapi","order","uuid","items"],"additionalProperties":false}]}},"$schema":"http://json-schema.org/draft-07/schema#"}
|
package/dist/ddf-validator.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),D="2.12.1",g={"devcap1.schema.json":[O,E,T,w,_],"constants2.schema.json":[$]};function O(t,r,f){const o=typeof t.manufacturername=="string"&&typeof t.modelid=="string";if(o)return;const c=Array.isArray(t.manufacturername)&&Array.isArray(t.modelid);if(c&&t.manufacturername.length!==t.modelid.length){r.addIssue({code:e.z.ZodIssueCode.invalid_intersection_types,message:"When 'manufacturername' and 'modelid' are both arrays they should be the same length",path:["manufacturername","modelid"]});return}(o||c)===!1&&r.addIssue({code:e.z.ZodIssueCode.invalid_intersection_types,message:"Invalid properties 'manufacturername' and 'modelid' should have the same type",path:["manufacturername","modelid"]})}function E(t,r,f){if(!t.bindings)return;const o=n=>`0x${(typeof n=="number"?n:Number.parseInt(n,16)).toString(16)}`,c={};t.bindings.forEach(n=>{n.bind==="unicast"&&n.report&&n.report.forEach(s=>{s.max!==65535&&(c[`${o(n["src.ep"])}.${o(n.cl)}.${o(s.at)}`]=s.max)})}),t.subdevices.forEach((n,s)=>{n.items.forEach((i,d)=>{var m;if(i["refresh.interval"]&&i.read&&i.read.fn==="zcl"){const z=o(i.read.ep??((m=n.fingerprint)==null?void 0:m.endpoint)??n.uuid[1]),b=Array.isArray(i.read.at)?i.read.at:[i.read.at];for(let h=0;h<b.length;h++){const v=`${z}.${o(i.read.cl)}.${o(b[h])}`;c[v]!==void 0&&i["refresh.interval"]-60<c[v]&&r.addIssue({code:e.z.ZodIssueCode.custom,message:`The refresh interval (${i["refresh.interval"]} - 60 = ${i["refresh.interval"]-60}) should be greater than the binding max refresh value (${c[v]}) with a margin of 60 seconds`,path:["subdevices",s,"items",d,"refresh.interval"]})}}})})}function T(t,r,f){if(!t.bindings)return;const o=[{description:'a color light should always have "state/ct" item.',if:{type:["$TYPE_COLOR_TEMPERATURE_LIGHT","Color Temperature Light","$TYPE_EXTENDED_COLOR_LIGHT","Extended Color Light"]},need:{item:["state/ct"]}},{description:'a device with "state/ct" need the "min" and "max" values for capability.',if:{item:["state/ct"]},need:{item:["cap/color/ct/min","cap/color/ct/max"]}},{description:'a device with "state/x" or "state/y" need the corresponding red, green and blue x and y values.',if:{item:["state/x","state/y"]},need:{item:["state/x","state/y","cap/color/xy/red_x","cap/color/xy/green_x","cap/color/xy/blue_x","cap/color/xy/red_y","cap/color/xy/green_y","cap/color/xy/blue_y"]}},{description:'a ZHAOpenClose should always have "state/open" item.',if:{type:["$TYPE_OPEN_CLOSE_SENSOR","ZHAOpenClose"]},need:{item:["state/open"]}}];t.subdevices.forEach((c,n)=>{const s=c.items.map(i=>i.name);o.forEach(i=>{(Object.keys(i.if).length===0||Object.keys(i.if).some(d=>{var m;switch(d){case"type":return(m=i.if[d])==null?void 0:m.includes(c.type);case"item":return s.some(z=>{var b;return(b=i.if[d])==null?void 0:b.includes(z)});default:return!1}}))&&i.need.item.forEach(d=>{s.includes(d)||r.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${d}" because ${i.description}`,path:["subdevices",n,"items"]})})})})}function w(t,r,f){const o=["parse","write"];t.subdevices.forEach((c,n)=>{c.items.forEach((s,i)=>{o.forEach(d=>{const m=s[d];m!==void 0&&(m.fn===void 0||m.fn==="zcl"||m.fn==="zcl:attr"||m.fn==="zcl:cmd")&&(m.eval===void 0&&m.script===void 0&&r.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${d}' function is missing 'eval' or 'script' option.`,path:["subdevices",n,"items",i,d]}),m.eval!==void 0&&m.script!==void 0&&r.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${d}' function is having both 'eval' and 'script' option.`,path:["subdevices",n,"items",i,d]}))})})})}function $(t,r,f){const o=I();Object.keys(t).forEach(c=>{if(!Object.keys(o.shape).includes(c)){if(!["$MF_","$TYPE_"].some(n=>c.startsWith(n))){r.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant key should start with '$MF_' or '$TYPE_'",path:[c]});return}typeof t[c]!="string"&&r.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant value should be a string",path:[c]})}})}function _(t,r,f){t.bindings&&t.subdevices.forEach((o,c)=>{const n=f.subDevices[o.type];if(!n){r.addIssue({code:e.z.ZodIssueCode.custom,message:`The device is missing the device definition for the type "${o.type}"`,path:["subdevices",c,"items"]});return}let s=n.items;n.items_optional&&(s=s.filter(i=>!n.items_optional.includes(i))),s.forEach(i=>{o.items.find(d=>d.name===i)||r.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${i}" because it is mandatory for devices of type "${o.type}"`,path:["subdevices",c,"items"]})})})}function C(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("constants1.schema.json"),manufacturers:e.z.record(e.z.string().startsWith("$MF_"),e.z.string()),"device-types":e.z.record(e.z.string().startsWith("$TYPE_"),e.z.string())})}function I(t){return e.z.object({$schema:e.z.optional(e.z.string()),schema:e.z.literal("constants2.schema.json")}).passthrough()}function A(){return e.z.string().regex(/^(\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$/,"Invalid date value")}function a(t=void 0){const r="Invalid hexadecimal value";return t===void 0?e.z.string().regex(/^0x[0-9a-fA-F]+$/,r):e.z.string().regex(new RegExp(`^0x[0-9a-fA-F]{${t}}$`),r)}function u(){return e.z.union([a(2),e.z.number().min(0).max(255)])}function S(){return e.z.custom(t=>{if(!Array.isArray(t)||t.length%2!==0)return!1;for(let r=0;r<t.length;r+=2){const f=t[r],o=t[r+1];if(typeof f!="number"||typeof o!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function x(){return e.z.union([e.z.tuple([e.z.literal("$address.ext"),a(2)]),e.z.tuple([e.z.literal("$address.ext"),a(2),a(4)])])}function p(){return e.z.string()}function l(){return e.z.string()}function M(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.literal("none")}),e.z.strictObject({fn:e.z.undefined().describe("Generic function to read ZCL attributes."),at:a(4).or(e.z.array(a(4))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value.")}),e.z.strictObject({fn:e.z.literal("zcl").describe("Generic function to read ZCL attributes."),at:a(4).or(e.z.array(a(4))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}).describe("Deprecated"),e.z.strictObject({fn:e.z.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),at:a(4).or(e.z.array(a(4))).describe("String hex value or array of string hex values."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(a(2)).describe("Zigbee command."),eval:e.z.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("tuya").describe("Generic function to read all Tuya datapoints. It has no parameters.")})]).refine(t=>!("eval"in t&&"script"in t),{message:"eval and script should not both be present"})}function J(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.undefined().describe("Generic function to parse ZCL attributes and commands."),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),cppsrc:e.z.optional(e.z.string()),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),cmd:e.z.optional(a(2)).describe("Zigbee command."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl").describe("Generic function to parse ZCL attributes and commands."),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),cppsrc:e.z.optional(e.z.string()),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),cmd:e.z.optional(a(2)).describe("Zigbee command."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}).describe("Deprecated"),e.z.strictObject({fn:e.z.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),at:a(4).or(e.z.array(a(4))).describe("String hex value or array of string hex values."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(a(2)).describe("Zigbee command."),eval:e.z.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("ias:zonestatus").describe("Generic function to parse IAS ZONE status change notifications or zone status from read/report command."),mask:e.z.optional(e.z.enum(["alarm1","alarm2"]).or(e.z.literal("alarm1,alarm2"))).describe("Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status.")}),e.z.strictObject({fn:e.z.literal("numtostr").describe("Generic function to to convert number to string."),srcitem:e.z.enum(["state/airqualityppb","state/pm2_5"]).describe("The source item holding the number."),op:e.z.enum(["lt","le","eq","gt","ge"]).describe("Comparison operator (lt | le | eq | gt | ge)"),to:S().describe("Array of (num, string) mappings")}),e.z.strictObject({fn:e.z.literal("time").describe("Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed.")}),e.z.strictObject({fn:e.z.literal("xiaomi:special").describe("Generic function to parse custom Xiaomi attributes and commands."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),at:e.z.optional(a(4)).describe("Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"),idx:a(2).describe("A 8-bit string hex value."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("tuya").describe("Generic function to parse Tuya data."),dpid:e.z.number().describe("Data point ID. 1-255 the datapoint ID."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")})]).refine(t=>!("eval"in t&&"script"in t),{message:"eval and script should not both be present"})}function Z(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.literal("none")}),e.z.strictObject({fn:e.z.undefined(),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl"),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}).describe("Deprecated"),e.z.strictObject({fn:e.z.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),at:a(4).or(e.z.array(a(4))).describe("String hex value or array of string hex values."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(a(2)).describe("Zigbee command."),eval:e.z.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("tuya").describe("Generic function to write Tuya data."),dpid:e.z.number().describe("Data point ID. 1-255 the datapoint ID."),dt:a(2).describe("Data type."),eval:e.z.optional(l()).describe("Javascript expression to transform the raw value."),script:e.z.optional(p()).describe("Relative path of a Javascript .js file.")})]).refine(t=>!("eval"in t&&"script"in t),{message:"eval and script should not both be present"})}function j(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("resourceitem1.schema.json"),id:e.z.string(),description:e.z.optional(e.z.string()).describe("Item description, better to do not use it."),comment:e.z.optional(e.z.string()).describe("TODO: What is this ? What the difference with description ?"),deprecated:e.z.optional(A()).describe("Date of deprecation, if the item is deprecated, it's better to use the new one."),datatype:e.z.optional(e.z.enum(["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"])).describe("Data type of the item."),access:e.z.optional(e.z.enum(["R","W","RW"])).describe("Access mode for this item, some of them are not editable."),public:e.z.optional(e.z.boolean()).describe("Item visible on the API."),implicit:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),managed:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),awake:e.z.optional(e.z.boolean()).describe("The device is considered awake when this item is set due a incoming command."),static:e.z.optional(e.z.union([e.z.string(),e.z.number(),e.z.boolean()])).describe("A static default value is fixed and can be not changed."),range:e.z.optional(e.z.tuple([e.z.number(),e.z.number()])).describe("Values range limit."),virtual:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),read:e.z.optional(M()).describe("Fonction used to read value."),parse:e.z.optional(J()).describe("Fonction used to parse incoming values."),write:e.z.optional(Z()).describe("Fonction used to write value."),"refresh.interval":e.z.optional(e.z.number()).describe("Refresh interval used for read fonction, NEED to be superior at value used in binding part."),values:e.z.optional(e.z.unknown()).describe("TODO: What is this ?"),default:e.z.optional(e.z.unknown()).describe("Defaut value.")})}function R(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("devcap1.schema.json"),uuid:e.z.optional(e.z.string()),version:e.z.optional(e.z.string()),version_deconz:e.z.optional(e.z.string()),"doc:path":e.z.optional(e.z.string()),"doc:hdr":e.z.optional(e.z.string()),"md:known_issues":e.z.optional(e.z.array(e.z.string())).describe("Know issues for this device, markdown file."),manufacturername:e.z.union([e.z.enum(Object.keys(t.manufacturers)),e.z.string().regex(/^(?!\$MF_).*/g,"The manufacturer name start with $MF_ but is not present in constants.json"),e.z.array(e.z.union([e.z.enum(Object.keys(t.manufacturers)),e.z.string().regex(/^(?!\$MF_).*/g,"The manufacturer name start with $MF_ but is not present in constants.json")]))]).describe("Manufacturer name from Basic Cluster."),modelid:e.z.string().or(e.z.array(e.z.string())).describe("Model ID from Basic Cluster."),vendor:e.z.optional(e.z.string()).describe("Friendly name of the manufacturer."),comment:e.z.optional(e.z.string()),matchexpr:e.z.optional(l()).describe("Need to return true for the DDF be used."),path:e.z.optional(p()).describe("DDF path, useless, can be removed."),product:e.z.optional(e.z.string()).describe("Complements the model id to be shown in the UI."),sleeper:e.z.optional(e.z.boolean()).describe("Sleeping devices can only receive when awake."),supportsMgmtBind:e.z.optional(e.z.boolean()),status:e.z.enum(["Draft","Bronze","Silver","Gold"]).describe("The code quality of the DDF file."),subdevices:e.z.array(G(t)).describe("Devices section."),bindings:e.z.optional(e.z.array(k())).describe("Bindings section.")})}function G(t){return e.z.strictObject({type:e.z.union([e.z.enum(Object.keys(t.deviceTypes)),e.z.string().regex(/^(?!\$TYPE_).*/g,"The type start with $TYPE_ but is not present in constants.json")]),restapi:e.z.enum(["/lights","/sensors"]),uuid:x(),fingerprint:e.z.optional(e.z.strictObject({profile:a(4),device:a(4),endpoint:u(),in:e.z.optional(e.z.array(a(4))),out:e.z.optional(e.z.array(a(4)))})),meta:e.z.optional(e.z.strictObject({values:e.z.any(),"group.endpoints":e.z.optional(e.z.array(e.z.number()))})),buttons:e.z.optional(e.z.any()),buttonevents:e.z.optional(e.z.any()),items:e.z.array(F(t)),example:e.z.optional(e.z.unknown())})}function F(t){return j().omit({$schema:!0,schema:!0,id:!0}).extend({name:e.z.enum(t.attributes).describe("Item name.")})}function k(t){return e.z.discriminatedUnion("bind",[e.z.strictObject({bind:e.z.literal("unicast"),"src.ep":u().describe("Source endpoint."),"dst.ep":e.z.optional(u()).describe("Destination endpoint, generaly 0x01."),cl:a(4).describe("Cluster."),report:e.z.optional(e.z.array(e.z.strictObject({at:a(4),dt:a(2),mf:e.z.optional(a(4)),min:e.z.number(),max:e.z.number(),change:e.z.optional(a().or(e.z.number()))}).refine(r=>r.min<=r.max,{message:"invalid report time, min should be smaller than max"})))}),e.z.strictObject({bind:e.z.literal("groupcast"),"src.ep":u().describe("Source endpoint."),cl:a(4).describe("Cluster."),"config.group":e.z.number().min(0).max(255)})])}function L(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("subdevice1.schema.json"),type:e.z.union([e.z.enum(Object.keys(t.deviceTypes)),e.z.string().regex(/^(?!\$TYPE_).*/g,"The type start with $TYPE_ but is not present in constants.json")]),name:e.z.string(),restapi:e.z.enum(["/lights","/sensors"]),order:e.z.number(),uuid:x(),items:e.z.array(e.z.enum(t.attributes)),items_optional:e.z.optional(e.z.array(e.z.enum(t.attributes)))})}function y(t){return e.z.discriminatedUnion("schema",[R(t),C(),I(),j(),L(t)]).superRefine((r,f)=>{switch(r.schema){case"devcap1.schema.json":g[r.schema].map(o=>o(r,f,t));break;case"constants2.schema.json":g[r.schema].map(o=>o(r,f,t));break}})}function P(t={attributes:[],manufacturers:{},deviceTypes:{},resources:{},subDevices:{}}){let r=y(t);const f=()=>{r=y(t)};return{generics:t,loadGeneric:n=>{const s=r.parse(n);switch(s.schema){case"constants1.schema.json":t.manufacturers={...t.manufacturers,...s.manufacturers},t.deviceTypes={...t.deviceTypes,...s["device-types"]};break;case"constants2.schema.json":{Object.keys(s).filter(i=>i.startsWith("$MF_")).forEach(i=>{t.manufacturers[i]=s[i]}),Object.keys(s).filter(i=>i.startsWith("$TYPE_")).forEach(i=>{t.deviceTypes[i]=s[i]});break}case"resourceitem1.schema.json":{if(t.attributes.includes(s.id))throw new Error(`Got duplicate resource item with attribute id '${s.id}'.`);const i=s,d=s.id;delete i.$schema,delete i.schema,delete i.id,t.resources[d]=i,t.attributes.push(d);break}case"subdevice1.schema.json":t.subDevices[s.type]=s,t.subDevices[s.name]=s;break;case"devcap1.schema.json":throw new Error("Got invalid generic file, got data with schema 'devcap1.schema.json'.")}return f(),!0},validate:n=>r.parse(n),getSchema:()=>r,version:D}}exports.createValidator=P;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),D="2.13.0",g={"devcap1.schema.json":[E,O,_,$,w],"constants2.schema.json":[T]};function E(t,r,c){const n=typeof t.manufacturername=="string"&&typeof t.modelid=="string";if(n)return;const d=Array.isArray(t.manufacturername)&&Array.isArray(t.modelid);if(d&&t.manufacturername.length!==t.modelid.length){r.addIssue({code:e.z.ZodIssueCode.invalid_intersection_types,message:"When 'manufacturername' and 'modelid' are both arrays they should be the same length",path:["manufacturername","modelid"]});return}(n||d)===!1&&r.addIssue({code:e.z.ZodIssueCode.invalid_intersection_types,message:"Invalid properties 'manufacturername' and 'modelid' should have the same type",path:["manufacturername","modelid"]})}function O(t,r,c){if(!t.bindings)return;const n=o=>`0x${(typeof o=="number"?o:Number.parseInt(o,16)).toString(16)}`,d={};t.bindings.forEach(o=>{o.bind==="unicast"&&o.report&&o.report.forEach(s=>{s.max!==65535&&(d[`${n(o["src.ep"])}.${n(o.cl)}.${n(s.at)}`]=s.max)})}),t.subdevices.forEach((o,s)=>{o.items.forEach((i,u)=>{var p;if(i["refresh.interval"]&&i.read&&i.read.fn==="zcl"){const z=n(i.read.ep??((p=o.fingerprint)==null?void 0:p.endpoint)??o.uuid[1]),b=Array.isArray(i.read.at)?i.read.at:[i.read.at];for(let h=0;h<b.length;h++){const v=`${z}.${n(i.read.cl)}.${n(b[h])}`;d[v]!==void 0&&i["refresh.interval"]-60<d[v]&&r.addIssue({code:e.z.ZodIssueCode.custom,message:`The refresh interval (${i["refresh.interval"]} - 60 = ${i["refresh.interval"]-60}) should be greater than the binding max refresh value (${d[v]}) with a margin of 60 seconds`,path:["subdevices",s,"items",u,"refresh.interval"]})}}})})}function _(t,r,c){if(!t.bindings)return;const n=[{description:'a color light should always have "state/ct" item.',if:{type:["$TYPE_COLOR_TEMPERATURE_LIGHT","Color Temperature Light","$TYPE_EXTENDED_COLOR_LIGHT","Extended Color Light"]},need:{item:["state/ct"]}},{description:'a device with "state/ct" need the "min" and "max" values for capability.',if:{item:["state/ct"]},need:{item:["cap/color/ct/min","cap/color/ct/max"]}},{description:'a device with "state/x" or "state/y" need the corresponding red, green and blue x and y values.',if:{item:["state/x","state/y"]},need:{item:["state/x","state/y","cap/color/xy/red_x","cap/color/xy/green_x","cap/color/xy/blue_x","cap/color/xy/red_y","cap/color/xy/green_y","cap/color/xy/blue_y"]}},{description:'a ZHAOpenClose should always have "state/open" item.',if:{type:["$TYPE_OPEN_CLOSE_SENSOR","ZHAOpenClose"]},need:{item:["state/open"]}}];t.subdevices.forEach((d,o)=>{const s=d.items.map(i=>i.name);n.forEach(i=>{(Object.keys(i.if).length===0||Object.keys(i.if).some(u=>{var p;switch(u){case"type":return(p=i.if[u])==null?void 0:p.includes(d.type);case"item":return s.some(z=>{var b;return(b=i.if[u])==null?void 0:b.includes(z)});default:return!1}}))&&i.need.item.forEach(u=>{s.includes(u)||r.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${u}" because ${i.description}`,path:["subdevices",o,"items"]})})})})}function $(t,r,c){const n=["parse","write"];t.subdevices.forEach((d,o)=>{d.items.forEach((s,i)=>{n.forEach(u=>{const p=s[u];p!==void 0&&(p.fn===void 0||p.fn==="zcl"||p.fn==="zcl:attr"||p.fn==="zcl:cmd")&&(p.eval===void 0&&p.script===void 0&&r.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${u}' function is missing 'eval' or 'script' option.`,path:["subdevices",o,"items",i,u]}),p.eval!==void 0&&p.script!==void 0&&r.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${u}' function is having both 'eval' and 'script' option.`,path:["subdevices",o,"items",i,u]}))})})})}function T(t,r,c){const n=I();Object.keys(t).forEach(d=>{if(!Object.keys(n.shape).includes(d)){if(!["$MF_","$TYPE_"].some(o=>d.startsWith(o))){r.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant key should start with '$MF_' or '$TYPE_'",path:[d]});return}typeof t[d]!="string"&&r.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant value should be a string",path:[d]})}})}function w(t,r,c){t.bindings&&t.subdevices.forEach((n,d)=>{const o=c.subDevices[n.type];if(!o){r.addIssue({code:e.z.ZodIssueCode.custom,message:`The device is missing the device definition for the type "${n.type}"`,path:["subdevices",d,"items"]});return}let s=o.items;o.items_optional&&(s=s.filter(i=>!o.items_optional.includes(i))),s.forEach(i=>{n.items.find(u=>u.name===i)||r.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${i}" because it is mandatory for devices of type "${n.type}"`,path:["subdevices",d,"items"]})})})}function C(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("constants1.schema.json"),manufacturers:e.z.record(e.z.string().startsWith("$MF_"),e.z.string()),"device-types":e.z.record(e.z.string().startsWith("$TYPE_"),e.z.string())})}function I(t){return e.z.object({$schema:e.z.optional(e.z.string()),schema:e.z.literal("constants2.schema.json")}).passthrough()}function A(){return e.z.string().regex(/^(\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$/,"Invalid date value")}function a(t=void 0){const r="Invalid hexadecimal value";return t===void 0?e.z.string().regex(/^0x[0-9a-fA-F]+$/,r):e.z.string().regex(new RegExp(`^0x[0-9a-fA-F]{${t}}$`),r)}function l(){return e.z.union([a(2),e.z.number().min(0).max(255)])}function S(){return e.z.custom(t=>{if(!Array.isArray(t)||t.length%2!==0)return!1;for(let r=0;r<t.length;r+=2){const c=t[r],n=t[r+1];if(typeof c!="number"||typeof n!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function x(){return e.z.union([e.z.tuple([e.z.literal("$address.ext"),a(2)]),e.z.tuple([e.z.literal("$address.ext"),a(2),a(4)])])}function f(){return e.z.string()}function m(){return e.z.string()}function M(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.literal("none")}),e.z.strictObject({fn:e.z.undefined().describe("Generic function to read ZCL attributes."),at:a(4).or(e.z.array(a(4))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value.")}),e.z.strictObject({fn:e.z.literal("zcl").describe("Generic function to read ZCL attributes."),at:a(4).or(e.z.array(a(4))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}).describe("Deprecated"),e.z.strictObject({fn:e.z.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),at:a(4).or(e.z.array(a(4))).describe("String hex value or array of string hex values."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(a(2)).describe("Zigbee command."),eval:e.z.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("tuya").describe("Generic function to read all Tuya datapoints. It has no parameters.")})]).refine(t=>!("eval"in t&&"script"in t),{message:"eval and script should not both be present"})}function J(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.undefined().describe("Generic function to parse ZCL attributes and commands."),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),cppsrc:e.z.optional(e.z.string()),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),cmd:e.z.optional(a(2)).describe("Zigbee command."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl").describe("Generic function to parse ZCL attributes and commands."),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),cl:a(4).describe("Cluster ID."),cppsrc:e.z.optional(e.z.string()),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),cmd:e.z.optional(a(2)).describe("Zigbee command."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}).describe("Deprecated"),e.z.strictObject({fn:e.z.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),at:a(4).or(e.z.array(a(4))).describe("String hex value or array of string hex values."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),cl:a(4).describe("Cluster ID."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(a(2)).describe("Zigbee command."),eval:e.z.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("ias:zonestatus").describe("Generic function to parse IAS ZONE status change notifications or zone status from read/report command."),mask:e.z.optional(e.z.enum(["alarm1","alarm2"]).or(e.z.literal("alarm1,alarm2"))).describe("Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status.")}),e.z.strictObject({fn:e.z.literal("numtostr").describe("Generic function to to convert number to string."),srcitem:e.z.enum(["state/airqualityppb","state/pm2_5"]).describe("The source item holding the number."),op:e.z.enum(["lt","le","eq","gt","ge"]).describe("Comparison operator (lt | le | eq | gt | ge)"),to:S().describe("Array of (num, string) mappings")}),e.z.strictObject({fn:e.z.literal("time").describe("Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed.")}),e.z.strictObject({fn:e.z.literal("xiaomi:special").describe("Generic function to parse custom Xiaomi attributes and commands."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),at:e.z.optional(a(4)).describe("Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"),idx:a(2).describe("A 8-bit string hex value."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("tuya").describe("Generic function to parse Tuya data."),dpid:e.z.number().describe("Data point ID. 1-255 the datapoint ID."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")})]).refine(t=>!("eval"in t&&"script"in t),{message:"eval and script should not both be present"})}function Z(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.literal("none")}),e.z.strictObject({fn:e.z.undefined(),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl"),at:e.z.optional(a(4).or(e.z.array(a(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}).describe("Deprecated"),e.z.strictObject({fn:e.z.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),at:a(4).or(e.z.array(a(4))).describe("String hex value or array of string hex values."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),eval:e.z.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),cl:a(4).describe("Cluster ID."),dt:a(2).describe("Data type."),ep:e.z.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),mf:e.z.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(a(2)).describe("Zigbee command."),eval:e.z.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")}),e.z.strictObject({fn:e.z.literal("tuya").describe("Generic function to write Tuya data."),dpid:e.z.number().describe("Data point ID. 1-255 the datapoint ID."),dt:a(2).describe("Data type."),eval:e.z.optional(m()).describe("Javascript expression to transform the raw value."),script:e.z.optional(f()).describe("Relative path of a Javascript .js file.")})]).refine(t=>!("eval"in t&&"script"in t),{message:"eval and script should not both be present"})}function j(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("resourceitem1.schema.json"),id:e.z.string(),description:e.z.optional(e.z.string()).describe("Item description, better to do not use it."),comment:e.z.optional(e.z.string()).describe("TODO: What is this ? What the difference with description ?"),deprecated:e.z.optional(A()).describe("Date of deprecation, if the item is deprecated, it's better to use the new one."),datatype:e.z.optional(e.z.enum(["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"])).describe("Data type of the item."),access:e.z.optional(e.z.enum(["R","W","RW"])).describe("Access mode for this item, some of them are not editable."),public:e.z.optional(e.z.boolean()).describe("Item visible on the API."),implicit:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),managed:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),awake:e.z.optional(e.z.boolean()).describe("The device is considered awake when this item is set due a incoming command."),static:e.z.optional(e.z.union([e.z.string(),e.z.number(),e.z.boolean()])).describe("A static default value is fixed and can be not changed."),range:e.z.optional(e.z.tuple([e.z.number(),e.z.number()])).describe("Values range limit."),virtual:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),read:e.z.optional(M()).describe("Fonction used to read value."),parse:e.z.optional(J()).describe("Fonction used to parse incoming values."),write:e.z.optional(Z()).describe("Fonction used to write value."),"refresh.interval":e.z.optional(e.z.number()).describe("Refresh interval used for read fonction, NEED to be superior at value used in binding part."),values:e.z.optional(e.z.unknown()).describe("TODO: What is this ?"),default:e.z.optional(e.z.unknown()).describe("Defaut value.")})}function R(t){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("devcap1.schema.json"),uuid:e.z.optional(e.z.string()),version:e.z.optional(e.z.string()),version_deconz:e.z.optional(e.z.string()),"doc:path":e.z.optional(e.z.string()),"doc:hdr":e.z.optional(e.z.string()),"md:known_issues":e.z.optional(e.z.array(e.z.string())).describe("Know issues for this device, markdown file."),manufacturername:e.z.union([e.z.enum(Object.keys(t.manufacturers)),e.z.string().regex(/^(?!\$MF_).*/g,"The manufacturer name start with $MF_ but is not present in constants.json"),e.z.array(e.z.union([e.z.enum(Object.keys(t.manufacturers)),e.z.string().regex(/^(?!\$MF_).*/g,"The manufacturer name start with $MF_ but is not present in constants.json")]))]).describe("Manufacturer name from Basic Cluster."),modelid:e.z.string().or(e.z.array(e.z.string())).describe("Model ID from Basic Cluster."),vendor:e.z.optional(e.z.string()).describe("Friendly name of the manufacturer."),comment:e.z.optional(e.z.string()),matchexpr:e.z.optional(m()).describe("Need to return true for the DDF be used."),path:e.z.optional(f()).describe("DDF path, useless, can be removed."),product:e.z.optional(e.z.string()).describe("Complements the model id to be shown in the UI."),sleeper:e.z.optional(e.z.boolean()).describe("Sleeping devices can only receive when awake."),supportsMgmtBind:e.z.optional(e.z.boolean()),status:e.z.enum(["Draft","Bronze","Silver","Gold"]).describe("The code quality of the DDF file."),subdevices:e.z.array(G(t)).describe("Devices section."),bindings:e.z.optional(e.z.array(k())).describe("Bindings section.")})}function G(t){return e.z.strictObject({type:e.z.union([e.z.enum(Object.keys(t.deviceTypes),{errorMap:(r,c)=>r.code==="invalid_enum_value"?{message:`Invalid enum value. Expected type from generic attributes definition, received '${r.received}'`}:{message:c.defaultError}}),e.z.string().regex(/^(?!\$TYPE_).*/g,"The type start with $TYPE_ but is not present in constants.json")]),restapi:e.z.enum(["/lights","/sensors"]),uuid:x(),fingerprint:e.z.optional(e.z.strictObject({profile:a(4),device:a(4),endpoint:l(),in:e.z.optional(e.z.array(a(4))),out:e.z.optional(e.z.array(a(4)))})),meta:e.z.optional(e.z.strictObject({values:e.z.any(),"group.endpoints":e.z.optional(e.z.array(e.z.number()))})),buttons:e.z.optional(e.z.any()),buttonevents:e.z.optional(e.z.any()),items:e.z.array(F(t)),example:e.z.optional(e.z.unknown())})}function F(t){return j().omit({$schema:!0,schema:!0,id:!0}).extend({name:e.z.enum(t.attributes,{errorMap:(r,c)=>r.code==="invalid_enum_value"?{message:`Invalid enum value. Expected item from generic attributes definition, received '${r.received}'`}:{message:c.defaultError}}).describe("Item name.")})}function k(t){return e.z.discriminatedUnion("bind",[e.z.strictObject({bind:e.z.literal("unicast"),"src.ep":l().describe("Source endpoint."),"dst.ep":e.z.optional(l()).describe("Destination endpoint, generaly 0x01."),cl:a(4).describe("Cluster."),report:e.z.optional(e.z.array(e.z.strictObject({at:a(4),dt:a(2),mf:e.z.optional(a(4)),min:e.z.number(),max:e.z.number(),change:e.z.optional(a().or(e.z.number()))}).refine(r=>r.min<=r.max,{message:"invalid report time, min should be smaller than max"})))}),e.z.strictObject({bind:e.z.literal("groupcast"),"src.ep":l().describe("Source endpoint."),cl:a(4).describe("Cluster."),"config.group":e.z.number().min(0).max(255)})])}function L(t){const r=e.z.array(e.z.enum(t.attributes,{errorMap:(c,n)=>c.code==="invalid_enum_value"?{message:`Invalid enum value. Expected item from generic attributes definition, received '${c.received}'`}:{message:n.defaultError}}));return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("subdevice1.schema.json"),type:e.z.union([e.z.enum(Object.keys(t.deviceTypes),{errorMap:(c,n)=>c.code==="invalid_enum_value"?{message:`Invalid enum value. Expected type from generic attributes definition, received '${c.received}'`}:{message:n.defaultError}}),e.z.string().regex(/^(?!\$TYPE_).*/g,"The type start with $TYPE_ but is not present in constants.json")]),name:e.z.string(),restapi:e.z.enum(["/lights","/sensors"]),order:e.z.number(),uuid:x(),items:r,items_optional:e.z.optional(r)})}function y(t){return e.z.discriminatedUnion("schema",[R(t),C(),I(),j(),L(t)]).superRefine((r,c)=>{switch(r.schema){case"devcap1.schema.json":g[r.schema].map(n=>n(r,c,t));break;case"constants2.schema.json":g[r.schema].map(n=>n(r,c,t));break}})}function P(t={attributes:[],manufacturers:{},deviceTypes:{},resources:{},subDevices:{}}){let r=y(t);const c=()=>{r=y(t)};return{generics:t,loadGeneric:o=>{const s=r.parse(o);switch(s.schema){case"constants1.schema.json":t.manufacturers={...t.manufacturers,...s.manufacturers},t.deviceTypes={...t.deviceTypes,...s["device-types"]};break;case"constants2.schema.json":{Object.keys(s).filter(i=>i.startsWith("$MF_")).forEach(i=>{t.manufacturers[i]=s[i]}),Object.keys(s).filter(i=>i.startsWith("$TYPE_")).forEach(i=>{t.deviceTypes[i]=s[i]});break}case"resourceitem1.schema.json":{if(t.attributes.includes(s.id))throw new Error(`Got duplicate resource item with attribute id '${s.id}'.`);const i=s,u=s.id;delete i.$schema,delete i.schema,delete i.id,t.resources[u]=i,t.attributes.push(u);break}case"subdevice1.schema.json":t.subDevices[s.type]=s,t.subDevices[s.name]=s;break;case"devcap1.schema.json":throw new Error("Got invalid generic file, got data with schema 'devcap1.schema.json'.")}return c(),!0},validate:o=>r.parse(o),getSchema:()=>r,version:D}}exports.createValidator=P;
|
package/dist/ddf-validator.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type DDF = {
|
|
|
30
30
|
status: "Draft" | "Bronze" | "Silver" | "Gold";
|
|
31
31
|
/** Devices section. */
|
|
32
32
|
subdevices: {
|
|
33
|
-
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_CARBONDIOXIDE_SENSOR" | "$TYPE_FORMALDEHYDE_SENSOR" | "$TYPE_PARTICULATEMATTER_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_MOISTURE_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_LIGHT_SWITCH" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_ON_OFF_SWITCH" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
33
|
+
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_CARBONDIOXIDE_SENSOR" | "$TYPE_FORMALDEHYDE_SENSOR" | "$TYPE_PARTICULATEMATTER_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_ANCILLARY_CONTROL" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LEVEL_CONTROL_SWITCH" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_MOISTURE_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_LIGHT_SWITCH" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_ON_OFF_SWITCH" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_TIME" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
34
34
|
restapi: "/lights" | "/sensors";
|
|
35
35
|
uuid: [
|
|
36
36
|
"$address.ext",
|
|
@@ -691,7 +691,7 @@ export type DDF = {
|
|
|
691
691
|
} | {
|
|
692
692
|
$schema?: string | undefined;
|
|
693
693
|
schema: "subdevice1.schema.json";
|
|
694
|
-
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_CARBONDIOXIDE_SENSOR" | "$TYPE_FORMALDEHYDE_SENSOR" | "$TYPE_PARTICULATEMATTER_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_MOISTURE_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_LIGHT_SWITCH" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_ON_OFF_SWITCH" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
694
|
+
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_CARBONDIOXIDE_SENSOR" | "$TYPE_FORMALDEHYDE_SENSOR" | "$TYPE_PARTICULATEMATTER_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_ANCILLARY_CONTROL" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LEVEL_CONTROL_SWITCH" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_MOISTURE_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_LIGHT_SWITCH" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_ON_OFF_SWITCH" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_TIME" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
695
695
|
name: string;
|
|
696
696
|
restapi: "/lights" | "/sensors";
|
|
697
697
|
order: number;
|
package/dist/ddf-validator.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const E = "2.13.0", y = {
|
|
3
3
|
"devcap1.schema.json": [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
w,
|
|
4
|
+
O,
|
|
5
|
+
_,
|
|
7
6
|
$,
|
|
7
|
+
T,
|
|
8
8
|
C
|
|
9
9
|
],
|
|
10
10
|
"constants2.schema.json": [
|
|
11
|
-
|
|
11
|
+
w
|
|
12
12
|
]
|
|
13
13
|
};
|
|
14
|
-
function
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
14
|
+
function O(t, r, c) {
|
|
15
|
+
const n = typeof t.manufacturername == "string" && typeof t.modelid == "string";
|
|
16
|
+
if (n)
|
|
17
17
|
return;
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
18
|
+
const d = Array.isArray(t.manufacturername) && Array.isArray(t.modelid);
|
|
19
|
+
if (d && t.manufacturername.length !== t.modelid.length) {
|
|
20
20
|
r.addIssue({
|
|
21
21
|
code: e.ZodIssueCode.invalid_intersection_types,
|
|
22
22
|
message: "When 'manufacturername' and 'modelid' are both arrays they should be the same length",
|
|
@@ -24,41 +24,41 @@ function E(t, r, f) {
|
|
|
24
24
|
});
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
(
|
|
27
|
+
(n || d) === !1 && r.addIssue({
|
|
28
28
|
code: e.ZodIssueCode.invalid_intersection_types,
|
|
29
29
|
message: "Invalid properties 'manufacturername' and 'modelid' should have the same type",
|
|
30
30
|
path: ["manufacturername", "modelid"]
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function _(t, r, c) {
|
|
34
34
|
if (!t.bindings)
|
|
35
35
|
return;
|
|
36
|
-
const
|
|
37
|
-
t.bindings.forEach((
|
|
38
|
-
|
|
39
|
-
s.max !== 65535 && (
|
|
36
|
+
const n = (o) => `0x${(typeof o == "number" ? o : Number.parseInt(o, 16)).toString(16)}`, d = {};
|
|
37
|
+
t.bindings.forEach((o) => {
|
|
38
|
+
o.bind === "unicast" && o.report && o.report.forEach((s) => {
|
|
39
|
+
s.max !== 65535 && (d[`${n(o["src.ep"])}.${n(o.cl)}.${n(s.at)}`] = s.max);
|
|
40
40
|
});
|
|
41
|
-
}), t.subdevices.forEach((
|
|
42
|
-
|
|
43
|
-
var
|
|
41
|
+
}), t.subdevices.forEach((o, s) => {
|
|
42
|
+
o.items.forEach((i, u) => {
|
|
43
|
+
var p;
|
|
44
44
|
if (i["refresh.interval"] && i.read && i.read.fn === "zcl") {
|
|
45
|
-
const h =
|
|
45
|
+
const h = n(i.read.ep ?? ((p = o.fingerprint) == null ? void 0 : p.endpoint) ?? o.uuid[1]), b = Array.isArray(i.read.at) ? i.read.at : [i.read.at];
|
|
46
46
|
for (let v = 0; v < b.length; v++) {
|
|
47
|
-
const g = `${h}.${
|
|
48
|
-
|
|
47
|
+
const g = `${h}.${n(i.read.cl)}.${n(b[v])}`;
|
|
48
|
+
d[g] !== void 0 && i["refresh.interval"] - 60 < d[g] && r.addIssue({
|
|
49
49
|
code: e.ZodIssueCode.custom,
|
|
50
|
-
message: `The refresh interval (${i["refresh.interval"]} - 60 = ${i["refresh.interval"] - 60}) should be greater than the binding max refresh value (${
|
|
51
|
-
path: ["subdevices", s, "items",
|
|
50
|
+
message: `The refresh interval (${i["refresh.interval"]} - 60 = ${i["refresh.interval"] - 60}) should be greater than the binding max refresh value (${d[g]}) with a margin of 60 seconds`,
|
|
51
|
+
path: ["subdevices", s, "items", u, "refresh.interval"]
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function $(t, r, c) {
|
|
59
59
|
if (!t.bindings)
|
|
60
60
|
return;
|
|
61
|
-
const
|
|
61
|
+
const n = [
|
|
62
62
|
/*
|
|
63
63
|
{
|
|
64
64
|
description: 'a device should always have basic attributes.',
|
|
@@ -139,88 +139,88 @@ function w(t, r, f) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
];
|
|
142
|
-
t.subdevices.forEach((
|
|
143
|
-
const s =
|
|
144
|
-
|
|
145
|
-
(Object.keys(i.if).length === 0 || Object.keys(i.if).some((
|
|
146
|
-
var
|
|
147
|
-
switch (
|
|
142
|
+
t.subdevices.forEach((d, o) => {
|
|
143
|
+
const s = d.items.map((i) => i.name);
|
|
144
|
+
n.forEach((i) => {
|
|
145
|
+
(Object.keys(i.if).length === 0 || Object.keys(i.if).some((u) => {
|
|
146
|
+
var p;
|
|
147
|
+
switch (u) {
|
|
148
148
|
case "type":
|
|
149
|
-
return (
|
|
149
|
+
return (p = i.if[u]) == null ? void 0 : p.includes(d.type);
|
|
150
150
|
case "item":
|
|
151
151
|
return s.some((h) => {
|
|
152
152
|
var b;
|
|
153
|
-
return (b = i.if[
|
|
153
|
+
return (b = i.if[u]) == null ? void 0 : b.includes(h);
|
|
154
154
|
});
|
|
155
155
|
default:
|
|
156
156
|
return !1;
|
|
157
157
|
}
|
|
158
|
-
})) && i.need.item.forEach((
|
|
159
|
-
s.includes(
|
|
158
|
+
})) && i.need.item.forEach((u) => {
|
|
159
|
+
s.includes(u) || r.addIssue({
|
|
160
160
|
code: e.ZodIssueCode.custom,
|
|
161
|
-
message: `The device should have the item "${
|
|
162
|
-
path: ["subdevices",
|
|
161
|
+
message: `The device should have the item "${u}" because ${i.description}`,
|
|
162
|
+
path: ["subdevices", o, "items"]
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
const
|
|
170
|
-
t.subdevices.forEach((
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
168
|
+
function T(t, r, c) {
|
|
169
|
+
const n = ["parse", "write"];
|
|
170
|
+
t.subdevices.forEach((d, o) => {
|
|
171
|
+
d.items.forEach((s, i) => {
|
|
172
|
+
n.forEach((u) => {
|
|
173
|
+
const p = s[u];
|
|
174
|
+
p !== void 0 && (p.fn === void 0 || p.fn === "zcl" || p.fn === "zcl:attr" || p.fn === "zcl:cmd") && (p.eval === void 0 && p.script === void 0 && r.addIssue({
|
|
175
175
|
code: e.ZodIssueCode.custom,
|
|
176
|
-
message: `The '${
|
|
177
|
-
path: ["subdevices",
|
|
178
|
-
}),
|
|
176
|
+
message: `The '${u}' function is missing 'eval' or 'script' option.`,
|
|
177
|
+
path: ["subdevices", o, "items", i, u]
|
|
178
|
+
}), p.eval !== void 0 && p.script !== void 0 && r.addIssue({
|
|
179
179
|
code: e.ZodIssueCode.custom,
|
|
180
|
-
message: `The '${
|
|
181
|
-
path: ["subdevices",
|
|
180
|
+
message: `The '${u}' function is having both 'eval' and 'script' option.`,
|
|
181
|
+
path: ["subdevices", o, "items", i, u]
|
|
182
182
|
}));
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
Object.keys(t).forEach((
|
|
190
|
-
if (!Object.keys(
|
|
191
|
-
if (!["$MF_", "$TYPE_"].some((
|
|
187
|
+
function w(t, r, c) {
|
|
188
|
+
const n = I();
|
|
189
|
+
Object.keys(t).forEach((d) => {
|
|
190
|
+
if (!Object.keys(n.shape).includes(d)) {
|
|
191
|
+
if (!["$MF_", "$TYPE_"].some((o) => d.startsWith(o))) {
|
|
192
192
|
r.addIssue({
|
|
193
193
|
code: e.ZodIssueCode.custom,
|
|
194
194
|
message: "The constant key should start with '$MF_' or '$TYPE_'",
|
|
195
|
-
path: [
|
|
195
|
+
path: [d]
|
|
196
196
|
});
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
typeof t[
|
|
199
|
+
typeof t[d] != "string" && r.addIssue({
|
|
200
200
|
code: e.ZodIssueCode.custom,
|
|
201
201
|
message: "The constant value should be a string",
|
|
202
|
-
path: [
|
|
202
|
+
path: [d]
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
function C(t, r,
|
|
208
|
-
t.bindings && t.subdevices.forEach((
|
|
209
|
-
const
|
|
210
|
-
if (!
|
|
207
|
+
function C(t, r, c) {
|
|
208
|
+
t.bindings && t.subdevices.forEach((n, d) => {
|
|
209
|
+
const o = c.subDevices[n.type];
|
|
210
|
+
if (!o) {
|
|
211
211
|
r.addIssue({
|
|
212
212
|
code: e.ZodIssueCode.custom,
|
|
213
|
-
message: `The device is missing the device definition for the type "${
|
|
214
|
-
path: ["subdevices",
|
|
213
|
+
message: `The device is missing the device definition for the type "${n.type}"`,
|
|
214
|
+
path: ["subdevices", d, "items"]
|
|
215
215
|
});
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
let s =
|
|
219
|
-
|
|
220
|
-
|
|
218
|
+
let s = o.items;
|
|
219
|
+
o.items_optional && (s = s.filter((i) => !o.items_optional.includes(i))), s.forEach((i) => {
|
|
220
|
+
n.items.find((u) => u.name === i) || r.addIssue({
|
|
221
221
|
code: e.ZodIssueCode.custom,
|
|
222
|
-
message: `The device should have the item "${i}" because it is mandatory for devices of type "${
|
|
223
|
-
path: ["subdevices",
|
|
222
|
+
message: `The device should have the item "${i}" because it is mandatory for devices of type "${n.type}"`,
|
|
223
|
+
path: ["subdevices", d, "items"]
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
226
|
});
|
|
@@ -239,7 +239,7 @@ function I(t) {
|
|
|
239
239
|
schema: e.literal("constants2.schema.json")
|
|
240
240
|
}).passthrough();
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function M() {
|
|
243
243
|
return e.string().regex(
|
|
244
244
|
// Regex for AAAA-MM-JJ
|
|
245
245
|
/^(\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$/,
|
|
@@ -250,19 +250,19 @@ function a(t = void 0) {
|
|
|
250
250
|
const r = "Invalid hexadecimal value";
|
|
251
251
|
return t === void 0 ? e.string().regex(/^0x[0-9a-fA-F]+$/, r) : e.string().regex(new RegExp(`^0x[0-9a-fA-F]{${t}}$`), r);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function l() {
|
|
254
254
|
return e.union([
|
|
255
255
|
a(2),
|
|
256
256
|
e.number().min(0).max(255)
|
|
257
257
|
]);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function S() {
|
|
260
260
|
return e.custom((t) => {
|
|
261
261
|
if (!Array.isArray(t) || t.length % 2 !== 0)
|
|
262
262
|
return !1;
|
|
263
263
|
for (let r = 0; r < t.length; r += 2) {
|
|
264
|
-
const
|
|
265
|
-
if (typeof
|
|
264
|
+
const c = t[r], n = t[r + 1];
|
|
265
|
+
if (typeof c != "number" || typeof n != "string")
|
|
266
266
|
return !1;
|
|
267
267
|
}
|
|
268
268
|
return !0;
|
|
@@ -281,13 +281,13 @@ function j() {
|
|
|
281
281
|
])
|
|
282
282
|
]);
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function f() {
|
|
285
285
|
return e.string();
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function m() {
|
|
288
288
|
return e.string();
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function J() {
|
|
291
291
|
return e.discriminatedUnion("fn", [
|
|
292
292
|
e.strictObject({
|
|
293
293
|
fn: e.literal("none")
|
|
@@ -296,36 +296,36 @@ function M() {
|
|
|
296
296
|
fn: e.undefined().describe("Generic function to read ZCL attributes."),
|
|
297
297
|
at: a(4).or(e.array(a(4))).describe("Attribute ID."),
|
|
298
298
|
cl: a(4).describe("Cluster ID."),
|
|
299
|
-
ep: e.optional(
|
|
299
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
300
300
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
301
|
-
eval: e.optional(
|
|
301
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value.")
|
|
302
302
|
}),
|
|
303
303
|
e.strictObject({
|
|
304
304
|
fn: e.literal("zcl").describe("Generic function to read ZCL attributes."),
|
|
305
305
|
at: a(4).or(e.array(a(4))).describe("Attribute ID."),
|
|
306
306
|
cl: a(4).describe("Cluster ID."),
|
|
307
|
-
ep: e.optional(
|
|
307
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
308
308
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
309
|
-
eval: e.optional(
|
|
310
|
-
script: e.optional(
|
|
309
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
310
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
311
311
|
}).describe("Deprecated"),
|
|
312
312
|
e.strictObject({
|
|
313
313
|
fn: e.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),
|
|
314
314
|
at: a(4).or(e.array(a(4))).describe("String hex value or array of string hex values."),
|
|
315
315
|
cl: a(4).describe("Cluster ID."),
|
|
316
|
-
ep: e.optional(
|
|
316
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
317
317
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
318
|
-
eval: e.optional(
|
|
319
|
-
script: e.optional(
|
|
318
|
+
eval: e.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
319
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
320
320
|
}),
|
|
321
321
|
e.strictObject({
|
|
322
322
|
fn: e.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),
|
|
323
323
|
cl: a(4).describe("Cluster ID."),
|
|
324
|
-
ep: e.optional(
|
|
324
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
325
325
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
326
326
|
cmd: e.optional(a(2)).describe("Zigbee command."),
|
|
327
|
-
eval: e.optional(
|
|
328
|
-
script: e.optional(
|
|
327
|
+
eval: e.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
328
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
329
329
|
}),
|
|
330
330
|
e.strictObject({
|
|
331
331
|
fn: e.literal("tuya").describe("Generic function to read all Tuya datapoints. It has no parameters.")
|
|
@@ -341,40 +341,40 @@ function Z() {
|
|
|
341
341
|
at: e.optional(a(4).or(e.array(a(4)))).describe("Attribute ID."),
|
|
342
342
|
cl: a(4).describe("Cluster ID."),
|
|
343
343
|
cppsrc: e.optional(e.string()),
|
|
344
|
-
ep: e.optional(
|
|
344
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
345
345
|
cmd: e.optional(a(2)).describe("Zigbee command."),
|
|
346
346
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
347
|
-
eval: e.optional(
|
|
348
|
-
script: e.optional(
|
|
347
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
348
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
349
349
|
}),
|
|
350
350
|
e.strictObject({
|
|
351
351
|
fn: e.literal("zcl").describe("Generic function to parse ZCL attributes and commands."),
|
|
352
352
|
at: e.optional(a(4).or(e.array(a(4)))).describe("Attribute ID."),
|
|
353
353
|
cl: a(4).describe("Cluster ID."),
|
|
354
354
|
cppsrc: e.optional(e.string()),
|
|
355
|
-
ep: e.optional(
|
|
355
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
356
356
|
cmd: e.optional(a(2)).describe("Zigbee command."),
|
|
357
357
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
358
|
-
eval: e.optional(
|
|
359
|
-
script: e.optional(
|
|
358
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
359
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
360
360
|
}).describe("Deprecated"),
|
|
361
361
|
e.strictObject({
|
|
362
362
|
fn: e.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),
|
|
363
363
|
at: a(4).or(e.array(a(4))).describe("String hex value or array of string hex values."),
|
|
364
364
|
cl: a(4).describe("Cluster ID."),
|
|
365
|
-
ep: e.optional(
|
|
365
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
366
366
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
367
|
-
eval: e.optional(
|
|
368
|
-
script: e.optional(
|
|
367
|
+
eval: e.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
368
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
369
369
|
}),
|
|
370
370
|
e.strictObject({
|
|
371
371
|
fn: e.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),
|
|
372
372
|
cl: a(4).describe("Cluster ID."),
|
|
373
|
-
ep: e.optional(
|
|
373
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
374
374
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
375
375
|
cmd: e.optional(a(2)).describe("Zigbee command."),
|
|
376
|
-
eval: e.optional(
|
|
377
|
-
script: e.optional(
|
|
376
|
+
eval: e.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
377
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
378
378
|
}),
|
|
379
379
|
e.strictObject({
|
|
380
380
|
fn: e.literal("ias:zonestatus").describe("Generic function to parse IAS ZONE status change notifications or zone status from read/report command."),
|
|
@@ -385,25 +385,25 @@ function Z() {
|
|
|
385
385
|
// TODO use generic
|
|
386
386
|
srcitem: e.enum(["state/airqualityppb", "state/pm2_5"]).describe("The source item holding the number."),
|
|
387
387
|
op: e.enum(["lt", "le", "eq", "gt", "ge"]).describe("Comparison operator (lt | le | eq | gt | ge)"),
|
|
388
|
-
to:
|
|
388
|
+
to: S().describe("Array of (num, string) mappings")
|
|
389
389
|
}),
|
|
390
390
|
e.strictObject({
|
|
391
391
|
fn: e.literal("time").describe("Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed.")
|
|
392
392
|
}),
|
|
393
393
|
e.strictObject({
|
|
394
394
|
fn: e.literal("xiaomi:special").describe("Generic function to parse custom Xiaomi attributes and commands."),
|
|
395
|
-
ep: e.optional(
|
|
395
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
396
396
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
397
397
|
at: e.optional(a(4)).describe("Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"),
|
|
398
398
|
idx: a(2).describe("A 8-bit string hex value."),
|
|
399
|
-
eval: e.optional(
|
|
400
|
-
script: e.optional(
|
|
399
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
400
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
401
401
|
}),
|
|
402
402
|
e.strictObject({
|
|
403
403
|
fn: e.literal("tuya").describe("Generic function to parse Tuya data."),
|
|
404
404
|
dpid: e.number().describe("Data point ID. 1-255 the datapoint ID."),
|
|
405
|
-
eval: e.optional(
|
|
406
|
-
script: e.optional(
|
|
405
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
406
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
407
407
|
})
|
|
408
408
|
]).refine((t) => !("eval" in t && "script" in t), {
|
|
409
409
|
message: "eval and script should not both be present"
|
|
@@ -421,10 +421,10 @@ function R() {
|
|
|
421
421
|
"change.timeout": e.optional(e.number()),
|
|
422
422
|
cl: a(4).describe("Cluster ID."),
|
|
423
423
|
dt: a(2).describe("Data type."),
|
|
424
|
-
ep: e.optional(
|
|
424
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
425
425
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
426
|
-
eval: e.optional(
|
|
427
|
-
script: e.optional(
|
|
426
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
427
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
428
428
|
}),
|
|
429
429
|
e.strictObject({
|
|
430
430
|
fn: e.literal("zcl"),
|
|
@@ -433,10 +433,10 @@ function R() {
|
|
|
433
433
|
"change.timeout": e.optional(e.number()),
|
|
434
434
|
cl: a(4).describe("Cluster ID."),
|
|
435
435
|
dt: a(2).describe("Data type."),
|
|
436
|
-
ep: e.optional(
|
|
436
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
437
437
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
438
|
-
eval: e.optional(
|
|
439
|
-
script: e.optional(
|
|
438
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
439
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
440
440
|
}).describe("Deprecated"),
|
|
441
441
|
e.strictObject({
|
|
442
442
|
fn: e.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -445,27 +445,27 @@ function R() {
|
|
|
445
445
|
"change.timeout": e.optional(e.number()),
|
|
446
446
|
cl: a(4).describe("Cluster ID."),
|
|
447
447
|
dt: a(2).describe("Data type."),
|
|
448
|
-
ep: e.optional(
|
|
448
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
449
449
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
450
|
-
eval: e.optional(
|
|
451
|
-
script: e.optional(
|
|
450
|
+
eval: e.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
451
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
452
452
|
}),
|
|
453
453
|
e.strictObject({
|
|
454
454
|
fn: e.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),
|
|
455
455
|
cl: a(4).describe("Cluster ID."),
|
|
456
456
|
dt: a(2).describe("Data type."),
|
|
457
|
-
ep: e.optional(
|
|
457
|
+
ep: e.optional(l()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
458
458
|
mf: e.optional(a(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
459
459
|
cmd: e.optional(a(2)).describe("Zigbee command."),
|
|
460
|
-
eval: e.optional(
|
|
461
|
-
script: e.optional(
|
|
460
|
+
eval: e.optional(m()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
461
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
462
462
|
}),
|
|
463
463
|
e.strictObject({
|
|
464
464
|
fn: e.literal("tuya").describe("Generic function to write Tuya data."),
|
|
465
465
|
dpid: e.number().describe("Data point ID. 1-255 the datapoint ID."),
|
|
466
466
|
dt: a(2).describe("Data type."),
|
|
467
|
-
eval: e.optional(
|
|
468
|
-
script: e.optional(
|
|
467
|
+
eval: e.optional(m()).describe("Javascript expression to transform the raw value."),
|
|
468
|
+
script: e.optional(f()).describe("Relative path of a Javascript .js file.")
|
|
469
469
|
})
|
|
470
470
|
]).refine((t) => !("eval" in t && "script" in t), {
|
|
471
471
|
message: "eval and script should not both be present"
|
|
@@ -478,8 +478,23 @@ function D(t) {
|
|
|
478
478
|
id: e.string(),
|
|
479
479
|
description: e.optional(e.string()).describe("Item description, better to do not use it."),
|
|
480
480
|
comment: e.optional(e.string()).describe("TODO: What is this ? What the difference with description ?"),
|
|
481
|
-
deprecated: e.optional(
|
|
482
|
-
datatype: e.optional(e.enum([
|
|
481
|
+
deprecated: e.optional(M()).describe("Date of deprecation, if the item is deprecated, it's better to use the new one."),
|
|
482
|
+
datatype: e.optional(e.enum([
|
|
483
|
+
"String",
|
|
484
|
+
"Bool",
|
|
485
|
+
"Int8",
|
|
486
|
+
"Int16",
|
|
487
|
+
"Int32",
|
|
488
|
+
"Int64",
|
|
489
|
+
"UInt8",
|
|
490
|
+
"UInt16",
|
|
491
|
+
"UInt32",
|
|
492
|
+
"UInt64",
|
|
493
|
+
"Double",
|
|
494
|
+
"Array",
|
|
495
|
+
"Array[3]",
|
|
496
|
+
"ISO 8601 timestamp"
|
|
497
|
+
])).describe("Data type of the item."),
|
|
483
498
|
access: e.optional(e.enum(["R", "W", "RW"])).describe("Access mode for this item, some of them are not editable."),
|
|
484
499
|
public: e.optional(e.boolean()).describe("Item visible on the API."),
|
|
485
500
|
implicit: e.optional(e.boolean()).describe("TODO: What is this ?"),
|
|
@@ -488,7 +503,7 @@ function D(t) {
|
|
|
488
503
|
static: e.optional(e.union([e.string(), e.number(), e.boolean()])).describe("A static default value is fixed and can be not changed."),
|
|
489
504
|
range: e.optional(e.tuple([e.number(), e.number()])).describe("Values range limit."),
|
|
490
505
|
virtual: e.optional(e.boolean()).describe("TODO: What is this ?"),
|
|
491
|
-
read: e.optional(
|
|
506
|
+
read: e.optional(J()).describe("Fonction used to read value."),
|
|
492
507
|
parse: e.optional(Z()).describe("Fonction used to parse incoming values."),
|
|
493
508
|
write: e.optional(R()).describe("Fonction used to write value."),
|
|
494
509
|
"refresh.interval": e.optional(e.number()).describe("Refresh interval used for read fonction, NEED to be superior at value used in binding part."),
|
|
@@ -521,8 +536,8 @@ function G(t) {
|
|
|
521
536
|
modelid: e.string().or(e.array(e.string())).describe("Model ID from Basic Cluster."),
|
|
522
537
|
vendor: e.optional(e.string()).describe("Friendly name of the manufacturer."),
|
|
523
538
|
comment: e.optional(e.string()),
|
|
524
|
-
matchexpr: e.optional(
|
|
525
|
-
path: e.optional(
|
|
539
|
+
matchexpr: e.optional(m()).describe("Need to return true for the DDF be used."),
|
|
540
|
+
path: e.optional(f()).describe("DDF path, useless, can be removed."),
|
|
526
541
|
product: e.optional(e.string()).describe("Complements the model id to be shown in the UI."),
|
|
527
542
|
sleeper: e.optional(e.boolean()).describe("Sleeping devices can only receive when awake."),
|
|
528
543
|
supportsMgmtBind: e.optional(e.boolean()),
|
|
@@ -534,7 +549,9 @@ function G(t) {
|
|
|
534
549
|
function F(t) {
|
|
535
550
|
return e.strictObject({
|
|
536
551
|
type: e.union([
|
|
537
|
-
e.enum(Object.keys(t.deviceTypes)
|
|
552
|
+
e.enum(Object.keys(t.deviceTypes), {
|
|
553
|
+
errorMap: (r, c) => r.code === "invalid_enum_value" ? { message: `Invalid enum value. Expected type from generic attributes definition, received '${r.received}'` } : { message: c.defaultError }
|
|
554
|
+
}),
|
|
538
555
|
e.string().regex(/^(?!\$TYPE_).*/g, "The type start with $TYPE_ but is not present in constants.json")
|
|
539
556
|
]),
|
|
540
557
|
restapi: e.enum(["/lights", "/sensors"]),
|
|
@@ -542,7 +559,7 @@ function F(t) {
|
|
|
542
559
|
fingerprint: e.optional(e.strictObject({
|
|
543
560
|
profile: a(4),
|
|
544
561
|
device: a(4),
|
|
545
|
-
endpoint:
|
|
562
|
+
endpoint: l(),
|
|
546
563
|
in: e.optional(e.array(a(4))),
|
|
547
564
|
out: e.optional(e.array(a(4)))
|
|
548
565
|
})),
|
|
@@ -565,15 +582,17 @@ function k(t) {
|
|
|
565
582
|
schema: !0,
|
|
566
583
|
id: !0
|
|
567
584
|
}).extend({
|
|
568
|
-
name: e.enum(t.attributes
|
|
585
|
+
name: e.enum(t.attributes, {
|
|
586
|
+
errorMap: (r, c) => r.code === "invalid_enum_value" ? { message: `Invalid enum value. Expected item from generic attributes definition, received '${r.received}'` } : { message: c.defaultError }
|
|
587
|
+
}).describe("Item name.")
|
|
569
588
|
});
|
|
570
589
|
}
|
|
571
590
|
function z(t) {
|
|
572
591
|
return e.discriminatedUnion("bind", [
|
|
573
592
|
e.strictObject({
|
|
574
593
|
bind: e.literal("unicast"),
|
|
575
|
-
"src.ep":
|
|
576
|
-
"dst.ep": e.optional(
|
|
594
|
+
"src.ep": l().describe("Source endpoint."),
|
|
595
|
+
"dst.ep": e.optional(l()).describe("Destination endpoint, generaly 0x01."),
|
|
577
596
|
cl: a(4).describe("Cluster."),
|
|
578
597
|
report: e.optional(e.array(
|
|
579
598
|
e.strictObject({
|
|
@@ -588,26 +607,33 @@ function z(t) {
|
|
|
588
607
|
}),
|
|
589
608
|
e.strictObject({
|
|
590
609
|
bind: e.literal("groupcast"),
|
|
591
|
-
"src.ep":
|
|
610
|
+
"src.ep": l().describe("Source endpoint."),
|
|
592
611
|
cl: a(4).describe("Cluster."),
|
|
593
612
|
"config.group": e.number().min(0).max(255)
|
|
594
613
|
})
|
|
595
614
|
]);
|
|
596
615
|
}
|
|
597
616
|
function L(t) {
|
|
617
|
+
const r = e.array(
|
|
618
|
+
e.enum(t.attributes, {
|
|
619
|
+
errorMap: (c, n) => c.code === "invalid_enum_value" ? { message: `Invalid enum value. Expected item from generic attributes definition, received '${c.received}'` } : { message: n.defaultError }
|
|
620
|
+
})
|
|
621
|
+
);
|
|
598
622
|
return e.strictObject({
|
|
599
623
|
$schema: e.optional(e.string()),
|
|
600
624
|
schema: e.literal("subdevice1.schema.json"),
|
|
601
625
|
type: e.union([
|
|
602
|
-
e.enum(Object.keys(t.deviceTypes)
|
|
626
|
+
e.enum(Object.keys(t.deviceTypes), {
|
|
627
|
+
errorMap: (c, n) => c.code === "invalid_enum_value" ? { message: `Invalid enum value. Expected type from generic attributes definition, received '${c.received}'` } : { message: n.defaultError }
|
|
628
|
+
}),
|
|
603
629
|
e.string().regex(/^(?!\$TYPE_).*/g, "The type start with $TYPE_ but is not present in constants.json")
|
|
604
630
|
]),
|
|
605
631
|
name: e.string(),
|
|
606
632
|
restapi: e.enum(["/lights", "/sensors"]),
|
|
607
633
|
order: e.number(),
|
|
608
634
|
uuid: j(),
|
|
609
|
-
items:
|
|
610
|
-
items_optional: e.optional(
|
|
635
|
+
items: r,
|
|
636
|
+
items_optional: e.optional(r)
|
|
611
637
|
});
|
|
612
638
|
}
|
|
613
639
|
function x(t) {
|
|
@@ -617,13 +643,13 @@ function x(t) {
|
|
|
617
643
|
I(),
|
|
618
644
|
D(),
|
|
619
645
|
L(t)
|
|
620
|
-
]).superRefine((r,
|
|
646
|
+
]).superRefine((r, c) => {
|
|
621
647
|
switch (r.schema) {
|
|
622
648
|
case "devcap1.schema.json":
|
|
623
|
-
y[r.schema].map((
|
|
649
|
+
y[r.schema].map((n) => n(r, c, t));
|
|
624
650
|
break;
|
|
625
651
|
case "constants2.schema.json":
|
|
626
|
-
y[r.schema].map((
|
|
652
|
+
y[r.schema].map((n) => n(r, c, t));
|
|
627
653
|
break;
|
|
628
654
|
}
|
|
629
655
|
});
|
|
@@ -636,11 +662,11 @@ function W(t = {
|
|
|
636
662
|
subDevices: {}
|
|
637
663
|
}) {
|
|
638
664
|
let r = x(t);
|
|
639
|
-
const
|
|
665
|
+
const c = () => {
|
|
640
666
|
r = x(t);
|
|
641
667
|
};
|
|
642
|
-
return { generics: t, loadGeneric: (
|
|
643
|
-
const s = r.parse(
|
|
668
|
+
return { generics: t, loadGeneric: (o) => {
|
|
669
|
+
const s = r.parse(o);
|
|
644
670
|
switch (s.schema) {
|
|
645
671
|
case "constants1.schema.json":
|
|
646
672
|
t.manufacturers = {
|
|
@@ -662,8 +688,8 @@ function W(t = {
|
|
|
662
688
|
case "resourceitem1.schema.json": {
|
|
663
689
|
if (t.attributes.includes(s.id))
|
|
664
690
|
throw new Error(`Got duplicate resource item with attribute id '${s.id}'.`);
|
|
665
|
-
const i = s,
|
|
666
|
-
delete i.$schema, delete i.schema, delete i.id, t.resources[
|
|
691
|
+
const i = s, u = s.id;
|
|
692
|
+
delete i.$schema, delete i.schema, delete i.id, t.resources[u] = i, t.attributes.push(u);
|
|
667
693
|
break;
|
|
668
694
|
}
|
|
669
695
|
case "subdevice1.schema.json":
|
|
@@ -672,8 +698,8 @@ function W(t = {
|
|
|
672
698
|
case "devcap1.schema.json":
|
|
673
699
|
throw new Error("Got invalid generic file, got data with schema 'devcap1.schema.json'.");
|
|
674
700
|
}
|
|
675
|
-
return
|
|
676
|
-
}, validate: (
|
|
701
|
+
return c(), !0;
|
|
702
|
+
}, validate: (o) => r.parse(o), getSchema: () => r, version: E };
|
|
677
703
|
}
|
|
678
704
|
export {
|
|
679
705
|
W as createValidator
|