@deconz-community/ddf-validator 2.4.0 → 2.7.1
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 +3 -0
- package/dist/ddf-validator.mjs +5 -2
- package/package.json +20 -20
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"},"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_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","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/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/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":"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","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_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/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/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_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","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/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/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":"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","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_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/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/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#"}
|
package/dist/ddf-validator.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),x=[I,j,D,O];function I(a,i){const n=typeof a.manufacturername=="string"&&typeof a.modelid=="string";if(n)return;const d=Array.isArray(a.manufacturername)&&Array.isArray(a.modelid);if(d&&a.manufacturername.length!==a.modelid.length){i.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&&i.addIssue({code:e.z.ZodIssueCode.invalid_intersection_types,message:"Invalid properties 'manufacturername' and 'modelid' should have the same type",path:["manufacturername","modelid"]})}function j(a,i){if(!a.bindings)return;const n=s=>`0x${(typeof s=="number"?s:parseInt(s,16)).toString(16)}`,d={};a.bindings.forEach(s=>{s.bind==="unicast"&&s.report&&s.report.forEach(m=>{m.max!==65535&&(d[`${n(s["src.ep"])}.${n(s.cl)}.${n(m.at)}`]=m.max)})}),a.subdevices.forEach((s,m)=>{s.items.forEach((r,o)=>{var c;if(r["refresh.interval"]&&r.read&&r.read.fn==="zcl"){const f=n(r.read.ep??((c=s.fingerprint)==null?void 0:c.endpoint)??s.uuid[1]),b=Array.isArray(r.read.at)?r.read.at:[r.read.at];for(let z=0;z<b.length;z++){const h=`${f}.${n(r.read.cl)}.${n(b[z])}`;d[h]!==void 0&&r["refresh.interval"]-60<d[h]&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The refresh interval (${r["refresh.interval"]} - 60 = ${r["refresh.interval"]-60}) should be greater than the binding max refresh value (${d[h]}) with a margin of 60 seconds`,path:["subdevices",m,"items",o,"refresh.interval"]})}}})})}function D(a,i){if(!a.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"]}}];a.subdevices.forEach((d,s)=>{const m=d.items.map(r=>r.name);n.forEach(r=>{(Object.keys(r.if).length===0||Object.keys(r.if).some(o=>{var c;switch(o){case"type":return(c=r.if[o])==null?void 0:c.includes(d.type);case"item":return m.some(f=>{var b;return(b=r.if[o])==null?void 0:b.includes(f)});default:return!1}}))&&r.need.item.forEach(o=>{m.includes(o)||i.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${o}" because ${r.description}`,path:["subdevices",s,"items"]})})})})}function O(a,i){const n=["parse","write"];a.subdevices.forEach((d,s)=>{d.items.forEach((m,r)=>{n.forEach(o=>{const c=m[o];c!==void 0&&(c.fn===void 0||c.fn==="zcl"||c.fn==="zcl:attr"||c.fn==="zcl:cmd")&&(c.eval===void 0&&c.script===void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${o}' function is missing 'eval' or 'script' option.`,path:["subdevices",s,"items",r,o]}),c.eval!==void 0&&c.script!==void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${o}' function is having both 'eval' and 'script' option.`,path:["subdevices",s,"items",r,o]}))})})})}function w(a){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 E(){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 t(a=void 0){const i="Invalid hexadecimal value";return a===void 0?e.z.string().regex(/^0x[0-9a-fA-F]+$/,i):e.z.string().regex(new RegExp(`^0x[0-9a-fA-F]{${a}}$`),i)}function u(){return e.z.union([t(2),e.z.number().min(0).max(255)])}function T(){return e.z.custom(a=>{if(!Array.isArray(a)||a.length%2!==0)return!1;for(let i=0;i<a.length;i+=2){const n=a[i],d=a[i+1];if(typeof n!="number"||typeof d!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function g(){return e.z.union([e.z.tuple([e.z.literal("$address.ext"),t(2)]),e.z.tuple([e.z.literal("$address.ext"),t(2),t(4)])])}function p(){return e.z.string()}function l(){return e.z.string()}function $(){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:t(4).or(e.z.array(t(4))).describe("Attribute ID."),cl:t(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(t(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:t(4).or(e.z.array(t(4))).describe("Attribute ID."),cl:t(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(t(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:t(4).or(e.z.array(t(4))).describe("String hex value or array of string hex values."),cl:t(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(t(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:t(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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(t(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(a=>!("eval"in a&&"script"in a),{message:"eval and script should not both be present"})}function C(){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(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),cl:t(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(t(2)).describe("Zigbee command."),mf:e.z.optional(t(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(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),cl:t(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(t(2)).describe("Zigbee command."),mf:e.z.optional(t(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:t(4).or(e.z.array(t(4))).describe("String hex value or array of string hex values."),cl:t(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(t(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:t(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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(t(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:T().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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),at:e.z.optional(t(4)).describe("Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"),idx:t(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(a=>!("eval"in a&&"script"in a),{message:"eval and script should not both be present"})}function A(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.literal("none")}),e.z.strictObject({fn:e.z.undefined(),at:e.z.optional(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:t(4).describe("Cluster ID."),dt:t(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(t(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(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:t(4).describe("Cluster ID."),dt:t(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(t(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:t(4).or(e.z.array(t(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:t(4).describe("Cluster ID."),dt:t(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(t(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:t(4).describe("Cluster ID."),dt:t(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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(t(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:t(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(a=>!("eval"in a&&"script"in a),{message:"eval and script should not both be present"})}function y(a){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(E()).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","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($()).describe("Fonction used to read value."),parse:e.z.optional(C()).describe("Fonction used to parse incoming values."),write:e.z.optional(A()).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 S(a){return e.z.strictObject({$schema:e.z.optional(e.z.string()),schema:e.z.literal("devcap1.schema.json"),"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(a.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(a.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(_(a)).describe("Devices section."),bindings:e.z.optional(e.z.array(R())).describe("Bindings section.")})}function _(a){return e.z.strictObject({type:e.z.union([e.z.enum(Object.keys(a.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:g(),fingerprint:e.z.optional(e.z.strictObject({profile:t(4),device:t(4),endpoint:u(),in:e.z.optional(e.z.array(t(4))),out:e.z.optional(e.z.array(t(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(J(a)),example:e.z.optional(e.z.unknown())})}function J(a){return y().omit({$schema:!0,schema:!0,id:!0}).extend({name:e.z.enum(a.attributes).describe("Item name.")})}function R(a){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:t(4).describe("Cluster."),report:e.z.optional(e.z.array(e.z.strictObject({at:t(4),dt:t(2),mf:e.z.optional(t(4)),min:e.z.number(),max:e.z.number(),change:e.z.optional(t().or(e.z.number()))}).refine(i=>i.min<=i.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:t(4).describe("Cluster."),"config.group":e.z.number().min(0).max(255)})])}function M(a){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(a.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:g(),items:e.z.array(e.z.enum(a.attributes))})}function v(a){return e.z.discriminatedUnion("schema",[S(a),w(),y(),M(a)]).superRefine((i,n)=>{switch(i.schema){case"devcap1.schema.json":x.map(d=>d(i,n));break}})}function G(a={attributes:[],manufacturers:{},deviceTypes:{},resources:{}}){let i=v(a);const n=()=>{i=v(a)};return{generics:a,loadGeneric:m=>{const r=i.parse(m);switch(r.schema){case"constants1.schema.json":a.manufacturers={...a.manufacturers,...r.manufacturers},a.deviceTypes={...a.deviceTypes,...r["device-types"]};break;case"resourceitem1.schema.json":{if(a.attributes.includes(r.id))throw new Error(`Got duplicate resource item with attribute id '${r.id}'.`);const o=r,c=r.id;delete o.$schema,delete o.schema,delete o.id,a.resources[c]=o,a.attributes.push(c);break}case"subdevice1.schema.json":break;case"devcap1.schema.json":throw new Error("Got invalid generic file, got data with schema 'devcap1.schema.json'.")}return n(),!0},validate:m=>i.parse(m),getSchema:()=>i}}exports.createValidator=G;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),x=[I,j,D,O];function I(a,i){const n=typeof a.manufacturername=="string"&&typeof a.modelid=="string";if(n)return;const d=Array.isArray(a.manufacturername)&&Array.isArray(a.modelid);if(d&&a.manufacturername.length!==a.modelid.length){i.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&&i.addIssue({code:e.z.ZodIssueCode.invalid_intersection_types,message:"Invalid properties 'manufacturername' and 'modelid' should have the same type",path:["manufacturername","modelid"]})}function j(a,i){if(!a.bindings)return;const n=s=>`0x${(typeof s=="number"?s:parseInt(s,16)).toString(16)}`,d={};a.bindings.forEach(s=>{s.bind==="unicast"&&s.report&&s.report.forEach(m=>{m.max!==65535&&(d[`${n(s["src.ep"])}.${n(s.cl)}.${n(m.at)}`]=m.max)})}),a.subdevices.forEach((s,m)=>{s.items.forEach((r,o)=>{var c;if(r["refresh.interval"]&&r.read&&r.read.fn==="zcl"){const f=n(r.read.ep??((c=s.fingerprint)==null?void 0:c.endpoint)??s.uuid[1]),b=Array.isArray(r.read.at)?r.read.at:[r.read.at];for(let z=0;z<b.length;z++){const h=`${f}.${n(r.read.cl)}.${n(b[z])}`;d[h]!==void 0&&r["refresh.interval"]-60<d[h]&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The refresh interval (${r["refresh.interval"]} - 60 = ${r["refresh.interval"]-60}) should be greater than the binding max refresh value (${d[h]}) with a margin of 60 seconds`,path:["subdevices",m,"items",o,"refresh.interval"]})}}})})}function D(a,i){if(!a.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"]}}];a.subdevices.forEach((d,s)=>{const m=d.items.map(r=>r.name);n.forEach(r=>{(Object.keys(r.if).length===0||Object.keys(r.if).some(o=>{var c;switch(o){case"type":return(c=r.if[o])==null?void 0:c.includes(d.type);case"item":return m.some(f=>{var b;return(b=r.if[o])==null?void 0:b.includes(f)});default:return!1}}))&&r.need.item.forEach(o=>{m.includes(o)||i.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${o}" because ${r.description}`,path:["subdevices",s,"items"]})})})})}function O(a,i){const n=["parse","write"];a.subdevices.forEach((d,s)=>{d.items.forEach((m,r)=>{n.forEach(o=>{const c=m[o];c!==void 0&&(c.fn===void 0||c.fn==="zcl"||c.fn==="zcl:attr"||c.fn==="zcl:cmd")&&(c.eval===void 0&&c.script===void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${o}' function is missing 'eval' or 'script' option.`,path:["subdevices",s,"items",r,o]}),c.eval!==void 0&&c.script!==void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${o}' function is having both 'eval' and 'script' option.`,path:["subdevices",s,"items",r,o]}))})})})}function w(a){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 E(){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 t(a=void 0){const i="Invalid hexadecimal value";return a===void 0?e.z.string().regex(/^0x[0-9a-fA-F]+$/,i):e.z.string().regex(new RegExp(`^0x[0-9a-fA-F]{${a}}$`),i)}function u(){return e.z.union([t(2),e.z.number().min(0).max(255)])}function T(){return e.z.custom(a=>{if(!Array.isArray(a)||a.length%2!==0)return!1;for(let i=0;i<a.length;i+=2){const n=a[i],d=a[i+1];if(typeof n!="number"||typeof d!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function g(){return e.z.union([e.z.tuple([e.z.literal("$address.ext"),t(2)]),e.z.tuple([e.z.literal("$address.ext"),t(2),t(4)])])}function p(){return e.z.string()}function l(){return e.z.string()}function $(){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:t(4).or(e.z.array(t(4))).describe("Attribute ID."),cl:t(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(t(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:t(4).or(e.z.array(t(4))).describe("Attribute ID."),cl:t(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(t(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:t(4).or(e.z.array(t(4))).describe("String hex value or array of string hex values."),cl:t(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(t(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:t(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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(t(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(a=>!("eval"in a&&"script"in a),{message:"eval and script should not both be present"})}function C(){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(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),cl:t(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(t(2)).describe("Zigbee command."),mf:e.z.optional(t(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(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),cl:t(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(t(2)).describe("Zigbee command."),mf:e.z.optional(t(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:t(4).or(e.z.array(t(4))).describe("String hex value or array of string hex values."),cl:t(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(t(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:t(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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(t(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:T().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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),at:e.z.optional(t(4)).describe("Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"),idx:t(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(a=>!("eval"in a&&"script"in a),{message:"eval and script should not both be present"})}function A(){return e.z.discriminatedUnion("fn",[e.z.strictObject({fn:e.z.literal("none")}),e.z.strictObject({fn:e.z.undefined(),at:e.z.optional(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:t(4).describe("Cluster ID."),dt:t(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(t(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(t(4).or(e.z.array(t(4)))).describe("Attribute ID."),"state.timeout":e.z.optional(e.z.number()),"change.timeout":e.z.optional(e.z.number()),cl:t(4).describe("Cluster ID."),dt:t(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(t(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:t(4).or(e.z.array(t(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:t(4).describe("Cluster ID."),dt:t(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(t(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:t(4).describe("Cluster ID."),dt:t(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(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),cmd:e.z.optional(t(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:t(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(a=>!("eval"in a&&"script"in a),{message:"eval and script should not both be present"})}function y(a){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(E()).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","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($()).describe("Fonction used to read value."),parse:e.z.optional(C()).describe("Fonction used to parse incoming values."),write:e.z.optional(A()).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 _(a){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(a.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(a.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(S(a)).describe("Devices section."),bindings:e.z.optional(e.z.array(R())).describe("Bindings section.")})}function S(a){return e.z.strictObject({type:e.z.union([e.z.enum(Object.keys(a.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:g(),fingerprint:e.z.optional(e.z.strictObject({profile:t(4),device:t(4),endpoint:u(),in:e.z.optional(e.z.array(t(4))),out:e.z.optional(e.z.array(t(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(J(a)),example:e.z.optional(e.z.unknown())})}function J(a){return y().omit({$schema:!0,schema:!0,id:!0}).extend({name:e.z.enum(a.attributes).describe("Item name.")})}function R(a){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:t(4).describe("Cluster."),report:e.z.optional(e.z.array(e.z.strictObject({at:t(4),dt:t(2),mf:e.z.optional(t(4)),min:e.z.number(),max:e.z.number(),change:e.z.optional(t().or(e.z.number()))}).refine(i=>i.min<=i.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:t(4).describe("Cluster."),"config.group":e.z.number().min(0).max(255)})])}function M(a){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(a.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:g(),items:e.z.array(e.z.enum(a.attributes))})}function v(a){return e.z.discriminatedUnion("schema",[_(a),w(),y(),M(a)]).superRefine((i,n)=>{switch(i.schema){case"devcap1.schema.json":x.map(d=>d(i,n));break}})}function G(a={attributes:[],manufacturers:{},deviceTypes:{},resources:{}}){let i=v(a);const n=()=>{i=v(a)};return{generics:a,loadGeneric:m=>{const r=i.parse(m);switch(r.schema){case"constants1.schema.json":a.manufacturers={...a.manufacturers,...r.manufacturers},a.deviceTypes={...a.deviceTypes,...r["device-types"]};break;case"resourceitem1.schema.json":{if(a.attributes.includes(r.id))throw new Error(`Got duplicate resource item with attribute id '${r.id}'.`);const o=r,c=r.id;delete o.$schema,delete o.schema,delete o.id,a.resources[c]=o,a.attributes.push(c);break}case"subdevice1.schema.json":break;case"devcap1.schema.json":throw new Error("Got invalid generic file, got data with schema 'devcap1.schema.json'.")}return n(),!0},validate:m=>i.parse(m),getSchema:()=>i}}exports.createValidator=G;
|
package/dist/ddf-validator.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { ZodType } from "zod";
|
|
|
3
3
|
export type DDF = {
|
|
4
4
|
$schema?: string | undefined;
|
|
5
5
|
schema: "devcap1.schema.json";
|
|
6
|
+
uuid?: string | undefined;
|
|
7
|
+
version?: string | undefined;
|
|
8
|
+
version_deconz?: string | undefined;
|
|
6
9
|
"doc:path"?: string | undefined;
|
|
7
10
|
"doc:hdr"?: string | undefined;
|
|
8
11
|
/** Know issues for this device, markdown file. */
|
package/dist/ddf-validator.mjs
CHANGED
|
@@ -434,6 +434,9 @@ function J(a) {
|
|
|
434
434
|
return e.strictObject({
|
|
435
435
|
$schema: e.optional(e.string()),
|
|
436
436
|
schema: e.literal("devcap1.schema.json"),
|
|
437
|
+
uuid: e.optional(e.string()),
|
|
438
|
+
version: e.optional(e.string()),
|
|
439
|
+
version_deconz: e.optional(e.string()),
|
|
437
440
|
"doc:path": e.optional(e.string()),
|
|
438
441
|
"doc:hdr": e.optional(e.string()),
|
|
439
442
|
"md:known_issues": e.optional(e.array(e.string())).describe("Know issues for this device, markdown file."),
|
|
@@ -552,7 +555,7 @@ function g(a) {
|
|
|
552
555
|
}
|
|
553
556
|
});
|
|
554
557
|
}
|
|
555
|
-
function
|
|
558
|
+
function z(a = {
|
|
556
559
|
attributes: [],
|
|
557
560
|
manufacturers: {},
|
|
558
561
|
deviceTypes: {},
|
|
@@ -590,5 +593,5 @@ function k(a = {
|
|
|
590
593
|
}, validate: (m) => i.parse(m), getSchema: () => i };
|
|
591
594
|
}
|
|
592
595
|
export {
|
|
593
|
-
|
|
596
|
+
z as createValidator
|
|
594
597
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deconz-community/ddf-validator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Validating DDF files for deconz",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deconz",
|
|
@@ -54,30 +54,30 @@
|
|
|
54
54
|
"node": ">=16.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/jsdom": "^
|
|
58
|
-
"@types/node": "^
|
|
57
|
+
"@types/jsdom": "^21.1.1",
|
|
58
|
+
"@types/node": "^20.4.2",
|
|
59
59
|
"@types/pako": "^2.0.0",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
61
|
-
"@typescript-eslint/parser": "^
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
61
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
62
62
|
"degit": "^2.8.4",
|
|
63
|
-
"eslint": "^8.
|
|
63
|
+
"eslint": "^8.44.0",
|
|
64
64
|
"eslint-config-prettier": "^8.8.0",
|
|
65
|
-
"eslint-plugin-prettier": "^
|
|
66
|
-
"glob": "^
|
|
67
|
-
"lint-staged": "^13.2.
|
|
68
|
-
"prettier": "^
|
|
69
|
-
"rimraf": "^
|
|
70
|
-
"stylelint": "^
|
|
71
|
-
"stylelint-config-recommended": "^
|
|
72
|
-
"stylelint-config-sass-guidelines": "^
|
|
73
|
-
"taze": "^0.
|
|
65
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
66
|
+
"glob": "^10.3.3",
|
|
67
|
+
"lint-staged": "^13.2.3",
|
|
68
|
+
"prettier": "^3.0.0",
|
|
69
|
+
"rimraf": "^5.0.1",
|
|
70
|
+
"stylelint": "^15.10.1",
|
|
71
|
+
"stylelint-config-recommended": "^13.0.0",
|
|
72
|
+
"stylelint-config-sass-guidelines": "^10.0.0",
|
|
73
|
+
"taze": "^0.11.2",
|
|
74
74
|
"ts-node": "^10.9.1",
|
|
75
|
-
"typescript": "^
|
|
76
|
-
"vite": "^4.3
|
|
77
|
-
"vitest": "^0.
|
|
78
|
-
"zod-to-json-schema": "^3.21.
|
|
75
|
+
"typescript": "^5.1.6",
|
|
76
|
+
"vite": "^4.4.3",
|
|
77
|
+
"vitest": "^0.33.0",
|
|
78
|
+
"zod-to-json-schema": "^3.21.4",
|
|
79
79
|
"zod-to-ts": "^1.1.4",
|
|
80
|
-
"zod-validation-error": "^1.3.
|
|
80
|
+
"zod-validation-error": "^1.3.1"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"zod": "^3.21.4"
|