@deconz-community/ddf-validator 2.9.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ddf-schema.json +1 -1
- package/dist/ddf-validator.cjs +1 -1
- package/dist/ddf-validator.d.ts +7 -7
- package/dist/ddf-validator.mjs +47 -32
- package/package.json +2 -2
package/dist/ddf-schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$ref":"#/definitions/DDF","definitions":{"DDF":{"anyOf":[{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"devcap1.schema.json"},"uuid":{"type":"string"},"version":{"type":"string"},"version_deconz":{"type":"string"},"doc:path":{"type":"string"},"doc:hdr":{"type":"string"},"md:known_issues":{"type":"array","items":{"type":"string"},"description":"Know issues for this device, markdown file."},"manufacturername":{"anyOf":[{"type":"string","enum":["$MF_BOSCH","$MF_LUMI","$MF_LUTRON","$MF_PHILIPS","$MF_SAMJIN","$MF_SIGNIFY","$MF_TUYA","$MF_XIAOMI","$MF_IKEA"]},{"type":"string","pattern":"^(?!\\$MF_).*"},{"type":"array","items":{"anyOf":[{"type":"string","enum":["$MF_BOSCH","$MF_LUMI","$MF_LUTRON","$MF_PHILIPS","$MF_SAMJIN","$MF_SIGNIFY","$MF_TUYA","$MF_XIAOMI","$MF_IKEA"]},{"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_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_AIR_PURIFIER"]},{"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":"constants2.schema.json"}},"required":["schema"],"additionalProperties":true},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"resourceitem1.schema.json"},"id":{"type":"string"},"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","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_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_AIR_PURIFIER"]},{"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_CARBONDIOXIDE_SENSOR","$TYPE_FORMALDEHYDE_SENSOR","$TYPE_PARTICULATEMATTER_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_MOISTURE_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_LIGHT_SWITCH","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$TYPE_ON_OFF_SWITCH","$TYPE_OPEN_CLOSE_SENSOR","$TYPE_POWER_SENSOR","$TYPE_PRESENCE_SENSOR","$TYPE_PRESSURE_SENSOR","$TYPE_RANGE_EXTENDER","$TYPE_RELATIVE_ROTARY","$TYPE_SMART_PLUG","$TYPE_SPECTRAL_SENSOR","$TYPE_SWITCH","$TYPE_TEMPERATURE_SENSOR","$TYPE_THERMOSTAT","$TYPE_VIBRATION_SENSOR","$TYPE_WARNING_DEVICE","$TYPE_WATER_LEAK_SENSOR","$TYPE_WINDOW_COVERING_DEVICE","$TYPE_ZGP_SWITCH"]},{"type":"string","pattern":"^(?!\\$TYPE_).*"}]},"restapi":{"type":"string","enum":["/lights","/sensors"]},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}]}]},"fingerprint":{"type":"object","properties":{"profile":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"device":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"endpoint":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}]},"in":{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}},"out":{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}},"required":["profile","device","endpoint"],"additionalProperties":false},"meta":{"type":"object","properties":{"values":{},"group.endpoints":{"type":"array","items":{"type":"number"}}},"additionalProperties":false},"buttons":{},"buttonevents":{},"items":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"],"description":"Data type of the item."},"access":{"type":"string","enum":["R","W","RW"],"description":"Access mode for this item, some of them are not editable."},"public":{"type":"boolean","description":"Item visible on the API."},"implicit":{"type":"boolean","description":"TODO: What is this ?"},"managed":{"type":"boolean","description":"TODO: What is this ?"},"awake":{"type":"boolean","description":"The device is considered awake when this item is set due a incoming command."},"static":{"type":["string","number","boolean"],"description":"A static default value is fixed and can be not changed."},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}],"description":"Values range limit."},"virtual":{"type":"boolean","description":"TODO: What is this ?"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."}},"required":["at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to read all Tuya datapoints. It has no parameters."}},"required":["fn"],"additionalProperties":false}],"description":"Fonction used to read value."},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus","description":"Generic function to parse IAS ZONE status change notifications or zone status from read/report command."},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}],"description":"Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr","description":"Generic function to to convert number to string."},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"],"description":"The source item holding the number."},"op":{"type":"string","enum":["lt","le","eq","gt","ge"],"description":"Comparison operator (lt | le | eq | gt | ge)"},"to":{"description":"Array of (num, string) mappings"}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time","description":"Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special","description":"Generic function to parse custom Xiaomi attributes and commands."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"},"idx":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"A 8-bit string hex value."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to parse Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid"],"additionalProperties":false}],"description":"Fonction used to parse incoming values."},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to write Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid","dt"],"additionalProperties":false}],"description":"Fonction used to write value."},"refresh.interval":{"type":"number","description":"Refresh interval used for read fonction, NEED to be superior at value used in binding part."},"values":{"description":"TODO: What is this ?"},"default":{"description":"Defaut value."},"name":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"],"description":"Item name."}},"required":["name"],"additionalProperties":false}},"example":{}},"required":["type","restapi","uuid","items"],"additionalProperties":false},"description":"Devices section."},"bindings":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"bind":{"type":"string","const":"unicast"},"src.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Source endpoint."},"dst.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Destination endpoint, generaly 0x01."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster."},"report":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},"min":{"type":"number"},"max":{"type":"number"},"change":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]+$"},{"type":"number"}]}},"required":["at","dt","min","max"],"additionalProperties":false}}},"required":["bind","src.ep","cl"],"additionalProperties":false},{"type":"object","properties":{"bind":{"type":"string","const":"groupcast"},"src.ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Source endpoint."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster."},"config.group":{"type":"number","minimum":0,"maximum":255}},"required":["bind","src.ep","cl","config.group"],"additionalProperties":false}]},"description":"Bindings section."}},"required":["schema","manufacturername","modelid","status","subdevices"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants1.schema.json"},"manufacturers":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$MF\\_"}},"device-types":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$TYPE\\_"}}},"required":["schema","manufacturers","device-types"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants2.schema.json"}},"required":["schema"],"additionalProperties":true},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"resourceitem1.schema.json"},"id":{"type":"string"},"description":{"type":"string","description":"Item description, better to do not use it."},"comment":{"type":"string","description":"TODO: What is this ? What the difference with description ?"},"deprecated":{"type":"string","pattern":"^(\\d{4})-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01]))$","description":"Date of deprecation, if the item is deprecated, it's better to use the new one."},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"],"description":"Data type of the item."},"access":{"type":"string","enum":["R","W","RW"],"description":"Access mode for this item, some of them are not editable."},"public":{"type":"boolean","description":"Item visible on the API."},"implicit":{"type":"boolean","description":"TODO: What is this ?"},"managed":{"type":"boolean","description":"TODO: What is this ?"},"awake":{"type":"boolean","description":"The device is considered awake when this item is set due a incoming command."},"static":{"type":["string","number","boolean"],"description":"A static default value is fixed and can be not changed."},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}],"description":"Values range limit."},"virtual":{"type":"boolean","description":"TODO: What is this ?"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."}},"required":["at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to read ZCL attributes."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to read all Tuya datapoints. It has no parameters."}},"required":["fn"],"additionalProperties":false}],"description":"Fonction used to read value."},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{},"description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl","description":"Generic function to parse ZCL attributes and commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus","description":"Generic function to parse IAS ZONE status change notifications or zone status from read/report command."},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}],"description":"Sets the bitmask for Alert1 and Alert2 item of the IAS Zone status."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr","description":"Generic function to to convert number to string."},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"],"description":"The source item holding the number."},"op":{"type":"string","enum":["lt","le","eq","gt","ge"],"description":"Comparison operator (lt | le | eq | gt | ge)"},"to":{"description":"Array of (num, string) mappings"}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time","description":"Specialized function to parse time, local and last set time from read/report commands of the time cluster and auto-sync time if needed."}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special","description":"Generic function to parse custom Xiaomi attributes and commands."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"at":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"},"idx":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"A 8-bit string hex value."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to parse Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid"],"additionalProperties":false}],"description":"Fonction used to parse incoming values."},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"Attribute ID."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false,"description":"Deprecated"},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:attr","description":"Generic function to parse ZCL values from read/report commands."},"at":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"},{"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}}],"description":"String hex value or array of string hex values."},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","at","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl:cmd","description":"Generic function to parse ZCL values from read/report commands."},"cl":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Cluster ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"ep":{"anyOf":[{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"number","minimum":0,"maximum":255}],"description":"Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."},"mf":{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$","description":"Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."},"cmd":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Zigbee command."},"eval":{"type":"string","description":"Javascript expression to transform the attribute value to the Item value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya","description":"Generic function to write Tuya data."},"dpid":{"type":"number","description":"Data point ID. 1-255 the datapoint ID."},"dt":{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$","description":"Data type."},"eval":{"type":"string","description":"Javascript expression to transform the raw value."},"script":{"type":"string","description":"Relative path of a Javascript .js file."}},"required":["fn","dpid","dt"],"additionalProperties":false}],"description":"Fonction used to write value."},"refresh.interval":{"type":"number","description":"Refresh interval used for read fonction, NEED to be superior at value used in binding part."},"values":{"description":"TODO: What is this ?"},"default":{"description":"Defaut value."}},"required":["schema","id"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"subdevice1.schema.json"},"type":{"anyOf":[{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_CARBONDIOXIDE_SENSOR","$TYPE_FORMALDEHYDE_SENSOR","$TYPE_PARTICULATEMATTER_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_MOISTURE_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_LIGHT_SWITCH","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$TYPE_ON_OFF_SWITCH","$TYPE_OPEN_CLOSE_SENSOR","$TYPE_POWER_SENSOR","$TYPE_PRESENCE_SENSOR","$TYPE_PRESSURE_SENSOR","$TYPE_RANGE_EXTENDER","$TYPE_RELATIVE_ROTARY","$TYPE_SMART_PLUG","$TYPE_SPECTRAL_SENSOR","$TYPE_SWITCH","$TYPE_TEMPERATURE_SENSOR","$TYPE_THERMOSTAT","$TYPE_VIBRATION_SENSOR","$TYPE_WARNING_DEVICE","$TYPE_WATER_LEAK_SENSOR","$TYPE_WINDOW_COVERING_DEVICE","$TYPE_ZGP_SWITCH"]},{"type":"string","pattern":"^(?!\\$TYPE_).*"}]},"name":{"type":"string"},"restapi":{"type":"string","enum":["/lights","/sensors"]},"order":{"type":"number"},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","pattern":"^0x[0-9a-fA-F]{2}$"},{"type":"string","pattern":"^0x[0-9a-fA-F]{4}$"}]}]},"items":{"type":"array","items":{"type":"string","enum":["state/windowopen","state/water","state/water_bis","state/voltage","state/vibrationstrength","state/vibration","state/valve","state/utc","state/tiltangle","state/tilt","state/test","state/temperature","state/temperature_bis","state/tampered","state/speed","state/seconds_remaining","state/sat","state/rotaryevent","state/replacefilter","state/reachable","state/production","state/pressure","state/pressure_bis","state/presenceevent","state/presence","state/power","state/pm2_5","state/panel","state/orientation_z","state/orientation_y","state/orientation_x","state/open","state/open_bis","state/on","state/mountingmodeactive","state/moisture","state/measured_value","state/lux","state/lowbattery","state/lockstate","state/localtime","state/lightlevel","state/lift","state/lastupdated","state/lastset","state/lastcheckin","state/humidity","state/humidity_bis","state/hue","state/heating","state/gradient","state/gesture","state/fire","state/filterruntime","state/expectedrotation","state/expectedeventduration","state/eventduration","state/errorcode","state/effect","state/deviceruntime","state/daylight","state/dark","state/current","state/current_P3","state/current_P2","state/current_P1","state/ct","state/consumption","state/consumption_2","state/y","state/x","state/colormode","state/charging","state/carbonmonoxide","state/buttonevent","state/bri","state/battery","state/angle","state/alert","state/alarm","state/airqualityppb","state/airqualityppb_bis","state/airquality","state/airquality_bis","state/action","config/windowopen_set","config/windowcoveringtype","config/volume","config/usertest","config/unoccupiedheatsetpoint","config/tuya_unlock","config/triggerdistance","config/triggerdistance_bis","config/tholdoffset","config/tholddark","config/temperature","config/swingmode","config/speed","config/sensitivitymax","config/sensitivity","config/sensitivity_bis","config/selftest","config/schedule_on","config/schedule","config/reversed","config/resetpresence","config/reportgrid","config/reachable","config/pulseconfiguration","config/preset","config/pending","config/on/startup","config/on","config/offset","config/mountingmode","config/mode","config/melody","config/locked","config/lock","config/ledindication","config/interfacemode","config/heatsetpoint","config/group","config/filterlifetime","config/fanmode","config/externalwindowopen","config/externalsensortemp","config/enrolled","config/duration","config/displayflipped","config/devicemode","config/devicemode_bis","config/delay","config/ctmin","config/ctmax","config/coolsetpoint","config/controlsequence","config/configured","config/colorcapabilities","config/color/xy/startup_y","config/color/xy/startup_x","config/color/gradient/reversed","config/color/execute_if_off","config/color/ct/startup","config/clickmode","config/checkin","config/bri/startup","config/bri/onoff_transitiontime","config/bri/on_level","config/bri/min","config/bri/max","config/bri/execute_if_off","config/battery","config/battery_bis","config/allowtouchlink","config/alert","cap/transition_block","cap/sleeper","cap/on/off_with_effect","cap/measured_value/unit","cap/measured_value/min","cap/measured_value/max","cap/measured_value/dimension","cap/groups/not_supported","cap/color/xy/red_y","cap/color/xy/red_x","cap/color/xy/green_y","cap/color/xy/green_x","cap/color/xy/blue_y","cap/color/xy/blue_x","cap/color/gradient/styles","cap/color/gradient/pixel_length","cap/color/gradient/pixel_count","cap/color/gradient/max_segments","cap/color/gamut_type","cap/color/effects","cap/color/ct/min","cap/color/ct/max","cap/color/ct/computes_xy","cap/color/capabilities","cap/bri/move_with_onoff","cap/bri/min_dim_level","cap/alert/trigger_effect","attr/uniqueid","attr/type","attr/swversion","attr/swconfigid","attr/productname","attr/productid","attr/powerup","attr/poweronlevel","attr/poweronct","attr/name","attr/modelid","attr/mode","attr/manufacturername","attr/lastseen","attr/lastannounced","attr/id"]}}},"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"),v={"devcap1.schema.json":[I,D,O,E],"constants2.schema.json":[w]};function I(a,i){const o=typeof a.manufacturername=="string"&&typeof a.modelid=="string";if(o)return;const s=Array.isArray(a.manufacturername)&&Array.isArray(a.modelid);if(s&&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}(o||s)===!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 D(a,i){if(!a.bindings)return;const o=c=>`0x${(typeof c=="number"?c:Number.parseInt(c,16)).toString(16)}`,s={};a.bindings.forEach(c=>{c.bind==="unicast"&&c.report&&c.report.forEach(p=>{p.max!==65535&&(s[`${o(c["src.ep"])}.${o(c.cl)}.${o(p.at)}`]=p.max)})}),a.subdevices.forEach((c,p)=>{c.items.forEach((r,n)=>{var d;if(r["refresh.interval"]&&r.read&&r.read.fn==="zcl"){const f=o(r.read.ep??((d=c.fingerprint)==null?void 0:d.endpoint)??c.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}.${o(r.read.cl)}.${o(b[z])}`;s[h]!==void 0&&r["refresh.interval"]-60<s[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 (${s[h]}) with a margin of 60 seconds`,path:["subdevices",p,"items",n,"refresh.interval"]})}}})})}function O(a,i){if(!a.bindings)return;const o=[{description:'a color light should always have "state/ct" item.',if:{type:["$TYPE_COLOR_TEMPERATURE_LIGHT","Color Temperature Light","$TYPE_EXTENDED_COLOR_LIGHT","Extended Color Light"]},need:{item:["state/ct"]}},{description:'a device with "state/ct" need the "min" and "max" values for capability.',if:{item:["state/ct"]},need:{item:["cap/color/ct/min","cap/color/ct/max"]}},{description:'a device with "state/x" or "state/y" need the corresponding red, green and blue x and y values.',if:{item:["state/x","state/y"]},need:{item:["state/x","state/y","cap/color/xy/red_x","cap/color/xy/green_x","cap/color/xy/blue_x","cap/color/xy/red_y","cap/color/xy/green_y","cap/color/xy/blue_y"]}}];a.subdevices.forEach((s,c)=>{const p=s.items.map(r=>r.name);o.forEach(r=>{(Object.keys(r.if).length===0||Object.keys(r.if).some(n=>{var d;switch(n){case"type":return(d=r.if[n])==null?void 0:d.includes(s.type);case"item":return p.some(f=>{var b;return(b=r.if[n])==null?void 0:b.includes(f)});default:return!1}}))&&r.need.item.forEach(n=>{p.includes(n)||i.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${n}" because ${r.description}`,path:["subdevices",c,"items"]})})})})}function E(a,i){const o=["parse","write"];a.subdevices.forEach((s,c)=>{s.items.forEach((p,r)=>{o.forEach(n=>{const d=p[n];d!==void 0&&(d.fn===void 0||d.fn==="zcl"||d.fn==="zcl:attr"||d.fn==="zcl:cmd")&&(d.eval===void 0&&d.script===void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${n}' function is missing 'eval' or 'script' option.`,path:["subdevices",c,"items",r,n]}),d.eval!==void 0&&d.script!==void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${n}' function is having both 'eval' and 'script' option.`,path:["subdevices",c,"items",r,n]}))})})})}function w(a,i){const o=y();Object.keys(a).forEach(s=>{if(!Object.keys(o.shape).includes(s)){if(!["$MF_","$TYPE_"].some(c=>s.startsWith(c))){i.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant key should start with '$MF_' or '$TYPE_'",path:[s]});return}typeof a[s]!="string"&&i.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant value should be a string",path:[s]})}})}function T(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 y(a){return e.z.object({$schema:e.z.optional(e.z.string()),schema:e.z.literal("constants2.schema.json")}).passthrough()}function $(){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 C(){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 o=a[i],s=a[i+1];if(typeof o!="number"||typeof s!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function x(){return e.z.union([e.z.tuple([e.z.literal("$address.ext"),t(2)]),e.z.tuple([e.z.literal("$address.ext"),t(2),t(4)])])}function m(){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(m()).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(m()).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(m()).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 A(){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(m()).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(m()).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(m()).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(m()).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:C().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(m()).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(m()).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 S(){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(m()).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(m()).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(m()).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(m()).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(m()).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 j(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($()).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(A()).describe("Fonction used to parse incoming values."),write:e.z.optional(S()).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 J(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(m()).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(M(a)).describe("Devices section."),bindings:e.z.optional(e.z.array(Z())).describe("Bindings section.")})}function M(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:x(),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(R(a)),example:e.z.optional(e.z.unknown())})}function R(a){return j().omit({$schema:!0,schema:!0,id:!0}).extend({name:e.z.enum(a.attributes).describe("Item name.")})}function Z(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 G(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:x(),items:e.z.array(e.z.enum(a.attributes))})}function g(a){return e.z.discriminatedUnion("schema",[J(a),T(),y(),j(),G(a)]).superRefine((i,o)=>{switch(i.schema){case"devcap1.schema.json":v[i.schema].map(s=>s(i,o));break;case"constants2.schema.json":v[i.schema].map(s=>s(i,o));break}})}function F(a={attributes:[],manufacturers:{},deviceTypes:{},resources:{}}){let i=g(a);const o=()=>{i=g(a)};return{generics:a,loadGeneric:p=>{const r=i.parse(p);switch(r.schema){case"constants1.schema.json":a.manufacturers={...a.manufacturers,...r.manufacturers},a.deviceTypes={...a.deviceTypes,...r["device-types"]};break;case"constants2.schema.json":{Object.keys(r).filter(n=>n.startsWith("$MF_")).forEach(n=>{a.manufacturers[n]=r[n]}),Object.keys(r).filter(n=>n.startsWith("$TYPE_")).forEach(n=>{a.deviceTypes[n]=r[n]});break}case"resourceitem1.schema.json":{if(a.attributes.includes(r.id))throw new Error(`Got duplicate resource item with attribute id '${r.id}'.`);const n=r,d=r.id;delete n.$schema,delete n.schema,delete n.id,a.resources[d]=n,a.attributes.push(d);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 o(),!0},validate:p=>i.parse(p),getSchema:()=>i}}exports.createValidator=F;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),v={"devcap1.schema.json":[I,O,D,E],"constants2.schema.json":[w]};function I(a,i){const o=typeof a.manufacturername=="string"&&typeof a.modelid=="string";if(o)return;const s=Array.isArray(a.manufacturername)&&Array.isArray(a.modelid);if(s&&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}(o||s)===!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 O(a,i){if(!a.bindings)return;const o=c=>`0x${(typeof c=="number"?c:Number.parseInt(c,16)).toString(16)}`,s={};a.bindings.forEach(c=>{c.bind==="unicast"&&c.report&&c.report.forEach(m=>{m.max!==65535&&(s[`${o(c["src.ep"])}.${o(c.cl)}.${o(m.at)}`]=m.max)})}),a.subdevices.forEach((c,m)=>{c.items.forEach((r,n)=>{var d;if(r["refresh.interval"]&&r.read&&r.read.fn==="zcl"){const f=o(r.read.ep??((d=c.fingerprint)==null?void 0:d.endpoint)??c.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}.${o(r.read.cl)}.${o(b[z])}`;s[h]!==void 0&&r["refresh.interval"]-60<s[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 (${s[h]}) with a margin of 60 seconds`,path:["subdevices",m,"items",n,"refresh.interval"]})}}})})}function D(a,i){if(!a.bindings)return;const o=[{description:'a color light should always have "state/ct" item.',if:{type:["$TYPE_COLOR_TEMPERATURE_LIGHT","Color Temperature Light","$TYPE_EXTENDED_COLOR_LIGHT","Extended Color Light"]},need:{item:["state/ct"]}},{description:'a device with "state/ct" need the "min" and "max" values for capability.',if:{item:["state/ct"]},need:{item:["cap/color/ct/min","cap/color/ct/max"]}},{description:'a device with "state/x" or "state/y" need the corresponding red, green and blue x and y values.',if:{item:["state/x","state/y"]},need:{item:["state/x","state/y","cap/color/xy/red_x","cap/color/xy/green_x","cap/color/xy/blue_x","cap/color/xy/red_y","cap/color/xy/green_y","cap/color/xy/blue_y"]}},{description:'a ZHAOpenClose should always have "state/open" item.',if:{type:["$TYPE_OPEN_CLOSE_SENSOR","ZHAOpenClose"]},need:{item:["state/open"]}}];a.subdevices.forEach((s,c)=>{const m=s.items.map(r=>r.name);o.forEach(r=>{(Object.keys(r.if).length===0||Object.keys(r.if).some(n=>{var d;switch(n){case"type":return(d=r.if[n])==null?void 0:d.includes(s.type);case"item":return m.some(f=>{var b;return(b=r.if[n])==null?void 0:b.includes(f)});default:return!1}}))&&r.need.item.forEach(n=>{m.includes(n)||i.addIssue({code:e.z.ZodIssueCode.custom,message:`The device should have the item "${n}" because ${r.description}`,path:["subdevices",c,"items"]})})})})}function E(a,i){const o=["parse","write"];a.subdevices.forEach((s,c)=>{s.items.forEach((m,r)=>{o.forEach(n=>{const d=m[n];d!==void 0&&(d.fn===void 0||d.fn==="zcl"||d.fn==="zcl:attr"||d.fn==="zcl:cmd")&&(d.eval===void 0&&d.script===void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${n}' function is missing 'eval' or 'script' option.`,path:["subdevices",c,"items",r,n]}),d.eval!==void 0&&d.script!==void 0&&i.addIssue({code:e.z.ZodIssueCode.custom,message:`The '${n}' function is having both 'eval' and 'script' option.`,path:["subdevices",c,"items",r,n]}))})})})}function w(a,i){const o=y();Object.keys(a).forEach(s=>{if(!Object.keys(o.shape).includes(s)){if(!["$MF_","$TYPE_"].some(c=>s.startsWith(c))){i.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant key should start with '$MF_' or '$TYPE_'",path:[s]});return}typeof a[s]!="string"&&i.addIssue({code:e.z.ZodIssueCode.custom,message:"The constant value should be a string",path:[s]})}})}function T(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 y(a){return e.z.object({$schema:e.z.optional(e.z.string()),schema:e.z.literal("constants2.schema.json")}).passthrough()}function $(){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 C(){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 o=a[i],s=a[i+1];if(typeof o!="number"||typeof s!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function x(){return e.z.union([e.z.tuple([e.z.literal("$address.ext"),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 A(){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:C().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 S(){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 j(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($()).describe("Date of deprecation, if the item is deprecated, it's better to use the new one."),datatype:e.z.optional(e.z.enum(["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Double","Array","Array[3]","ISO 8601 timestamp"])).describe("Data type of the item."),access:e.z.optional(e.z.enum(["R","W","RW"])).describe("Access mode for this item, some of them are not editable."),public:e.z.optional(e.z.boolean()).describe("Item visible on the API."),implicit:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),managed:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),awake:e.z.optional(e.z.boolean()).describe("The device is considered awake when this item is set due a incoming command."),static:e.z.optional(e.z.union([e.z.string(),e.z.number(),e.z.boolean()])).describe("A static default value is fixed and can be not changed."),range:e.z.optional(e.z.tuple([e.z.number(),e.z.number()])).describe("Values range limit."),virtual:e.z.optional(e.z.boolean()).describe("TODO: What is this ?"),read:e.z.optional(_()).describe("Fonction used to read value."),parse:e.z.optional(A()).describe("Fonction used to parse incoming values."),write:e.z.optional(S()).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 J(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(M(a)).describe("Devices section."),bindings:e.z.optional(e.z.array(Z())).describe("Bindings section.")})}function M(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:x(),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(R(a)),example:e.z.optional(e.z.unknown())})}function R(a){return j().omit({$schema:!0,schema:!0,id:!0}).extend({name:e.z.enum(a.attributes).describe("Item name.")})}function Z(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 G(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:x(),items:e.z.array(e.z.enum(a.attributes))})}function g(a){return e.z.discriminatedUnion("schema",[J(a),T(),y(),j(),G(a)]).superRefine((i,o)=>{switch(i.schema){case"devcap1.schema.json":v[i.schema].map(s=>s(i,o));break;case"constants2.schema.json":v[i.schema].map(s=>s(i,o));break}})}function F(a={attributes:[],manufacturers:{},deviceTypes:{},resources:{}}){let i=g(a);const o=()=>{i=g(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"constants2.schema.json":{Object.keys(r).filter(n=>n.startsWith("$MF_")).forEach(n=>{a.manufacturers[n]=r[n]}),Object.keys(r).filter(n=>n.startsWith("$TYPE_")).forEach(n=>{a.deviceTypes[n]=r[n]});break}case"resourceitem1.schema.json":{if(a.attributes.includes(r.id))throw new Error(`Got duplicate resource item with attribute id '${r.id}'.`);const n=r,d=r.id;delete n.$schema,delete n.schema,delete n.id,a.resources[d]=n,a.attributes.push(d);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 o(),!0},validate:m=>i.parse(m),getSchema:()=>i}}exports.createValidator=F;
|
package/dist/ddf-validator.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type DDF = {
|
|
|
11
11
|
/** Know issues for this device, markdown file. */
|
|
12
12
|
"md:known_issues"?: string[] | undefined;
|
|
13
13
|
/** Manufacturer name from Basic Cluster. */
|
|
14
|
-
manufacturername: ("$MF_BOSCH" | "$MF_LUMI" | "$MF_LUTRON" | "$MF_PHILIPS" | "$MF_SAMJIN" | "$MF_SIGNIFY" | "$MF_TUYA" | "$MF_XIAOMI"
|
|
14
|
+
manufacturername: ("$MF_BOSCH" | "$MF_IKEA" | "$MF_LUMI" | "$MF_LUTRON" | "$MF_PHILIPS" | "$MF_SAMJIN" | "$MF_SIGNIFY" | "$MF_TUYA" | "$MF_XIAOMI") | string | (("$MF_BOSCH" | "$MF_IKEA" | "$MF_LUMI" | "$MF_LUTRON" | "$MF_PHILIPS" | "$MF_SAMJIN" | "$MF_SIGNIFY" | "$MF_TUYA" | "$MF_XIAOMI") | string)[];
|
|
15
15
|
/** Model ID from Basic Cluster. */
|
|
16
16
|
modelid: string | string[];
|
|
17
17
|
/** Friendly name of the manufacturer. */
|
|
@@ -30,7 +30,7 @@ export type DDF = {
|
|
|
30
30
|
status: "Draft" | "Bronze" | "Silver" | "Gold";
|
|
31
31
|
/** Devices section. */
|
|
32
32
|
subdevices: {
|
|
33
|
-
type: ("$TYPE_AIR_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"
|
|
33
|
+
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_CARBONDIOXIDE_SENSOR" | "$TYPE_FORMALDEHYDE_SENSOR" | "$TYPE_PARTICULATEMATTER_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_MOISTURE_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_LIGHT_SWITCH" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_ON_OFF_SWITCH" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
34
34
|
restapi: "/lights" | "/sensors";
|
|
35
35
|
uuid: [
|
|
36
36
|
"$address.ext",
|
|
@@ -61,7 +61,7 @@ export type DDF = {
|
|
|
61
61
|
/** Date of deprecation, if the item is deprecated, it's better to use the new one. */
|
|
62
62
|
deprecated?: string | undefined;
|
|
63
63
|
/** Data type of the item. */
|
|
64
|
-
datatype?: ("String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "UInt8" | "UInt16" | "UInt32" | "UInt64" | "Array" | "Array[3]" | "ISO 8601 timestamp") | undefined;
|
|
64
|
+
datatype?: ("String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "UInt8" | "UInt16" | "UInt32" | "UInt64" | "Double" | "Array" | "Array[3]" | "ISO 8601 timestamp") | undefined;
|
|
65
65
|
/** Access mode for this item, some of them are not editable. */
|
|
66
66
|
access?: ("R" | "W" | "RW") | undefined;
|
|
67
67
|
/** Item visible on the API. */
|
|
@@ -349,7 +349,7 @@ export type DDF = {
|
|
|
349
349
|
/** Defaut value. */
|
|
350
350
|
default?: unknown | undefined;
|
|
351
351
|
/** Item name. */
|
|
352
|
-
name: "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";
|
|
352
|
+
name: "state/windowopen" | "state/water" | "state/water_bis" | "state/voltage" | "state/vibrationstrength" | "state/vibration" | "state/valve" | "state/utc" | "state/tiltangle" | "state/tilt" | "state/test" | "state/temperature" | "state/temperature_bis" | "state/tampered" | "state/speed" | "state/seconds_remaining" | "state/sat" | "state/rotaryevent" | "state/replacefilter" | "state/reachable" | "state/production" | "state/pressure" | "state/pressure_bis" | "state/presenceevent" | "state/presence" | "state/power" | "state/pm2_5" | "state/panel" | "state/orientation_z" | "state/orientation_y" | "state/orientation_x" | "state/open" | "state/open_bis" | "state/on" | "state/mountingmodeactive" | "state/moisture" | "state/measured_value" | "state/lux" | "state/lowbattery" | "state/lockstate" | "state/localtime" | "state/lightlevel" | "state/lift" | "state/lastupdated" | "state/lastset" | "state/lastcheckin" | "state/humidity" | "state/humidity_bis" | "state/hue" | "state/heating" | "state/gradient" | "state/gesture" | "state/fire" | "state/filterruntime" | "state/expectedrotation" | "state/expectedeventduration" | "state/eventduration" | "state/errorcode" | "state/effect" | "state/deviceruntime" | "state/daylight" | "state/dark" | "state/current" | "state/current_P3" | "state/current_P2" | "state/current_P1" | "state/ct" | "state/consumption" | "state/consumption_2" | "state/y" | "state/x" | "state/colormode" | "state/charging" | "state/carbonmonoxide" | "state/buttonevent" | "state/bri" | "state/battery" | "state/angle" | "state/alert" | "state/alarm" | "state/airqualityppb" | "state/airqualityppb_bis" | "state/airquality" | "state/airquality_bis" | "state/action" | "config/windowopen_set" | "config/windowcoveringtype" | "config/volume" | "config/usertest" | "config/unoccupiedheatsetpoint" | "config/tuya_unlock" | "config/triggerdistance" | "config/triggerdistance_bis" | "config/tholdoffset" | "config/tholddark" | "config/temperature" | "config/swingmode" | "config/speed" | "config/sensitivitymax" | "config/sensitivity" | "config/sensitivity_bis" | "config/selftest" | "config/schedule_on" | "config/schedule" | "config/reversed" | "config/resetpresence" | "config/reportgrid" | "config/reachable" | "config/pulseconfiguration" | "config/preset" | "config/pending" | "config/on/startup" | "config/on" | "config/offset" | "config/mountingmode" | "config/mode" | "config/melody" | "config/locked" | "config/lock" | "config/ledindication" | "config/interfacemode" | "config/heatsetpoint" | "config/group" | "config/filterlifetime" | "config/fanmode" | "config/externalwindowopen" | "config/externalsensortemp" | "config/enrolled" | "config/duration" | "config/displayflipped" | "config/devicemode" | "config/devicemode_bis" | "config/delay" | "config/ctmin" | "config/ctmax" | "config/coolsetpoint" | "config/controlsequence" | "config/configured" | "config/colorcapabilities" | "config/color/xy/startup_y" | "config/color/xy/startup_x" | "config/color/gradient/reversed" | "config/color/execute_if_off" | "config/color/ct/startup" | "config/clickmode" | "config/checkin" | "config/bri/startup" | "config/bri/onoff_transitiontime" | "config/bri/on_level" | "config/bri/min" | "config/bri/max" | "config/bri/execute_if_off" | "config/battery" | "config/battery_bis" | "config/allowtouchlink" | "config/alert" | "cap/transition_block" | "cap/sleeper" | "cap/on/off_with_effect" | "cap/measured_value/unit" | "cap/measured_value/min" | "cap/measured_value/max" | "cap/measured_value/dimension" | "cap/groups/not_supported" | "cap/color/xy/red_y" | "cap/color/xy/red_x" | "cap/color/xy/green_y" | "cap/color/xy/green_x" | "cap/color/xy/blue_y" | "cap/color/xy/blue_x" | "cap/color/gradient/styles" | "cap/color/gradient/pixel_length" | "cap/color/gradient/pixel_count" | "cap/color/gradient/max_segments" | "cap/color/gamut_type" | "cap/color/effects" | "cap/color/ct/min" | "cap/color/ct/max" | "cap/color/ct/computes_xy" | "cap/color/capabilities" | "cap/bri/move_with_onoff" | "cap/bri/min_dim_level" | "cap/alert/trigger_effect" | "attr/uniqueid" | "attr/type" | "attr/swversion" | "attr/swconfigid" | "attr/productname" | "attr/productid" | "attr/powerup" | "attr/poweronlevel" | "attr/poweronct" | "attr/name" | "attr/modelid" | "attr/mode" | "attr/manufacturername" | "attr/lastseen" | "attr/lastannounced" | "attr/id";
|
|
353
353
|
}[];
|
|
354
354
|
example?: unknown | undefined;
|
|
355
355
|
}[];
|
|
@@ -401,7 +401,7 @@ export type DDF = {
|
|
|
401
401
|
/** Date of deprecation, if the item is deprecated, it's better to use the new one. */
|
|
402
402
|
deprecated?: string | undefined;
|
|
403
403
|
/** Data type of the item. */
|
|
404
|
-
datatype?: ("String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "UInt8" | "UInt16" | "UInt32" | "UInt64" | "Array" | "Array[3]" | "ISO 8601 timestamp") | undefined;
|
|
404
|
+
datatype?: ("String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "UInt8" | "UInt16" | "UInt32" | "UInt64" | "Double" | "Array" | "Array[3]" | "ISO 8601 timestamp") | undefined;
|
|
405
405
|
/** Access mode for this item, some of them are not editable. */
|
|
406
406
|
access?: ("R" | "W" | "RW") | undefined;
|
|
407
407
|
/** Item visible on the API. */
|
|
@@ -691,7 +691,7 @@ export type DDF = {
|
|
|
691
691
|
} | {
|
|
692
692
|
$schema?: string | undefined;
|
|
693
693
|
schema: "subdevice1.schema.json";
|
|
694
|
-
type: ("$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"
|
|
694
|
+
type: ("$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_CARBONDIOXIDE_SENSOR" | "$TYPE_FORMALDEHYDE_SENSOR" | "$TYPE_PARTICULATEMATTER_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_DOOR_LOCK" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_MOISTURE_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_LIGHT_SWITCH" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$TYPE_ON_OFF_SWITCH" | "$TYPE_OPEN_CLOSE_SENSOR" | "$TYPE_POWER_SENSOR" | "$TYPE_PRESENCE_SENSOR" | "$TYPE_PRESSURE_SENSOR" | "$TYPE_RANGE_EXTENDER" | "$TYPE_RELATIVE_ROTARY" | "$TYPE_SMART_PLUG" | "$TYPE_SPECTRAL_SENSOR" | "$TYPE_SWITCH" | "$TYPE_TEMPERATURE_SENSOR" | "$TYPE_THERMOSTAT" | "$TYPE_VIBRATION_SENSOR" | "$TYPE_WARNING_DEVICE" | "$TYPE_WATER_LEAK_SENSOR" | "$TYPE_WINDOW_COVERING_DEVICE" | "$TYPE_ZGP_SWITCH") | string;
|
|
695
695
|
name: string;
|
|
696
696
|
restapi: "/lights" | "/sensors";
|
|
697
697
|
order: number;
|
|
@@ -703,7 +703,7 @@ export type DDF = {
|
|
|
703
703
|
string,
|
|
704
704
|
string
|
|
705
705
|
];
|
|
706
|
-
items: ("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")[];
|
|
706
|
+
items: ("state/windowopen" | "state/water" | "state/water_bis" | "state/voltage" | "state/vibrationstrength" | "state/vibration" | "state/valve" | "state/utc" | "state/tiltangle" | "state/tilt" | "state/test" | "state/temperature" | "state/temperature_bis" | "state/tampered" | "state/speed" | "state/seconds_remaining" | "state/sat" | "state/rotaryevent" | "state/replacefilter" | "state/reachable" | "state/production" | "state/pressure" | "state/pressure_bis" | "state/presenceevent" | "state/presence" | "state/power" | "state/pm2_5" | "state/panel" | "state/orientation_z" | "state/orientation_y" | "state/orientation_x" | "state/open" | "state/open_bis" | "state/on" | "state/mountingmodeactive" | "state/moisture" | "state/measured_value" | "state/lux" | "state/lowbattery" | "state/lockstate" | "state/localtime" | "state/lightlevel" | "state/lift" | "state/lastupdated" | "state/lastset" | "state/lastcheckin" | "state/humidity" | "state/humidity_bis" | "state/hue" | "state/heating" | "state/gradient" | "state/gesture" | "state/fire" | "state/filterruntime" | "state/expectedrotation" | "state/expectedeventduration" | "state/eventduration" | "state/errorcode" | "state/effect" | "state/deviceruntime" | "state/daylight" | "state/dark" | "state/current" | "state/current_P3" | "state/current_P2" | "state/current_P1" | "state/ct" | "state/consumption" | "state/consumption_2" | "state/y" | "state/x" | "state/colormode" | "state/charging" | "state/carbonmonoxide" | "state/buttonevent" | "state/bri" | "state/battery" | "state/angle" | "state/alert" | "state/alarm" | "state/airqualityppb" | "state/airqualityppb_bis" | "state/airquality" | "state/airquality_bis" | "state/action" | "config/windowopen_set" | "config/windowcoveringtype" | "config/volume" | "config/usertest" | "config/unoccupiedheatsetpoint" | "config/tuya_unlock" | "config/triggerdistance" | "config/triggerdistance_bis" | "config/tholdoffset" | "config/tholddark" | "config/temperature" | "config/swingmode" | "config/speed" | "config/sensitivitymax" | "config/sensitivity" | "config/sensitivity_bis" | "config/selftest" | "config/schedule_on" | "config/schedule" | "config/reversed" | "config/resetpresence" | "config/reportgrid" | "config/reachable" | "config/pulseconfiguration" | "config/preset" | "config/pending" | "config/on/startup" | "config/on" | "config/offset" | "config/mountingmode" | "config/mode" | "config/melody" | "config/locked" | "config/lock" | "config/ledindication" | "config/interfacemode" | "config/heatsetpoint" | "config/group" | "config/filterlifetime" | "config/fanmode" | "config/externalwindowopen" | "config/externalsensortemp" | "config/enrolled" | "config/duration" | "config/displayflipped" | "config/devicemode" | "config/devicemode_bis" | "config/delay" | "config/ctmin" | "config/ctmax" | "config/coolsetpoint" | "config/controlsequence" | "config/configured" | "config/colorcapabilities" | "config/color/xy/startup_y" | "config/color/xy/startup_x" | "config/color/gradient/reversed" | "config/color/execute_if_off" | "config/color/ct/startup" | "config/clickmode" | "config/checkin" | "config/bri/startup" | "config/bri/onoff_transitiontime" | "config/bri/on_level" | "config/bri/min" | "config/bri/max" | "config/bri/execute_if_off" | "config/battery" | "config/battery_bis" | "config/allowtouchlink" | "config/alert" | "cap/transition_block" | "cap/sleeper" | "cap/on/off_with_effect" | "cap/measured_value/unit" | "cap/measured_value/min" | "cap/measured_value/max" | "cap/measured_value/dimension" | "cap/groups/not_supported" | "cap/color/xy/red_y" | "cap/color/xy/red_x" | "cap/color/xy/green_y" | "cap/color/xy/green_x" | "cap/color/xy/blue_y" | "cap/color/xy/blue_x" | "cap/color/gradient/styles" | "cap/color/gradient/pixel_length" | "cap/color/gradient/pixel_count" | "cap/color/gradient/max_segments" | "cap/color/gamut_type" | "cap/color/effects" | "cap/color/ct/min" | "cap/color/ct/max" | "cap/color/ct/computes_xy" | "cap/color/capabilities" | "cap/bri/move_with_onoff" | "cap/bri/min_dim_level" | "cap/alert/trigger_effect" | "attr/uniqueid" | "attr/type" | "attr/swversion" | "attr/swconfigid" | "attr/productname" | "attr/productid" | "attr/powerup" | "attr/poweronlevel" | "attr/poweronct" | "attr/name" | "attr/modelid" | "attr/mode" | "attr/manufacturername" | "attr/lastseen" | "attr/lastannounced" | "attr/id")[];
|
|
707
707
|
};
|
|
708
708
|
|
|
709
709
|
export interface GenericsData {
|
package/dist/ddf-validator.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
2
|
const g = {
|
|
3
3
|
"devcap1.schema.json": [
|
|
4
|
-
D,
|
|
5
4
|
O,
|
|
5
|
+
D,
|
|
6
6
|
E,
|
|
7
7
|
w
|
|
8
8
|
],
|
|
@@ -10,7 +10,7 @@ const g = {
|
|
|
10
10
|
T
|
|
11
11
|
]
|
|
12
12
|
};
|
|
13
|
-
function
|
|
13
|
+
function O(a, i) {
|
|
14
14
|
const o = typeof a.manufacturername == "string" && typeof a.modelid == "string";
|
|
15
15
|
if (o)
|
|
16
16
|
return;
|
|
@@ -29,15 +29,15 @@ function D(a, i) {
|
|
|
29
29
|
path: ["manufacturername", "modelid"]
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function D(a, i) {
|
|
33
33
|
if (!a.bindings)
|
|
34
34
|
return;
|
|
35
35
|
const o = (c) => `0x${(typeof c == "number" ? c : Number.parseInt(c, 16)).toString(16)}`, s = {};
|
|
36
36
|
a.bindings.forEach((c) => {
|
|
37
|
-
c.bind === "unicast" && c.report && c.report.forEach((
|
|
38
|
-
|
|
37
|
+
c.bind === "unicast" && c.report && c.report.forEach((m) => {
|
|
38
|
+
m.max !== 65535 && (s[`${o(c["src.ep"])}.${o(c.cl)}.${o(m.at)}`] = m.max);
|
|
39
39
|
});
|
|
40
|
-
}), a.subdevices.forEach((c,
|
|
40
|
+
}), a.subdevices.forEach((c, m) => {
|
|
41
41
|
c.items.forEach((r, n) => {
|
|
42
42
|
var d;
|
|
43
43
|
if (r["refresh.interval"] && r.read && r.read.fn === "zcl") {
|
|
@@ -47,7 +47,7 @@ function O(a, i) {
|
|
|
47
47
|
s[v] !== void 0 && r["refresh.interval"] - 60 < s[v] && i.addIssue({
|
|
48
48
|
code: e.ZodIssueCode.custom,
|
|
49
49
|
message: `The refresh interval (${r["refresh.interval"]} - 60 = ${r["refresh.interval"] - 60}) should be greater than the binding max refresh value (${s[v]}) with a margin of 60 seconds`,
|
|
50
|
-
path: ["subdevices",
|
|
50
|
+
path: ["subdevices", m, "items", n, "refresh.interval"]
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -75,6 +75,7 @@ function E(a, i) {
|
|
|
75
75
|
description: 'a color light should always have "state/ct" item.',
|
|
76
76
|
if: {
|
|
77
77
|
type: [
|
|
78
|
+
// TODO Use the constants file to resolve the types too
|
|
78
79
|
"$TYPE_COLOR_TEMPERATURE_LIGHT",
|
|
79
80
|
"Color Temperature Light",
|
|
80
81
|
"$TYPE_EXTENDED_COLOR_LIGHT",
|
|
@@ -121,10 +122,24 @@ function E(a, i) {
|
|
|
121
122
|
// 'cap/color/ct/computes_xy',
|
|
122
123
|
]
|
|
123
124
|
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
description: 'a ZHAOpenClose should always have "state/open" item.',
|
|
128
|
+
if: {
|
|
129
|
+
type: [
|
|
130
|
+
"$TYPE_OPEN_CLOSE_SENSOR",
|
|
131
|
+
"ZHAOpenClose"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
need: {
|
|
135
|
+
item: [
|
|
136
|
+
"state/open"
|
|
137
|
+
]
|
|
138
|
+
}
|
|
124
139
|
}
|
|
125
140
|
];
|
|
126
141
|
a.subdevices.forEach((s, c) => {
|
|
127
|
-
const
|
|
142
|
+
const m = s.items.map((r) => r.name);
|
|
128
143
|
o.forEach((r) => {
|
|
129
144
|
(Object.keys(r.if).length === 0 || Object.keys(r.if).some((n) => {
|
|
130
145
|
var d;
|
|
@@ -132,7 +147,7 @@ function E(a, i) {
|
|
|
132
147
|
case "type":
|
|
133
148
|
return (d = r.if[n]) == null ? void 0 : d.includes(s.type);
|
|
134
149
|
case "item":
|
|
135
|
-
return
|
|
150
|
+
return m.some((b) => {
|
|
136
151
|
var f;
|
|
137
152
|
return (f = r.if[n]) == null ? void 0 : f.includes(b);
|
|
138
153
|
});
|
|
@@ -140,7 +155,7 @@ function E(a, i) {
|
|
|
140
155
|
return !1;
|
|
141
156
|
}
|
|
142
157
|
})) && r.need.item.forEach((n) => {
|
|
143
|
-
|
|
158
|
+
m.includes(n) || i.addIssue({
|
|
144
159
|
code: e.ZodIssueCode.custom,
|
|
145
160
|
message: `The device should have the item "${n}" because ${r.description}`,
|
|
146
161
|
path: ["subdevices", c, "items"]
|
|
@@ -152,9 +167,9 @@ function E(a, i) {
|
|
|
152
167
|
function w(a, i) {
|
|
153
168
|
const o = ["parse", "write"];
|
|
154
169
|
a.subdevices.forEach((s, c) => {
|
|
155
|
-
s.items.forEach((
|
|
170
|
+
s.items.forEach((m, r) => {
|
|
156
171
|
o.forEach((n) => {
|
|
157
|
-
const d =
|
|
172
|
+
const d = m[n];
|
|
158
173
|
d !== void 0 && (d.fn === void 0 || d.fn === "zcl" || d.fn === "zcl:attr" || d.fn === "zcl:cmd") && (d.eval === void 0 && d.script === void 0 && i.addIssue({
|
|
159
174
|
code: e.ZodIssueCode.custom,
|
|
160
175
|
message: `The '${n}' function is missing 'eval' or 'script' option.`,
|
|
@@ -244,7 +259,7 @@ function j() {
|
|
|
244
259
|
])
|
|
245
260
|
]);
|
|
246
261
|
}
|
|
247
|
-
function
|
|
262
|
+
function p() {
|
|
248
263
|
return e.string();
|
|
249
264
|
}
|
|
250
265
|
function l() {
|
|
@@ -270,7 +285,7 @@ function A() {
|
|
|
270
285
|
ep: e.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
271
286
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
272
287
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
273
|
-
script: e.optional(
|
|
288
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
274
289
|
}).describe("Deprecated"),
|
|
275
290
|
e.strictObject({
|
|
276
291
|
fn: e.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -279,7 +294,7 @@ function A() {
|
|
|
279
294
|
ep: e.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
280
295
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
281
296
|
eval: e.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
282
|
-
script: e.optional(
|
|
297
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
283
298
|
}),
|
|
284
299
|
e.strictObject({
|
|
285
300
|
fn: e.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -288,7 +303,7 @@ function A() {
|
|
|
288
303
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
289
304
|
cmd: e.optional(t(2)).describe("Zigbee command."),
|
|
290
305
|
eval: e.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
291
|
-
script: e.optional(
|
|
306
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
292
307
|
}),
|
|
293
308
|
e.strictObject({
|
|
294
309
|
fn: e.literal("tuya").describe("Generic function to read all Tuya datapoints. It has no parameters.")
|
|
@@ -308,7 +323,7 @@ function S() {
|
|
|
308
323
|
cmd: e.optional(t(2)).describe("Zigbee command."),
|
|
309
324
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
310
325
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
311
|
-
script: e.optional(
|
|
326
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
312
327
|
}),
|
|
313
328
|
e.strictObject({
|
|
314
329
|
fn: e.literal("zcl").describe("Generic function to parse ZCL attributes and commands."),
|
|
@@ -319,7 +334,7 @@ function S() {
|
|
|
319
334
|
cmd: e.optional(t(2)).describe("Zigbee command."),
|
|
320
335
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
321
336
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
322
|
-
script: e.optional(
|
|
337
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
323
338
|
}).describe("Deprecated"),
|
|
324
339
|
e.strictObject({
|
|
325
340
|
fn: e.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -328,7 +343,7 @@ function S() {
|
|
|
328
343
|
ep: e.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
329
344
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
330
345
|
eval: e.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
331
|
-
script: e.optional(
|
|
346
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
332
347
|
}),
|
|
333
348
|
e.strictObject({
|
|
334
349
|
fn: e.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -337,7 +352,7 @@ function S() {
|
|
|
337
352
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
338
353
|
cmd: e.optional(t(2)).describe("Zigbee command."),
|
|
339
354
|
eval: e.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
340
|
-
script: e.optional(
|
|
355
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
341
356
|
}),
|
|
342
357
|
e.strictObject({
|
|
343
358
|
fn: e.literal("ias:zonestatus").describe("Generic function to parse IAS ZONE status change notifications or zone status from read/report command."),
|
|
@@ -360,13 +375,13 @@ function S() {
|
|
|
360
375
|
at: e.optional(t(4)).describe("Attribute ID. The attribute to parse, shall be 0xff01, 0xff02 or 0x00f7"),
|
|
361
376
|
idx: t(2).describe("A 8-bit string hex value."),
|
|
362
377
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
363
|
-
script: e.optional(
|
|
378
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
364
379
|
}),
|
|
365
380
|
e.strictObject({
|
|
366
381
|
fn: e.literal("tuya").describe("Generic function to parse Tuya data."),
|
|
367
382
|
dpid: e.number().describe("Data point ID. 1-255 the datapoint ID."),
|
|
368
383
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
369
|
-
script: e.optional(
|
|
384
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
370
385
|
})
|
|
371
386
|
]).refine((a) => !("eval" in a && "script" in a), {
|
|
372
387
|
message: "eval and script should not both be present"
|
|
@@ -387,7 +402,7 @@ function J() {
|
|
|
387
402
|
ep: e.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
388
403
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
389
404
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
390
|
-
script: e.optional(
|
|
405
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
391
406
|
}),
|
|
392
407
|
e.strictObject({
|
|
393
408
|
fn: e.literal("zcl"),
|
|
@@ -399,7 +414,7 @@ function J() {
|
|
|
399
414
|
ep: e.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
400
415
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
401
416
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
402
|
-
script: e.optional(
|
|
417
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
403
418
|
}).describe("Deprecated"),
|
|
404
419
|
e.strictObject({
|
|
405
420
|
fn: e.literal("zcl:attr").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -411,7 +426,7 @@ function J() {
|
|
|
411
426
|
ep: e.optional(u()).describe("Endpoint, 255 means any endpoint, 0 means auto selected from subdevice."),
|
|
412
427
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
413
428
|
eval: e.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
414
|
-
script: e.optional(
|
|
429
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
415
430
|
}),
|
|
416
431
|
e.strictObject({
|
|
417
432
|
fn: e.literal("zcl:cmd").describe("Generic function to parse ZCL values from read/report commands."),
|
|
@@ -421,14 +436,14 @@ function J() {
|
|
|
421
436
|
mf: e.optional(t(4)).describe("Manufacturer code, must be set to 0x0000 for non manufacturer specific commands."),
|
|
422
437
|
cmd: e.optional(t(2)).describe("Zigbee command."),
|
|
423
438
|
eval: e.optional(l()).describe("Javascript expression to transform the attribute value to the Item value."),
|
|
424
|
-
script: e.optional(
|
|
439
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
425
440
|
}),
|
|
426
441
|
e.strictObject({
|
|
427
442
|
fn: e.literal("tuya").describe("Generic function to write Tuya data."),
|
|
428
443
|
dpid: e.number().describe("Data point ID. 1-255 the datapoint ID."),
|
|
429
444
|
dt: t(2).describe("Data type."),
|
|
430
445
|
eval: e.optional(l()).describe("Javascript expression to transform the raw value."),
|
|
431
|
-
script: e.optional(
|
|
446
|
+
script: e.optional(p()).describe("Relative path of a Javascript .js file.")
|
|
432
447
|
})
|
|
433
448
|
]).refine((a) => !("eval" in a && "script" in a), {
|
|
434
449
|
message: "eval and script should not both be present"
|
|
@@ -442,7 +457,7 @@ function I(a) {
|
|
|
442
457
|
description: e.optional(e.string()).describe("Item description, better to do not use it."),
|
|
443
458
|
comment: e.optional(e.string()).describe("TODO: What is this ? What the difference with description ?"),
|
|
444
459
|
deprecated: e.optional(C()).describe("Date of deprecation, if the item is deprecated, it's better to use the new one."),
|
|
445
|
-
datatype: e.optional(e.enum(["String", "Bool", "Int8", "Int16", "Int32", "Int64", "UInt8", "UInt16", "UInt32", "UInt64", "Array", "Array[3]", "ISO 8601 timestamp"])).describe("Data type of the item."),
|
|
460
|
+
datatype: e.optional(e.enum(["String", "Bool", "Int8", "Int16", "Int32", "Int64", "UInt8", "UInt16", "UInt32", "UInt64", "Double", "Array", "Array[3]", "ISO 8601 timestamp"])).describe("Data type of the item."),
|
|
446
461
|
access: e.optional(e.enum(["R", "W", "RW"])).describe("Access mode for this item, some of them are not editable."),
|
|
447
462
|
public: e.optional(e.boolean()).describe("Item visible on the API."),
|
|
448
463
|
implicit: e.optional(e.boolean()).describe("TODO: What is this ?"),
|
|
@@ -485,7 +500,7 @@ function M(a) {
|
|
|
485
500
|
vendor: e.optional(e.string()).describe("Friendly name of the manufacturer."),
|
|
486
501
|
comment: e.optional(e.string()),
|
|
487
502
|
matchexpr: e.optional(l()).describe("Need to return true for the DDF be used."),
|
|
488
|
-
path: e.optional(
|
|
503
|
+
path: e.optional(p()).describe("DDF path, useless, can be removed."),
|
|
489
504
|
product: e.optional(e.string()).describe("Complements the model id to be shown in the UI."),
|
|
490
505
|
sleeper: e.optional(e.boolean()).describe("Sleeping devices can only receive when awake."),
|
|
491
506
|
supportsMgmtBind: e.optional(e.boolean()),
|
|
@@ -600,8 +615,8 @@ function z(a = {
|
|
|
600
615
|
const o = () => {
|
|
601
616
|
i = y(a);
|
|
602
617
|
};
|
|
603
|
-
return { generics: a, loadGeneric: (
|
|
604
|
-
const r = i.parse(
|
|
618
|
+
return { generics: a, loadGeneric: (m) => {
|
|
619
|
+
const r = i.parse(m);
|
|
605
620
|
switch (r.schema) {
|
|
606
621
|
case "constants1.schema.json":
|
|
607
622
|
a.manufacturers = {
|
|
@@ -633,7 +648,7 @@ function z(a = {
|
|
|
633
648
|
throw new Error("Got invalid generic file, got data with schema 'devcap1.schema.json'.");
|
|
634
649
|
}
|
|
635
650
|
return o(), !0;
|
|
636
|
-
}, validate: (
|
|
651
|
+
}, validate: (m) => i.parse(m), getSchema: () => i };
|
|
637
652
|
}
|
|
638
653
|
export {
|
|
639
654
|
z as createValidator
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deconz-community/ddf-validator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Validating DDF files for deconz",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deconz",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"ddf",
|
|
10
10
|
"bundle"
|
|
11
11
|
],
|
|
12
|
-
"homepage": "https://github.com/deconz-community/ddf-tools/
|
|
12
|
+
"homepage": "https://github.com/deconz-community/ddf-tools/tree/main/packages/validator",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/deconz-community/ddf-tools/issues/"
|
|
15
15
|
},
|