@deconz-community/ddf-validator 1.0.0 → 1.3.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 +145 -3
- package/dist/ddf-validator.mjs +504 -196
- package/package.json +1 -1
package/dist/ddf-schema.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"$ref":"#/definitions/DDF","definitions":{"DDF":{"anyOf":[{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"devcap1.schema.json"},"doc:path":{"type":"string"},"doc:hdr":{"type":"string"},"md:known_issues":{"type":"array","items":{"type":"string"}},"manufacturername":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"modelid":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"vendor":{"type":"string"},"comment":{"type":"string"},"matchexpr":{"type":"string"},"path":{"type":"string"},"product":{"type":"string"},"sleeper":{"type":"boolean"},"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":{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$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","ZHAAirPurifier","ZHAAirQuality","ZHAAlarm","ZHABattery","Color dimmable light","Color light","Color temperature light","ZHAConsumption","Dimmable light","Dimmable plug-in unit","Dimmer switch","Door lock controller","Door Lock","Extended color light","ZHAFire","ZHAHumidity","ZHALightLevel","On/Off light","On/Off output","On/Off plug-in unit","ZHAOpenClose","ZHAPower","ZHAPresence","ZHAPressure","Range extender","ZHARelativeRotary","Smart plug","ZHASpectral","ZHASwitch","ZHATemperature","ZHAThermostat","ZHAVibration","Warning device","ZHAWater","Window covering device","ZGPSwitch","ZHAAncillaryControl","ZHATime","ZHACarbonMonoxide","ZHADoorLock"]},"restapi":{"type":"string","enum":["/lights","/sensors"]},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","minLength":4,"maxLength":4}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","minLength":4,"maxLength":4},{"type":"string","minLength":6,"maxLength":6}]}]},"fingerprint":{"type":"object","properties":{"profile":{"type":"string","minLength":6,"maxLength":6},"device":{"type":"string","minLength":6,"maxLength":6},"endpoint":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"in":{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}},"out":{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}},"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":{"name":{"type":"string"},"description":{"type":"string"},"comment":{"type":"string"},"public":{"type":"boolean"},"static":{"type":["string","number","boolean"]},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}]},"deprecated":{"type":"string"},"access":{"type":"string","const":"R"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"}},"required":["fn"],"additionalProperties":false}]},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{}},"at":{"type":"string","minLength":6,"maxLength":6},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cmd":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"type":"string","minLength":6,"maxLength":6},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cmd":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus"},"mask":{"type":"string","enum":["alarm1","alarm2"]}},"required":["fn","mask"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr"},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"]},"op":{"type":"string","const":"le"},"to":{}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"at":{"type":"string","minLength":6,"maxLength":6},"idx":{"type":"string","minLength":4,"maxLength":4},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"},"dpid":{"type":"number"},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","dpid"],"additionalProperties":false}]},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"},"dpid":{"type":"number"},"dt":{"type":"string","minLength":4,"maxLength":4},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","dpid","dt"],"additionalProperties":false}]},"awake":{"type":"boolean"},"default":{},"values":{},"refresh.interval":{"type":"number"}},"required":["name"],"additionalProperties":false}},"example":{}},"required":["type","restapi","uuid","items"],"additionalProperties":false}},"bindings":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"bind":{"type":"string","const":"unicast"},"src.ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"dst.ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cl":{"type":"string","minLength":6,"maxLength":6},"report":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"min":{"type":"number"},"max":{"type":"number"},"change":{"type":["string","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","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cl":{"type":"string","minLength":6,"maxLength":6},"config.group":{"type":"number"}},"required":["bind","src.ep","cl","config.group"],"additionalProperties":false}]}}},"required":["schema","manufacturername","modelid","status","subdevices"],"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"},"doc:path":{"type":"string"},"doc:hdr":{"type":"string"},"md:known_issues":{"type":"array","items":{"type":"string"}},"manufacturername":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"modelid":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"vendor":{"type":"string"},"comment":{"type":"string"},"matchexpr":{"type":"string"},"path":{"type":"string"},"product":{"type":"string"},"sleeper":{"type":"boolean"},"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":{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$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","Color dimmable light","Color light","Color temperature light","Dimmable light","Dimmable plug-in unit","Dimmer switch","Door lock controller","Door Lock","Extended color light","On/Off light","On/Off output","On/Off plug-in unit","Range extender","Smart plug","Warning device","Window covering device","ZGPSwitch","ZHAAirPurifier","ZHAAirQuality","ZHAAlarm","ZHAAncillaryControl","ZHABattery","ZHACarbonMonoxide","ZHAConsumption","ZHADoorLock","ZHAFire","ZHAHumidity","ZHALightLevel","ZHAOpenClose","ZHAPower","ZHAPresence","ZHAPressure","ZHARelativeRotary","ZHASpectral","ZHASwitch","ZHATemperature","ZHAThermostat","ZHATime","ZHAVibration","ZHAWater"]},"restapi":{"type":"string","enum":["/lights","/sensors"]},"uuid":{"anyOf":[{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"string","const":"$address.ext"},{"type":"string","minLength":4,"maxLength":4}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","minLength":4,"maxLength":4},{"type":"string","minLength":6,"maxLength":6}]}]},"fingerprint":{"type":"object","properties":{"profile":{"type":"string","minLength":6,"maxLength":6},"device":{"type":"string","minLength":6,"maxLength":6},"endpoint":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"in":{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}},"out":{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}},"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":{"name":{"type":"string","enum":["attr/class","attr/configid","attr/extaddress","attr/groupaddress","attr/id","attr/lastannounced","attr/lastseen","attr/levelmin","attr/manufacturername","attr/modelid","attr/name","attr/nwkaddress","attr/poweronct","attr/poweronlevel","attr/powerup","attr/productid","attr/productname","attr/swconfigid","attr/swversion","attr/type","attr/uniqueid","state/action","state/airquality","state/airqualityppb","state/alarm","state/alert","state/all_on","state/angle","state/any_on","state/armstate","state/battery","state/bri","state/buttonevent","state/carbonmonoxide","state/charging","state/colormode","state/consumption","state/consumption_2","state/ct","state/current","state/current_P1","state/current_P2","state/current_P3","state/dark","state/daylight","state/deviceruntime","state/effect","state/errorcode","state/eventduration","state/expectedeventduration","state/expectedrotation","state/filterruntime","state/fire","state/flag","state/floortemperature","state/gpd_frame_counter","state/gpd_last_pair","state/gesture","state/gradient","state/heating","state/hue","state/humidity","state/lastcheckin","state/lastset","state/lastupdated","state/lift","state/lightlevel","state/localtime","state/lockstate","state/lowbattery","state/lux","state/moisture","state/mountingmodeactive","state/on","state/open","state/orientation_x","state/orientation_y","state/orientation_z","state/pm2_5","state/panel","state/power","state/presence","state/presenceevent","state/pressure","state/production","state/reachable","state/replacefilter","state/rotaryevent","state/sat","state/seconds_remaining","state/spectral_x","state/spectral_y","state/spectral_z","state/speed","state/status","state/sunrise","state/sunset","state/tampered","state/temperature","state/test","state/tilt","state/tiltangle","state/utc","state/valve","state/vibration","state/vibrationstrength","state/voltage","state/water","state/windowopen","state/x","state/y","cap/alert/trigger_effect","cap/bri/min_dim_level","cap/bri/move_with_onoff","cap/color/capabilities","cap/color/ct/computes_xy","cap/color/ct/max","cap/color/ct/min","cap/color/effects","cap/color/gamut_type","cap/color/gradient/max_segments","cap/color/gradient/pixel_count","cap/color/gradient/pixel_length","cap/color/gradient/styles","cap/color/xy/blue_x","cap/color/xy/blue_y","cap/color/xy/green_x","cap/color/xy/green_y","cap/color/xy/red_x","cap/color/xy/red_y","cap/groups/not_supported","cap/on/off_with_effect","cap/sleeper","cap/transition_block","config/alarmsystemid","config/alert","config/allowtouchlink","config/armmode","config/armed_away_entry_delay","config/armed_away_exit_delay","config/armed_away_trigger_duration","config/armed_night_entry_delay","config/armed_night_exit_delay","config/armed_night_trigger_duration","config/armed_stay_entry_delay","config/armed_stay_exit_delay","config/armed_stay_trigger_duration","config/battery","config/bri/execute_if_off","config/bri/max","config/bri/min","config/bri/on_level","config/bri/onoff_transitiontime","config/bri/startup","config/checkin","config/clickmode","config/colorcapabilities","config/color/ct/startup","config/color/execute_if_off","config/color/gradient/reversed","config/color/xy/startup_x","config/color/xy/startup_y","config/configured","config/controlsequence","config/coolsetpoint","config/ctmax","config/ctmin","config/delay","config/devicemode","config/disarmed_entry_delay","config/disarmed_exit_delay","config/displayflipped","config/duration","config/enrolled","config/externalsensortemp","config/externalwindowopen","config/fanmode","config/filterlifetime","config/gpd_device_id","config/gpd_key","config/group","config/heatsetpoint","config/hostflags","config/humiditymaxthreshold","config/humidityminthreshold","config/interfacemode","config/lastchange_amount","config/lastchange_source","config/lastchange_time","config/lat","config/ledindication","config/localtime","config/lock","config/locked","config/long","config/melody","config/mode","config/mountingmode","config/offset","config/on","config/on/startup","config/pending","config/preset","config/pulseconfiguration","config/reachable","config/resetpresence","config/schedule","config/schedule_on","config/selftest","config/sensitivity","config/sensitivitymax","config/setvalve","config/sunriseoffset","config/sunsetoffset","config/swingmode","config/temperaturemaxthreshold","config/temperatureminthreshold","config/temperature","config/temperaturemeasurement","config/tholddark","config/tholdoffset","config/unoccupiedheatsetpoint","config/triggerdistance","config/ubisys_j1_additionalsteps","config/ubisys_j1_configurationandstatus","config/ubisys_j1_inactivepowerthreshold","config/ubisys_j1_installedclosedlimitlift","config/ubisys_j1_installedclosedlimittilt","config/ubisys_j1_installedopenlimitlift","config/ubisys_j1_installedopenlimittilt","config/ubisys_j1_lifttotilttransitionsteps","config/ubisys_j1_lifttotilttransitionsteps2","config/ubisys_j1_mode","config/ubisys_j1_startupsteps","config/ubisys_j1_totalsteps","config/ubisys_j1_totalsteps2","config/ubisys_j1_turnaroundguardtime","config/ubisys_j1_windowcoveringtype","config/url","config/usertest","config/volume","config/windowcoveringtype","config/windowopen_set","attr/mode","state/orientation","state/airqualityformaldehyde","state/airqualityco2"]},"description":{"type":"string"},"comment":{"type":"string"},"public":{"type":"boolean"},"static":{"type":["string","number","boolean"]},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}]},"deprecated":{"type":"string"},"access":{"type":"string","const":"R"},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"}},"required":["fn"],"additionalProperties":false}]},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{}},"at":{"type":"string","minLength":6,"maxLength":6},"cl":{"type":"string","minLength":6,"maxLength":6},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cmd":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"type":"string","minLength":6,"maxLength":6},"cl":{"type":"string","minLength":6,"maxLength":6},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cmd":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus"},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}]}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr"},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"]},"op":{"type":"string","const":"le"},"to":{}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"at":{"type":"string","minLength":6,"maxLength":6},"idx":{"type":"string","minLength":4,"maxLength":4},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"},"dpid":{"type":"number"},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","dpid"],"additionalProperties":false}]},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"},"dpid":{"type":"number"},"dt":{"type":"string","minLength":4,"maxLength":4},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","dpid","dt"],"additionalProperties":false}]},"awake":{"type":"boolean"},"default":{},"values":{},"refresh.interval":{"type":"number"}},"required":["name"],"additionalProperties":false}},"example":{}},"required":["type","restapi","uuid","items"],"additionalProperties":false}},"bindings":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"bind":{"type":"string","const":"unicast"},"src.ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"dst.ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cl":{"type":"string","minLength":6,"maxLength":6},"report":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"min":{"type":"number"},"max":{"type":"number"},"change":{"type":["string","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","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cl":{"type":"string","minLength":6,"maxLength":6},"config.group":{"type":"number"}},"required":["bind","src.ep","cl","config.group"],"additionalProperties":false}]}}},"required":["schema","manufacturername","modelid","status","subdevices"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"constants1.schema.json"},"manufacturers":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$MF\\_"}},"device-types":{"type":"object","additionalProperties":{"type":"string"},"propertyNames":{"pattern":"^\\$TYPE\\_"}}},"required":["schema","manufacturers","device-types"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"resourceitem1.schema.json"},"id":{"type":"string"},"description":{"type":"string"},"deprecated":{"type":"string"},"datatype":{"type":"string","enum":["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Array","Array[3]","ISO 8601 timestamp"]},"access":{"type":"string","enum":["R","W","RW"]},"public":{"type":"boolean"},"implicit":{"type":"boolean"},"managed":{"type":"boolean"},"static":{"type":"boolean"},"virtual":{"type":"boolean"},"parse":{"anyOf":[{"type":"object","properties":{"fn":{"not":{}},"at":{"type":"string","minLength":6,"maxLength":6},"cl":{"type":"string","minLength":6,"maxLength":6},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cmd":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"type":"string","minLength":6,"maxLength":6},"cl":{"type":"string","minLength":6,"maxLength":6},"cppsrc":{"type":"string"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"cmd":{"type":"string","minLength":4,"maxLength":4},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"ias:zonestatus"},"mask":{"anyOf":[{"type":"string","enum":["alarm1","alarm2"]},{"type":"string","const":"alarm1,alarm2"}]}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"numtostr"},"srcitem":{"type":"string","enum":["state/airqualityppb","state/pm2_5"]},"op":{"type":"string","const":"le"},"to":{}},"required":["fn","srcitem","op","to"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"time"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"xiaomi:special"},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"at":{"type":"string","minLength":6,"maxLength":6},"idx":{"type":"string","minLength":4,"maxLength":4},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","idx"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"},"dpid":{"type":"number"},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","dpid"],"additionalProperties":false}]},"read":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"}},"required":["cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"cl":{"type":"string","minLength":6,"maxLength":6},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"}},"required":["fn","cl"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"}},"required":["fn"],"additionalProperties":false}]},"write":{"anyOf":[{"type":"object","properties":{"fn":{"type":"string","const":"none"}},"required":["fn"],"additionalProperties":false},{"type":"object","properties":{"fn":{"not":{}},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"zcl"},"at":{"anyOf":[{"type":"string","minLength":6,"maxLength":6},{"type":"array","items":{"type":"string","minLength":6,"maxLength":6}}]},"state.timeout":{"type":"number"},"change.timeout":{"type":"number"},"cl":{"type":"string","minLength":6,"maxLength":6},"dt":{"type":"string","minLength":4,"maxLength":4},"ep":{"anyOf":[{"type":"string","minLength":4,"maxLength":4},{"type":"number","minimum":0,"maximum":255}]},"mf":{"type":"string","minLength":6,"maxLength":6},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","cl","dt"],"additionalProperties":false},{"type":"object","properties":{"fn":{"type":"string","const":"tuya"},"dpid":{"type":"number"},"dt":{"type":"string","minLength":4,"maxLength":4},"eval":{"type":"string"},"script":{"type":"string"}},"required":["fn","dpid","dt"],"additionalProperties":false}]},"refresh.interval":{"type":"number"},"values":{},"range":{"type":"array","minItems":2,"maxItems":2,"items":[{"type":"number"},{"type":"number"}]},"default":{}},"required":["schema","id","description","datatype","access","public"],"additionalProperties":false},{"type":"object","properties":{"$schema":{"type":"string"},"schema":{"type":"string","const":"subdevice1.schema.json"},"type":{"type":"string","enum":["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$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","Color dimmable light","Color light","Color temperature light","Dimmable light","Dimmable plug-in unit","Dimmer switch","Door lock controller","Door Lock","Extended color light","On/Off light","On/Off output","On/Off plug-in unit","Range extender","Smart plug","Warning device","Window covering device","ZGPSwitch","ZHAAirPurifier","ZHAAirQuality","ZHAAlarm","ZHAAncillaryControl","ZHABattery","ZHACarbonMonoxide","ZHAConsumption","ZHADoorLock","ZHAFire","ZHAHumidity","ZHALightLevel","ZHAOpenClose","ZHAPower","ZHAPresence","ZHAPressure","ZHARelativeRotary","ZHASpectral","ZHASwitch","ZHATemperature","ZHAThermostat","ZHATime","ZHAVibration","ZHAWater"]},"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","minLength":4,"maxLength":4}]},{"type":"array","minItems":3,"maxItems":3,"items":[{"type":"string","const":"$address.ext"},{"type":"string","minLength":4,"maxLength":4},{"type":"string","minLength":6,"maxLength":6}]}]},"items":{"type":"array","items":{"type":"string","enum":["attr/class","attr/configid","attr/extaddress","attr/groupaddress","attr/id","attr/lastannounced","attr/lastseen","attr/levelmin","attr/manufacturername","attr/modelid","attr/name","attr/nwkaddress","attr/poweronct","attr/poweronlevel","attr/powerup","attr/productid","attr/productname","attr/swconfigid","attr/swversion","attr/type","attr/uniqueid","state/action","state/airquality","state/airqualityppb","state/alarm","state/alert","state/all_on","state/angle","state/any_on","state/armstate","state/battery","state/bri","state/buttonevent","state/carbonmonoxide","state/charging","state/colormode","state/consumption","state/consumption_2","state/ct","state/current","state/current_P1","state/current_P2","state/current_P3","state/dark","state/daylight","state/deviceruntime","state/effect","state/errorcode","state/eventduration","state/expectedeventduration","state/expectedrotation","state/filterruntime","state/fire","state/flag","state/floortemperature","state/gpd_frame_counter","state/gpd_last_pair","state/gesture","state/gradient","state/heating","state/hue","state/humidity","state/lastcheckin","state/lastset","state/lastupdated","state/lift","state/lightlevel","state/localtime","state/lockstate","state/lowbattery","state/lux","state/moisture","state/mountingmodeactive","state/on","state/open","state/orientation_x","state/orientation_y","state/orientation_z","state/pm2_5","state/panel","state/power","state/presence","state/presenceevent","state/pressure","state/production","state/reachable","state/replacefilter","state/rotaryevent","state/sat","state/seconds_remaining","state/spectral_x","state/spectral_y","state/spectral_z","state/speed","state/status","state/sunrise","state/sunset","state/tampered","state/temperature","state/test","state/tilt","state/tiltangle","state/utc","state/valve","state/vibration","state/vibrationstrength","state/voltage","state/water","state/windowopen","state/x","state/y","cap/alert/trigger_effect","cap/bri/min_dim_level","cap/bri/move_with_onoff","cap/color/capabilities","cap/color/ct/computes_xy","cap/color/ct/max","cap/color/ct/min","cap/color/effects","cap/color/gamut_type","cap/color/gradient/max_segments","cap/color/gradient/pixel_count","cap/color/gradient/pixel_length","cap/color/gradient/styles","cap/color/xy/blue_x","cap/color/xy/blue_y","cap/color/xy/green_x","cap/color/xy/green_y","cap/color/xy/red_x","cap/color/xy/red_y","cap/groups/not_supported","cap/on/off_with_effect","cap/sleeper","cap/transition_block","config/alarmsystemid","config/alert","config/allowtouchlink","config/armmode","config/armed_away_entry_delay","config/armed_away_exit_delay","config/armed_away_trigger_duration","config/armed_night_entry_delay","config/armed_night_exit_delay","config/armed_night_trigger_duration","config/armed_stay_entry_delay","config/armed_stay_exit_delay","config/armed_stay_trigger_duration","config/battery","config/bri/execute_if_off","config/bri/max","config/bri/min","config/bri/on_level","config/bri/onoff_transitiontime","config/bri/startup","config/checkin","config/clickmode","config/colorcapabilities","config/color/ct/startup","config/color/execute_if_off","config/color/gradient/reversed","config/color/xy/startup_x","config/color/xy/startup_y","config/configured","config/controlsequence","config/coolsetpoint","config/ctmax","config/ctmin","config/delay","config/devicemode","config/disarmed_entry_delay","config/disarmed_exit_delay","config/displayflipped","config/duration","config/enrolled","config/externalsensortemp","config/externalwindowopen","config/fanmode","config/filterlifetime","config/gpd_device_id","config/gpd_key","config/group","config/heatsetpoint","config/hostflags","config/humiditymaxthreshold","config/humidityminthreshold","config/interfacemode","config/lastchange_amount","config/lastchange_source","config/lastchange_time","config/lat","config/ledindication","config/localtime","config/lock","config/locked","config/long","config/melody","config/mode","config/mountingmode","config/offset","config/on","config/on/startup","config/pending","config/preset","config/pulseconfiguration","config/reachable","config/resetpresence","config/schedule","config/schedule_on","config/selftest","config/sensitivity","config/sensitivitymax","config/setvalve","config/sunriseoffset","config/sunsetoffset","config/swingmode","config/temperaturemaxthreshold","config/temperatureminthreshold","config/temperature","config/temperaturemeasurement","config/tholddark","config/tholdoffset","config/unoccupiedheatsetpoint","config/triggerdistance","config/ubisys_j1_additionalsteps","config/ubisys_j1_configurationandstatus","config/ubisys_j1_inactivepowerthreshold","config/ubisys_j1_installedclosedlimitlift","config/ubisys_j1_installedclosedlimittilt","config/ubisys_j1_installedopenlimitlift","config/ubisys_j1_installedopenlimittilt","config/ubisys_j1_lifttotilttransitionsteps","config/ubisys_j1_lifttotilttransitionsteps2","config/ubisys_j1_mode","config/ubisys_j1_startupsteps","config/ubisys_j1_totalsteps","config/ubisys_j1_totalsteps2","config/ubisys_j1_turnaroundguardtime","config/ubisys_j1_windowcoveringtype","config/url","config/usertest","config/volume","config/windowcoveringtype","config/windowopen_set","attr/mode","state/orientation","state/airqualityformaldehyde","state/airqualityco2"]}}},"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 t=require("zod"),s=["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_DOOR_LOCK","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$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","ZHAAirPurifier","ZHAAirQuality","ZHAAlarm","ZHABattery","Color dimmable light","Color light","Color temperature light","ZHAConsumption","Dimmable light","Dimmable plug-in unit","Dimmer switch","Door lock controller","Door Lock","Extended color light","ZHAFire","ZHAHumidity","ZHALightLevel","On/Off light","On/Off output","On/Off plug-in unit","ZHAOpenClose","ZHAPower","ZHAPresence","ZHAPressure","Range extender","ZHARelativeRotary","Smart plug","ZHASpectral","ZHASwitch","ZHATemperature","ZHAThermostat","ZHAVibration","Warning device","ZHAWater","Window covering device","ZGPSwitch","ZHAAncillaryControl","ZHATime","ZHACarbonMonoxide","ZHADoorLock"];function e(n=void 0){return n===void 0?t.z.string():t.z.string().length(2+n)}function o(){return t.z.string()}function p(){return t.z.string()}function i(){return t.z.union([e(2),t.z.number().min(0).max(255)])}function r(){return t.z.string()}function c(){return t.z.custom(n=>{if(!Array.isArray(n)||n.length%2!==0)return!1;for(let a=0;a<n.length;a+=2){const l=n[a],z=n[a+1];if(typeof l!="number"||typeof z!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function u(n){return m().parse(n)}function m(){return t.z.discriminatedUnion("schema",[d().innerType()])}function d(){return t.z.strictObject({$schema:t.z.optional(t.z.string()),schema:t.z.literal("devcap1.schema.json"),"doc:path":t.z.optional(t.z.string()),"doc:hdr":t.z.optional(t.z.string()),"md:known_issues":t.z.optional(t.z.array(t.z.string())),manufacturername:t.z.string().or(t.z.array(t.z.string())),modelid:t.z.string().or(t.z.array(t.z.string())),vendor:t.z.optional(t.z.string()),comment:t.z.optional(t.z.string()),matchexpr:t.z.optional(o()),path:t.z.optional(r()),product:t.z.optional(t.z.string()),sleeper:t.z.optional(t.z.boolean()),supportsMgmtBind:t.z.optional(t.z.boolean()),status:t.z.enum(["Draft","Bronze","Silver","Gold"]).describe("The code quality of the DDF file."),subdevices:t.z.array(E()),bindings:t.z.optional(t.z.array(b()))}).refine(n=>typeof n.manufacturername=="string"&&typeof n.modelid=="string"||Array.isArray(n.manufacturername)&&Array.isArray(n.modelid)&&n.manufacturername.length===n.modelid.length,{message:"manufacturername and modelid should be both strings or arrays with the same length.",path:["manufacturername","modelid"]})}function E(){return t.z.strictObject({type:t.z.enum(s),restapi:t.z.enum(["/lights","/sensors"]),uuid:t.z.union([t.z.tuple([t.z.literal("$address.ext"),e(2)]),t.z.tuple([t.z.literal("$address.ext"),e(2),e(4)])]),fingerprint:t.z.optional(t.z.strictObject({profile:e(4),device:e(4),endpoint:i(),in:t.z.optional(t.z.array(e(4))),out:t.z.optional(t.z.array(e(4)))})),meta:t.z.optional(t.z.strictObject({values:t.z.any(),"group.endpoints":t.z.optional(t.z.array(t.z.number()))})),buttons:t.z.optional(t.z.any()),buttonevents:t.z.optional(t.z.any()),items:t.z.array(T()),example:t.z.optional(t.z.unknown())})}function T(){return t.z.strictObject({name:t.z.string(),description:t.z.optional(t.z.string()),comment:t.z.optional(t.z.string()),public:t.z.optional(t.z.boolean()),static:t.z.optional(t.z.union([t.z.string(),t.z.number(),t.z.boolean()])),range:t.z.optional(t.z.tuple([t.z.number(),t.z.number()])),deprecated:t.z.optional(p()),access:t.z.optional(t.z.literal("R")),read:t.z.optional(t.z.discriminatedUnion("fn",[t.z.strictObject({fn:t.z.literal("none")}),t.z.strictObject({fn:t.z.undefined(),at:t.z.optional(e(4).or(t.z.array(e(4)))),cl:e(4),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o())}),t.z.strictObject({fn:t.z.literal("zcl"),at:t.z.optional(e(4).or(t.z.array(e(4)))),cl:e(4),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o())}),t.z.strictObject({fn:t.z.literal("tuya")})])),parse:t.z.optional(t.z.discriminatedUnion("fn",[t.z.strictObject({fn:t.z.undefined(),at:t.z.optional(e(4)),cl:e(4),ep:t.z.optional(i()),cmd:t.z.optional(e(2)),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("zcl"),at:t.z.optional(e(4)),cl:e(4),ep:t.z.optional(i()),cmd:t.z.optional(e(2)),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("ias:zonestatus"),mask:t.z.enum(["alarm1","alarm2"])}),t.z.strictObject({fn:t.z.literal("numtostr"),srcitem:t.z.enum(["state/airqualityppb","state/pm2_5"]),op:t.z.literal("le"),to:c()}),t.z.strictObject({fn:t.z.literal("xiaomi:special"),ep:t.z.optional(i()),at:t.z.optional(e(4)),idx:e(2),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("tuya"),dpid:t.z.number(),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType()])),write:t.z.optional(t.z.discriminatedUnion("fn",[t.z.strictObject({fn:t.z.literal("none")}),t.z.strictObject({fn:t.z.undefined(),at:t.z.optional(e(4).or(t.z.array(e(4)))),"state.timeout":t.z.optional(t.z.number()),"change.timeout":t.z.optional(t.z.number()),cl:e(4),dt:e(2),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("zcl"),at:t.z.optional(e(4).or(t.z.array(e(4)))),"state.timeout":t.z.optional(t.z.number()),"change.timeout":t.z.optional(t.z.number()),cl:e(4),dt:e(2),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("tuya"),dpid:t.z.number(),dt:e(2),eval:t.z.optional(o()),script:t.z.optional(r())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType()])),awake:t.z.optional(t.z.boolean()),default:t.z.optional(t.z.unknown()),values:t.z.optional(t.z.unknown()),"refresh.interval":t.z.optional(t.z.number())})}function b(){return t.z.discriminatedUnion("bind",[t.z.strictObject({bind:t.z.literal("unicast"),"src.ep":i(),"dst.ep":t.z.optional(i()),cl:e(4),report:t.z.optional(t.z.array(t.z.strictObject({at:e(4),dt:e(2),mf:t.z.optional(e(4)),min:t.z.number(),max:t.z.number(),change:t.z.optional(e().or(t.z.number()))})))}),t.z.strictObject({bind:t.z.literal("groupcast"),"src.ep":i(),cl:e(4),"config.group":t.z.number()})])}exports.validate=u;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),s=["attr/class","attr/configid","attr/extaddress","attr/groupaddress","attr/id","attr/lastannounced","attr/lastseen","attr/levelmin","attr/manufacturername","attr/modelid","attr/name","attr/nwkaddress","attr/poweronct","attr/poweronlevel","attr/powerup","attr/productid","attr/productname","attr/swconfigid","attr/swversion","attr/type","attr/uniqueid","state/action","state/airquality","state/airqualityppb","state/alarm","state/alert","state/all_on","state/angle","state/any_on","state/armstate","state/battery","state/bri","state/buttonevent","state/carbonmonoxide","state/charging","state/colormode","state/consumption","state/consumption_2","state/ct","state/current","state/current_P1","state/current_P2","state/current_P3","state/dark","state/daylight","state/deviceruntime","state/effect","state/errorcode","state/eventduration","state/expectedeventduration","state/expectedrotation","state/filterruntime","state/fire","state/flag","state/floortemperature","state/gpd_frame_counter","state/gpd_last_pair","state/gesture","state/gradient","state/heating","state/hue","state/humidity","state/lastcheckin","state/lastset","state/lastupdated","state/lift","state/lightlevel","state/localtime","state/lockstate","state/lowbattery","state/lux","state/moisture","state/mountingmodeactive","state/on","state/open","state/orientation_x","state/orientation_y","state/orientation_z","state/pm2_5","state/panel","state/power","state/presence","state/presenceevent","state/pressure","state/production","state/reachable","state/replacefilter","state/rotaryevent","state/sat","state/seconds_remaining","state/spectral_x","state/spectral_y","state/spectral_z","state/speed","state/status","state/sunrise","state/sunset","state/tampered","state/temperature","state/test","state/tilt","state/tiltangle","state/utc","state/valve","state/vibration","state/vibrationstrength","state/voltage","state/water","state/windowopen","state/x","state/y","cap/alert/trigger_effect","cap/bri/min_dim_level","cap/bri/move_with_onoff","cap/color/capabilities","cap/color/ct/computes_xy","cap/color/ct/max","cap/color/ct/min","cap/color/effects","cap/color/gamut_type","cap/color/gradient/max_segments","cap/color/gradient/pixel_count","cap/color/gradient/pixel_length","cap/color/gradient/styles","cap/color/xy/blue_x","cap/color/xy/blue_y","cap/color/xy/green_x","cap/color/xy/green_y","cap/color/xy/red_x","cap/color/xy/red_y","cap/groups/not_supported","cap/on/off_with_effect","cap/sleeper","cap/transition_block","config/alarmsystemid","config/alert","config/allowtouchlink","config/armmode","config/armed_away_entry_delay","config/armed_away_exit_delay","config/armed_away_trigger_duration","config/armed_night_entry_delay","config/armed_night_exit_delay","config/armed_night_trigger_duration","config/armed_stay_entry_delay","config/armed_stay_exit_delay","config/armed_stay_trigger_duration","config/battery","config/bri/execute_if_off","config/bri/max","config/bri/min","config/bri/on_level","config/bri/onoff_transitiontime","config/bri/startup","config/checkin","config/clickmode","config/colorcapabilities","config/color/ct/startup","config/color/execute_if_off","config/color/gradient/reversed","config/color/xy/startup_x","config/color/xy/startup_y","config/configured","config/controlsequence","config/coolsetpoint","config/ctmax","config/ctmin","config/delay","config/devicemode","config/disarmed_entry_delay","config/disarmed_exit_delay","config/displayflipped","config/duration","config/enrolled","config/externalsensortemp","config/externalwindowopen","config/fanmode","config/filterlifetime","config/gpd_device_id","config/gpd_key","config/group","config/heatsetpoint","config/hostflags","config/humiditymaxthreshold","config/humidityminthreshold","config/interfacemode","config/lastchange_amount","config/lastchange_source","config/lastchange_time","config/lat","config/ledindication","config/localtime","config/lock","config/locked","config/long","config/melody","config/mode","config/mountingmode","config/offset","config/on","config/on/startup","config/pending","config/preset","config/pulseconfiguration","config/reachable","config/resetpresence","config/schedule","config/schedule_on","config/selftest","config/sensitivity","config/sensitivitymax","config/setvalve","config/sunriseoffset","config/sunsetoffset","config/swingmode","config/temperaturemaxthreshold","config/temperatureminthreshold","config/temperature","config/temperaturemeasurement","config/tholddark","config/tholdoffset","config/unoccupiedheatsetpoint","config/triggerdistance","config/ubisys_j1_additionalsteps","config/ubisys_j1_configurationandstatus","config/ubisys_j1_inactivepowerthreshold","config/ubisys_j1_installedclosedlimitlift","config/ubisys_j1_installedclosedlimittilt","config/ubisys_j1_installedopenlimitlift","config/ubisys_j1_installedopenlimittilt","config/ubisys_j1_lifttotilttransitionsteps","config/ubisys_j1_lifttotilttransitionsteps2","config/ubisys_j1_mode","config/ubisys_j1_startupsteps","config/ubisys_j1_totalsteps","config/ubisys_j1_totalsteps2","config/ubisys_j1_turnaroundguardtime","config/ubisys_j1_windowcoveringtype","config/url","config/usertest","config/volume","config/windowcoveringtype","config/windowopen_set","attr/mode","state/orientation","state/airqualityformaldehyde","state/airqualityco2"],c=["$TYPE_AIR_PURIFIER","$TYPE_AIR_QUALITY_SENSOR","$TYPE_ALARM_SENSOR","$TYPE_BATTERY_SENSOR","$TYPE_COLOR_DIMMABLE_LIGHT","$TYPE_COLOR_LIGHT","$TYPE_COLOR_TEMPERATURE_LIGHT","$TYPE_CONSUMPTION_SENSOR","$TYPE_DIMMABLE_LIGHT","$TYPE_DIMMABLE_PLUGIN_UNIT","$TYPE_DIMMER_SWITCH","$TYPE_DOOR_LOCK","$TYPE_DOOR_LOCK_CONTROLLER","$TYPE_EXTENDED_COLOR_LIGHT","$TYPE_FIRE_SENSOR","$TYPE_HUMIDITY_SENSOR","$TYPE_LIGHT_LEVEL_SENSOR","$TYPE_ON_OFF_LIGHT","$TYPE_ON_OFF_OUTPUT","$TYPE_ON_OFF_PLUGIN_UNIT","$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","Color dimmable light","Color light","Color temperature light","Dimmable light","Dimmable plug-in unit","Dimmer switch","Door lock controller","Door Lock","Extended color light","On/Off light","On/Off output","On/Off plug-in unit","Range extender","Smart plug","Warning device","Window covering device","ZGPSwitch","ZHAAirPurifier","ZHAAirQuality","ZHAAlarm","ZHAAncillaryControl","ZHABattery","ZHACarbonMonoxide","ZHAConsumption","ZHADoorLock","ZHAFire","ZHAHumidity","ZHALightLevel","ZHAOpenClose","ZHAPower","ZHAPresence","ZHAPressure","ZHARelativeRotary","ZHASpectral","ZHASwitch","ZHATemperature","ZHAThermostat","ZHATime","ZHAVibration","ZHAWater"];function e(n=void 0){return n===void 0?t.z.string():t.z.string().length(2+n)}function o(){return t.z.string()}function l(){return t.z.string()}function i(){return t.z.union([e(2),t.z.number().min(0).max(255)])}function a(){return t.z.string()}function d(){return t.z.custom(n=>{if(!Array.isArray(n)||n.length%2!==0)return!1;for(let r=0;r<n.length;r+=2){const g=n[r],m=n[r+1];if(typeof g!="number"||typeof m!="string")return!1}return!0},"The value must be an array with an even number of values and alternating between number and string.")}function p(){return t.z.union([t.z.tuple([t.z.literal("$address.ext"),e(2)]),t.z.tuple([t.z.literal("$address.ext"),e(2),e(4)])])}function _(n){return b().parse(n)}function b(){return t.z.discriminatedUnion("schema",[y(),v(),O(),P()])}function y(){return t.z.strictObject({$schema:t.z.optional(t.z.string()),schema:t.z.literal("devcap1.schema.json"),"doc:path":t.z.optional(t.z.string()),"doc:hdr":t.z.optional(t.z.string()),"md:known_issues":t.z.optional(t.z.array(t.z.string())),manufacturername:t.z.string().or(t.z.array(t.z.string())),modelid:t.z.string().or(t.z.array(t.z.string())),vendor:t.z.optional(t.z.string()),comment:t.z.optional(t.z.string()),matchexpr:t.z.optional(o()),path:t.z.optional(a()),product:t.z.optional(t.z.string()),sleeper:t.z.optional(t.z.boolean()),supportsMgmtBind:t.z.optional(t.z.boolean()),status:t.z.enum(["Draft","Bronze","Silver","Gold"]).describe("The code quality of the DDF file."),subdevices:t.z.array(h()),bindings:t.z.optional(t.z.array(T()))}).refine(n=>typeof n.manufacturername=="string"&&typeof n.modelid=="string"||Array.isArray(n.manufacturername)&&Array.isArray(n.modelid)&&n.manufacturername.length===n.modelid.length,{message:"manufacturername and modelid should be both strings or arrays with the same length.",path:["manufacturername","modelid"]}).innerType()}function h(){return t.z.strictObject({type:t.z.enum(c),restapi:t.z.enum(["/lights","/sensors"]),uuid:p(),fingerprint:t.z.optional(t.z.strictObject({profile:e(4),device:e(4),endpoint:i(),in:t.z.optional(t.z.array(e(4))),out:t.z.optional(t.z.array(e(4)))})),meta:t.z.optional(t.z.strictObject({values:t.z.any(),"group.endpoints":t.z.optional(t.z.array(t.z.number()))})),buttons:t.z.optional(t.z.any()),buttonevents:t.z.optional(t.z.any()),items:t.z.array(E()),example:t.z.optional(t.z.unknown())})}function E(){return t.z.strictObject({name:t.z.enum(s),description:t.z.optional(t.z.string()),comment:t.z.optional(t.z.string()),public:t.z.optional(t.z.boolean()),static:t.z.optional(t.z.union([t.z.string(),t.z.number(),t.z.boolean()])),range:t.z.optional(t.z.tuple([t.z.number(),t.z.number()])),deprecated:t.z.optional(l()),access:t.z.optional(t.z.literal("R")),read:t.z.optional(u()),parse:t.z.optional(z()),write:t.z.optional(f()),awake:t.z.optional(t.z.boolean()),default:t.z.optional(t.z.unknown()),values:t.z.optional(t.z.unknown()),"refresh.interval":t.z.optional(t.z.number())})}function u(){return t.z.discriminatedUnion("fn",[t.z.strictObject({fn:t.z.literal("none")}),t.z.strictObject({fn:t.z.undefined(),at:t.z.optional(e(4).or(t.z.array(e(4)))),cl:e(4),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o())}),t.z.strictObject({fn:t.z.literal("zcl"),at:t.z.optional(e(4).or(t.z.array(e(4)))),cl:e(4),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o())}),t.z.strictObject({fn:t.z.literal("tuya")})])}function z(){return t.z.discriminatedUnion("fn",[t.z.strictObject({fn:t.z.undefined(),at:t.z.optional(e(4)),cl:e(4),cppsrc:t.z.optional(t.z.string()),ep:t.z.optional(i()),cmd:t.z.optional(e(2)),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("zcl"),at:t.z.optional(e(4)),cl:e(4),cppsrc:t.z.optional(t.z.string()),ep:t.z.optional(i()),cmd:t.z.optional(e(2)),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("ias:zonestatus"),mask:t.z.optional(t.z.enum(["alarm1","alarm2"]).or(t.z.literal("alarm1,alarm2")))}),t.z.strictObject({fn:t.z.literal("numtostr"),srcitem:t.z.enum(["state/airqualityppb","state/pm2_5"]),op:t.z.literal("le"),to:d()}),t.z.strictObject({fn:t.z.literal("time")}),t.z.strictObject({fn:t.z.literal("xiaomi:special"),ep:t.z.optional(i()),at:t.z.optional(e(4)),idx:e(2),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("tuya"),dpid:t.z.number(),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType()])}function f(){return t.z.discriminatedUnion("fn",[t.z.strictObject({fn:t.z.literal("none")}),t.z.strictObject({fn:t.z.undefined(),at:t.z.optional(e(4).or(t.z.array(e(4)))),"state.timeout":t.z.optional(t.z.number()),"change.timeout":t.z.optional(t.z.number()),cl:e(4),dt:e(2),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("zcl"),at:t.z.optional(e(4).or(t.z.array(e(4)))),"state.timeout":t.z.optional(t.z.number()),"change.timeout":t.z.optional(t.z.number()),cl:e(4),dt:e(2),ep:t.z.optional(i()),mf:t.z.optional(e(4)),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType(),t.z.strictObject({fn:t.z.literal("tuya"),dpid:t.z.number(),dt:e(2),eval:t.z.optional(o()),script:t.z.optional(a())}).refine(n=>!("eval"in n&&"script"in n),{message:"eval and script should not both be present"}).innerType()])}function T(){return t.z.discriminatedUnion("bind",[t.z.strictObject({bind:t.z.literal("unicast"),"src.ep":i(),"dst.ep":t.z.optional(i()),cl:e(4),report:t.z.optional(t.z.array(t.z.strictObject({at:e(4),dt:e(2),mf:t.z.optional(e(4)),min:t.z.number(),max:t.z.number(),change:t.z.optional(e().or(t.z.number()))})))}),t.z.strictObject({bind:t.z.literal("groupcast"),"src.ep":i(),cl:e(4),"config.group":t.z.number()})])}function v(){return t.z.strictObject({$schema:t.z.optional(t.z.string()),schema:t.z.literal("constants1.schema.json"),manufacturers:t.z.record(t.z.string().startsWith("$MF_"),t.z.string()),"device-types":t.z.record(t.z.string().startsWith("$TYPE_"),t.z.string())})}function O(){return t.z.strictObject({$schema:t.z.optional(t.z.string()),schema:t.z.literal("resourceitem1.schema.json"),id:t.z.string(),description:t.z.string(),deprecated:t.z.optional(l()),datatype:t.z.enum(["String","Bool","Int8","Int16","Int32","Int64","UInt8","UInt16","UInt32","UInt64","Array","Array[3]","ISO 8601 timestamp"]),access:t.z.enum(["R","W","RW"]),public:t.z.boolean(),implicit:t.z.optional(t.z.boolean()),managed:t.z.optional(t.z.boolean()),static:t.z.optional(t.z.boolean()),virtual:t.z.optional(t.z.boolean()),parse:t.z.optional(z()),read:t.z.optional(u()),write:t.z.optional(f()),"refresh.interval":t.z.optional(t.z.number()),values:t.z.optional(t.z.unknown()),range:t.z.optional(t.z.tuple([t.z.number(),t.z.number()])),default:t.z.optional(t.z.unknown())})}function P(){return t.z.strictObject({$schema:t.z.optional(t.z.string()),schema:t.z.literal("subdevice1.schema.json"),type:t.z.enum(c),name:t.z.string(),restapi:t.z.enum(["/lights","/sensors"]),order:t.z.number(),uuid:p(),items:t.z.array(t.z.enum(s))})}exports.validate=_;
|
package/dist/ddf-validator.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type DDF = {
|
|
|
17
17
|
/** The code quality of the DDF file. */
|
|
18
18
|
status: "Draft" | "Bronze" | "Silver" | "Gold";
|
|
19
19
|
subdevices: {
|
|
20
|
-
type: "$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$
|
|
20
|
+
type: "$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$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" | "Color dimmable light" | "Color light" | "Color temperature light" | "Dimmable light" | "Dimmable plug-in unit" | "Dimmer switch" | "Door lock controller" | "Door Lock" | "Extended color light" | "On/Off light" | "On/Off output" | "On/Off plug-in unit" | "Range extender" | "Smart plug" | "Warning device" | "Window covering device" | "ZGPSwitch" | "ZHAAirPurifier" | "ZHAAirQuality" | "ZHAAlarm" | "ZHAAncillaryControl" | "ZHABattery" | "ZHACarbonMonoxide" | "ZHAConsumption" | "ZHADoorLock" | "ZHAFire" | "ZHAHumidity" | "ZHALightLevel" | "ZHAOpenClose" | "ZHAPower" | "ZHAPresence" | "ZHAPressure" | "ZHARelativeRotary" | "ZHASpectral" | "ZHASwitch" | "ZHATemperature" | "ZHAThermostat" | "ZHATime" | "ZHAVibration" | "ZHAWater";
|
|
21
21
|
restapi: "/lights" | "/sensors";
|
|
22
22
|
uuid: [
|
|
23
23
|
"$address.ext",
|
|
@@ -41,7 +41,7 @@ export type DDF = {
|
|
|
41
41
|
buttons?: any | undefined;
|
|
42
42
|
buttonevents?: any | undefined;
|
|
43
43
|
items: {
|
|
44
|
-
name:
|
|
44
|
+
name: "attr/class" | "attr/configid" | "attr/extaddress" | "attr/groupaddress" | "attr/id" | "attr/lastannounced" | "attr/lastseen" | "attr/levelmin" | "attr/manufacturername" | "attr/modelid" | "attr/name" | "attr/nwkaddress" | "attr/poweronct" | "attr/poweronlevel" | "attr/powerup" | "attr/productid" | "attr/productname" | "attr/swconfigid" | "attr/swversion" | "attr/type" | "attr/uniqueid" | "state/action" | "state/airquality" | "state/airqualityppb" | "state/alarm" | "state/alert" | "state/all_on" | "state/angle" | "state/any_on" | "state/armstate" | "state/battery" | "state/bri" | "state/buttonevent" | "state/carbonmonoxide" | "state/charging" | "state/colormode" | "state/consumption" | "state/consumption_2" | "state/ct" | "state/current" | "state/current_P1" | "state/current_P2" | "state/current_P3" | "state/dark" | "state/daylight" | "state/deviceruntime" | "state/effect" | "state/errorcode" | "state/eventduration" | "state/expectedeventduration" | "state/expectedrotation" | "state/filterruntime" | "state/fire" | "state/flag" | "state/floortemperature" | "state/gpd_frame_counter" | "state/gpd_last_pair" | "state/gesture" | "state/gradient" | "state/heating" | "state/hue" | "state/humidity" | "state/lastcheckin" | "state/lastset" | "state/lastupdated" | "state/lift" | "state/lightlevel" | "state/localtime" | "state/lockstate" | "state/lowbattery" | "state/lux" | "state/moisture" | "state/mountingmodeactive" | "state/on" | "state/open" | "state/orientation_x" | "state/orientation_y" | "state/orientation_z" | "state/pm2_5" | "state/panel" | "state/power" | "state/presence" | "state/presenceevent" | "state/pressure" | "state/production" | "state/reachable" | "state/replacefilter" | "state/rotaryevent" | "state/sat" | "state/seconds_remaining" | "state/spectral_x" | "state/spectral_y" | "state/spectral_z" | "state/speed" | "state/status" | "state/sunrise" | "state/sunset" | "state/tampered" | "state/temperature" | "state/test" | "state/tilt" | "state/tiltangle" | "state/utc" | "state/valve" | "state/vibration" | "state/vibrationstrength" | "state/voltage" | "state/water" | "state/windowopen" | "state/x" | "state/y" | "cap/alert/trigger_effect" | "cap/bri/min_dim_level" | "cap/bri/move_with_onoff" | "cap/color/capabilities" | "cap/color/ct/computes_xy" | "cap/color/ct/max" | "cap/color/ct/min" | "cap/color/effects" | "cap/color/gamut_type" | "cap/color/gradient/max_segments" | "cap/color/gradient/pixel_count" | "cap/color/gradient/pixel_length" | "cap/color/gradient/styles" | "cap/color/xy/blue_x" | "cap/color/xy/blue_y" | "cap/color/xy/green_x" | "cap/color/xy/green_y" | "cap/color/xy/red_x" | "cap/color/xy/red_y" | "cap/groups/not_supported" | "cap/on/off_with_effect" | "cap/sleeper" | "cap/transition_block" | "config/alarmsystemid" | "config/alert" | "config/allowtouchlink" | "config/armmode" | "config/armed_away_entry_delay" | "config/armed_away_exit_delay" | "config/armed_away_trigger_duration" | "config/armed_night_entry_delay" | "config/armed_night_exit_delay" | "config/armed_night_trigger_duration" | "config/armed_stay_entry_delay" | "config/armed_stay_exit_delay" | "config/armed_stay_trigger_duration" | "config/battery" | "config/bri/execute_if_off" | "config/bri/max" | "config/bri/min" | "config/bri/on_level" | "config/bri/onoff_transitiontime" | "config/bri/startup" | "config/checkin" | "config/clickmode" | "config/colorcapabilities" | "config/color/ct/startup" | "config/color/execute_if_off" | "config/color/gradient/reversed" | "config/color/xy/startup_x" | "config/color/xy/startup_y" | "config/configured" | "config/controlsequence" | "config/coolsetpoint" | "config/ctmax" | "config/ctmin" | "config/delay" | "config/devicemode" | "config/disarmed_entry_delay" | "config/disarmed_exit_delay" | "config/displayflipped" | "config/duration" | "config/enrolled" | "config/externalsensortemp" | "config/externalwindowopen" | "config/fanmode" | "config/filterlifetime" | "config/gpd_device_id" | "config/gpd_key" | "config/group" | "config/heatsetpoint" | "config/hostflags" | "config/humiditymaxthreshold" | "config/humidityminthreshold" | "config/interfacemode" | "config/lastchange_amount" | "config/lastchange_source" | "config/lastchange_time" | "config/lat" | "config/ledindication" | "config/localtime" | "config/lock" | "config/locked" | "config/long" | "config/melody" | "config/mode" | "config/mountingmode" | "config/offset" | "config/on" | "config/on/startup" | "config/pending" | "config/preset" | "config/pulseconfiguration" | "config/reachable" | "config/resetpresence" | "config/schedule" | "config/schedule_on" | "config/selftest" | "config/sensitivity" | "config/sensitivitymax" | "config/setvalve" | "config/sunriseoffset" | "config/sunsetoffset" | "config/swingmode" | "config/temperaturemaxthreshold" | "config/temperatureminthreshold" | "config/temperature" | "config/temperaturemeasurement" | "config/tholddark" | "config/tholdoffset" | "config/unoccupiedheatsetpoint" | "config/triggerdistance" | "config/ubisys_j1_additionalsteps" | "config/ubisys_j1_configurationandstatus" | "config/ubisys_j1_inactivepowerthreshold" | "config/ubisys_j1_installedclosedlimitlift" | "config/ubisys_j1_installedclosedlimittilt" | "config/ubisys_j1_installedopenlimitlift" | "config/ubisys_j1_installedopenlimittilt" | "config/ubisys_j1_lifttotilttransitionsteps" | "config/ubisys_j1_lifttotilttransitionsteps2" | "config/ubisys_j1_mode" | "config/ubisys_j1_startupsteps" | "config/ubisys_j1_totalsteps" | "config/ubisys_j1_totalsteps2" | "config/ubisys_j1_turnaroundguardtime" | "config/ubisys_j1_windowcoveringtype" | "config/url" | "config/usertest" | "config/volume" | "config/windowcoveringtype" | "config/windowopen_set" | "attr/mode" | "state/orientation" | "state/airqualityformaldehyde" | "state/airqualityco2";
|
|
45
45
|
description?: string | undefined;
|
|
46
46
|
comment?: string | undefined;
|
|
47
47
|
public?: boolean | undefined;
|
|
@@ -75,6 +75,7 @@ export type DDF = {
|
|
|
75
75
|
fn?: undefined;
|
|
76
76
|
at?: string | undefined;
|
|
77
77
|
cl: string;
|
|
78
|
+
cppsrc?: string | undefined;
|
|
78
79
|
ep?: (string | number) | undefined;
|
|
79
80
|
cmd?: string | undefined;
|
|
80
81
|
mf?: string | undefined;
|
|
@@ -84,6 +85,7 @@ export type DDF = {
|
|
|
84
85
|
fn: "zcl";
|
|
85
86
|
at?: string | undefined;
|
|
86
87
|
cl: string;
|
|
88
|
+
cppsrc?: string | undefined;
|
|
87
89
|
ep?: (string | number) | undefined;
|
|
88
90
|
cmd?: string | undefined;
|
|
89
91
|
mf?: string | undefined;
|
|
@@ -91,12 +93,14 @@ export type DDF = {
|
|
|
91
93
|
script?: string | undefined;
|
|
92
94
|
} | {
|
|
93
95
|
fn: "ias:zonestatus";
|
|
94
|
-
mask
|
|
96
|
+
mask?: (("alarm1" | "alarm2") | "alarm1,alarm2") | undefined;
|
|
95
97
|
} | {
|
|
96
98
|
fn: "numtostr";
|
|
97
99
|
srcitem: "state/airqualityppb" | "state/pm2_5";
|
|
98
100
|
op: "le";
|
|
99
101
|
to: any;
|
|
102
|
+
} | {
|
|
103
|
+
fn: "time";
|
|
100
104
|
} | {
|
|
101
105
|
fn: "xiaomi:special";
|
|
102
106
|
ep?: (string | number) | undefined;
|
|
@@ -167,6 +171,144 @@ export type DDF = {
|
|
|
167
171
|
cl: string;
|
|
168
172
|
"config.group": number;
|
|
169
173
|
})[] | undefined;
|
|
174
|
+
} | {
|
|
175
|
+
$schema?: string | undefined;
|
|
176
|
+
schema: "constants1.schema.json";
|
|
177
|
+
manufacturers: {
|
|
178
|
+
[x: string]: string;
|
|
179
|
+
};
|
|
180
|
+
"device-types": {
|
|
181
|
+
[x: string]: string;
|
|
182
|
+
};
|
|
183
|
+
} | {
|
|
184
|
+
$schema?: string | undefined;
|
|
185
|
+
schema: "resourceitem1.schema.json";
|
|
186
|
+
id: string;
|
|
187
|
+
description: string;
|
|
188
|
+
deprecated?: string | undefined;
|
|
189
|
+
datatype: "String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "UInt8" | "UInt16" | "UInt32" | "UInt64" | "Array" | "Array[3]" | "ISO 8601 timestamp";
|
|
190
|
+
access: "R" | "W" | "RW";
|
|
191
|
+
public: boolean;
|
|
192
|
+
implicit?: boolean | undefined;
|
|
193
|
+
managed?: boolean | undefined;
|
|
194
|
+
static?: boolean | undefined;
|
|
195
|
+
virtual?: boolean | undefined;
|
|
196
|
+
parse?: ({
|
|
197
|
+
fn?: undefined;
|
|
198
|
+
at?: string | undefined;
|
|
199
|
+
cl: string;
|
|
200
|
+
cppsrc?: string | undefined;
|
|
201
|
+
ep?: (string | number) | undefined;
|
|
202
|
+
cmd?: string | undefined;
|
|
203
|
+
mf?: string | undefined;
|
|
204
|
+
eval?: string | undefined;
|
|
205
|
+
script?: string | undefined;
|
|
206
|
+
} | {
|
|
207
|
+
fn: "zcl";
|
|
208
|
+
at?: string | undefined;
|
|
209
|
+
cl: string;
|
|
210
|
+
cppsrc?: string | undefined;
|
|
211
|
+
ep?: (string | number) | undefined;
|
|
212
|
+
cmd?: string | undefined;
|
|
213
|
+
mf?: string | undefined;
|
|
214
|
+
eval?: string | undefined;
|
|
215
|
+
script?: string | undefined;
|
|
216
|
+
} | {
|
|
217
|
+
fn: "ias:zonestatus";
|
|
218
|
+
mask?: (("alarm1" | "alarm2") | "alarm1,alarm2") | undefined;
|
|
219
|
+
} | {
|
|
220
|
+
fn: "numtostr";
|
|
221
|
+
srcitem: "state/airqualityppb" | "state/pm2_5";
|
|
222
|
+
op: "le";
|
|
223
|
+
to: any;
|
|
224
|
+
} | {
|
|
225
|
+
fn: "time";
|
|
226
|
+
} | {
|
|
227
|
+
fn: "xiaomi:special";
|
|
228
|
+
ep?: (string | number) | undefined;
|
|
229
|
+
at?: string | undefined;
|
|
230
|
+
idx: string;
|
|
231
|
+
eval?: string | undefined;
|
|
232
|
+
script?: string | undefined;
|
|
233
|
+
} | {
|
|
234
|
+
fn: "tuya";
|
|
235
|
+
dpid: number;
|
|
236
|
+
eval?: string | undefined;
|
|
237
|
+
script?: string | undefined;
|
|
238
|
+
}) | undefined;
|
|
239
|
+
read?: ({
|
|
240
|
+
fn: "none";
|
|
241
|
+
} | {
|
|
242
|
+
fn?: undefined;
|
|
243
|
+
at?: (string | string[]) | undefined;
|
|
244
|
+
cl: string;
|
|
245
|
+
ep?: (string | number) | undefined;
|
|
246
|
+
mf?: string | undefined;
|
|
247
|
+
eval?: string | undefined;
|
|
248
|
+
} | {
|
|
249
|
+
fn: "zcl";
|
|
250
|
+
at?: (string | string[]) | undefined;
|
|
251
|
+
cl: string;
|
|
252
|
+
ep?: (string | number) | undefined;
|
|
253
|
+
mf?: string | undefined;
|
|
254
|
+
eval?: string | undefined;
|
|
255
|
+
} | {
|
|
256
|
+
fn: "tuya";
|
|
257
|
+
}) | undefined;
|
|
258
|
+
write?: ({
|
|
259
|
+
fn: "none";
|
|
260
|
+
} | {
|
|
261
|
+
fn?: undefined;
|
|
262
|
+
at?: (string | string[]) | undefined;
|
|
263
|
+
"state.timeout"?: number | undefined;
|
|
264
|
+
"change.timeout"?: number | undefined;
|
|
265
|
+
cl: string;
|
|
266
|
+
dt: string;
|
|
267
|
+
ep?: (string | number) | undefined;
|
|
268
|
+
mf?: string | undefined;
|
|
269
|
+
eval?: string | undefined;
|
|
270
|
+
script?: string | undefined;
|
|
271
|
+
} | {
|
|
272
|
+
fn: "zcl";
|
|
273
|
+
at?: (string | string[]) | undefined;
|
|
274
|
+
"state.timeout"?: number | undefined;
|
|
275
|
+
"change.timeout"?: number | undefined;
|
|
276
|
+
cl: string;
|
|
277
|
+
dt: string;
|
|
278
|
+
ep?: (string | number) | undefined;
|
|
279
|
+
mf?: string | undefined;
|
|
280
|
+
eval?: string | undefined;
|
|
281
|
+
script?: string | undefined;
|
|
282
|
+
} | {
|
|
283
|
+
fn: "tuya";
|
|
284
|
+
dpid: number;
|
|
285
|
+
dt: string;
|
|
286
|
+
eval?: string | undefined;
|
|
287
|
+
script?: string | undefined;
|
|
288
|
+
}) | undefined;
|
|
289
|
+
"refresh.interval"?: number | undefined;
|
|
290
|
+
values?: unknown | undefined;
|
|
291
|
+
range?: [
|
|
292
|
+
number,
|
|
293
|
+
number
|
|
294
|
+
] | undefined;
|
|
295
|
+
default?: unknown | undefined;
|
|
296
|
+
} | {
|
|
297
|
+
$schema?: string | undefined;
|
|
298
|
+
schema: "subdevice1.schema.json";
|
|
299
|
+
type: "$TYPE_AIR_PURIFIER" | "$TYPE_AIR_QUALITY_SENSOR" | "$TYPE_ALARM_SENSOR" | "$TYPE_BATTERY_SENSOR" | "$TYPE_COLOR_DIMMABLE_LIGHT" | "$TYPE_COLOR_LIGHT" | "$TYPE_COLOR_TEMPERATURE_LIGHT" | "$TYPE_CONSUMPTION_SENSOR" | "$TYPE_DIMMABLE_LIGHT" | "$TYPE_DIMMABLE_PLUGIN_UNIT" | "$TYPE_DIMMER_SWITCH" | "$TYPE_DOOR_LOCK" | "$TYPE_DOOR_LOCK_CONTROLLER" | "$TYPE_EXTENDED_COLOR_LIGHT" | "$TYPE_FIRE_SENSOR" | "$TYPE_HUMIDITY_SENSOR" | "$TYPE_LIGHT_LEVEL_SENSOR" | "$TYPE_ON_OFF_LIGHT" | "$TYPE_ON_OFF_OUTPUT" | "$TYPE_ON_OFF_PLUGIN_UNIT" | "$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" | "Color dimmable light" | "Color light" | "Color temperature light" | "Dimmable light" | "Dimmable plug-in unit" | "Dimmer switch" | "Door lock controller" | "Door Lock" | "Extended color light" | "On/Off light" | "On/Off output" | "On/Off plug-in unit" | "Range extender" | "Smart plug" | "Warning device" | "Window covering device" | "ZGPSwitch" | "ZHAAirPurifier" | "ZHAAirQuality" | "ZHAAlarm" | "ZHAAncillaryControl" | "ZHABattery" | "ZHACarbonMonoxide" | "ZHAConsumption" | "ZHADoorLock" | "ZHAFire" | "ZHAHumidity" | "ZHALightLevel" | "ZHAOpenClose" | "ZHAPower" | "ZHAPresence" | "ZHAPressure" | "ZHARelativeRotary" | "ZHASpectral" | "ZHASwitch" | "ZHATemperature" | "ZHAThermostat" | "ZHATime" | "ZHAVibration" | "ZHAWater";
|
|
300
|
+
name: string;
|
|
301
|
+
restapi: "/lights" | "/sensors";
|
|
302
|
+
order: number;
|
|
303
|
+
uuid: [
|
|
304
|
+
"$address.ext",
|
|
305
|
+
string
|
|
306
|
+
] | [
|
|
307
|
+
"$address.ext",
|
|
308
|
+
string,
|
|
309
|
+
string
|
|
310
|
+
];
|
|
311
|
+
items: ("attr/class" | "attr/configid" | "attr/extaddress" | "attr/groupaddress" | "attr/id" | "attr/lastannounced" | "attr/lastseen" | "attr/levelmin" | "attr/manufacturername" | "attr/modelid" | "attr/name" | "attr/nwkaddress" | "attr/poweronct" | "attr/poweronlevel" | "attr/powerup" | "attr/productid" | "attr/productname" | "attr/swconfigid" | "attr/swversion" | "attr/type" | "attr/uniqueid" | "state/action" | "state/airquality" | "state/airqualityppb" | "state/alarm" | "state/alert" | "state/all_on" | "state/angle" | "state/any_on" | "state/armstate" | "state/battery" | "state/bri" | "state/buttonevent" | "state/carbonmonoxide" | "state/charging" | "state/colormode" | "state/consumption" | "state/consumption_2" | "state/ct" | "state/current" | "state/current_P1" | "state/current_P2" | "state/current_P3" | "state/dark" | "state/daylight" | "state/deviceruntime" | "state/effect" | "state/errorcode" | "state/eventduration" | "state/expectedeventduration" | "state/expectedrotation" | "state/filterruntime" | "state/fire" | "state/flag" | "state/floortemperature" | "state/gpd_frame_counter" | "state/gpd_last_pair" | "state/gesture" | "state/gradient" | "state/heating" | "state/hue" | "state/humidity" | "state/lastcheckin" | "state/lastset" | "state/lastupdated" | "state/lift" | "state/lightlevel" | "state/localtime" | "state/lockstate" | "state/lowbattery" | "state/lux" | "state/moisture" | "state/mountingmodeactive" | "state/on" | "state/open" | "state/orientation_x" | "state/orientation_y" | "state/orientation_z" | "state/pm2_5" | "state/panel" | "state/power" | "state/presence" | "state/presenceevent" | "state/pressure" | "state/production" | "state/reachable" | "state/replacefilter" | "state/rotaryevent" | "state/sat" | "state/seconds_remaining" | "state/spectral_x" | "state/spectral_y" | "state/spectral_z" | "state/speed" | "state/status" | "state/sunrise" | "state/sunset" | "state/tampered" | "state/temperature" | "state/test" | "state/tilt" | "state/tiltangle" | "state/utc" | "state/valve" | "state/vibration" | "state/vibrationstrength" | "state/voltage" | "state/water" | "state/windowopen" | "state/x" | "state/y" | "cap/alert/trigger_effect" | "cap/bri/min_dim_level" | "cap/bri/move_with_onoff" | "cap/color/capabilities" | "cap/color/ct/computes_xy" | "cap/color/ct/max" | "cap/color/ct/min" | "cap/color/effects" | "cap/color/gamut_type" | "cap/color/gradient/max_segments" | "cap/color/gradient/pixel_count" | "cap/color/gradient/pixel_length" | "cap/color/gradient/styles" | "cap/color/xy/blue_x" | "cap/color/xy/blue_y" | "cap/color/xy/green_x" | "cap/color/xy/green_y" | "cap/color/xy/red_x" | "cap/color/xy/red_y" | "cap/groups/not_supported" | "cap/on/off_with_effect" | "cap/sleeper" | "cap/transition_block" | "config/alarmsystemid" | "config/alert" | "config/allowtouchlink" | "config/armmode" | "config/armed_away_entry_delay" | "config/armed_away_exit_delay" | "config/armed_away_trigger_duration" | "config/armed_night_entry_delay" | "config/armed_night_exit_delay" | "config/armed_night_trigger_duration" | "config/armed_stay_entry_delay" | "config/armed_stay_exit_delay" | "config/armed_stay_trigger_duration" | "config/battery" | "config/bri/execute_if_off" | "config/bri/max" | "config/bri/min" | "config/bri/on_level" | "config/bri/onoff_transitiontime" | "config/bri/startup" | "config/checkin" | "config/clickmode" | "config/colorcapabilities" | "config/color/ct/startup" | "config/color/execute_if_off" | "config/color/gradient/reversed" | "config/color/xy/startup_x" | "config/color/xy/startup_y" | "config/configured" | "config/controlsequence" | "config/coolsetpoint" | "config/ctmax" | "config/ctmin" | "config/delay" | "config/devicemode" | "config/disarmed_entry_delay" | "config/disarmed_exit_delay" | "config/displayflipped" | "config/duration" | "config/enrolled" | "config/externalsensortemp" | "config/externalwindowopen" | "config/fanmode" | "config/filterlifetime" | "config/gpd_device_id" | "config/gpd_key" | "config/group" | "config/heatsetpoint" | "config/hostflags" | "config/humiditymaxthreshold" | "config/humidityminthreshold" | "config/interfacemode" | "config/lastchange_amount" | "config/lastchange_source" | "config/lastchange_time" | "config/lat" | "config/ledindication" | "config/localtime" | "config/lock" | "config/locked" | "config/long" | "config/melody" | "config/mode" | "config/mountingmode" | "config/offset" | "config/on" | "config/on/startup" | "config/pending" | "config/preset" | "config/pulseconfiguration" | "config/reachable" | "config/resetpresence" | "config/schedule" | "config/schedule_on" | "config/selftest" | "config/sensitivity" | "config/sensitivitymax" | "config/setvalve" | "config/sunriseoffset" | "config/sunsetoffset" | "config/swingmode" | "config/temperaturemaxthreshold" | "config/temperatureminthreshold" | "config/temperature" | "config/temperaturemeasurement" | "config/tholddark" | "config/tholdoffset" | "config/unoccupiedheatsetpoint" | "config/triggerdistance" | "config/ubisys_j1_additionalsteps" | "config/ubisys_j1_configurationandstatus" | "config/ubisys_j1_inactivepowerthreshold" | "config/ubisys_j1_installedclosedlimitlift" | "config/ubisys_j1_installedclosedlimittilt" | "config/ubisys_j1_installedopenlimitlift" | "config/ubisys_j1_installedopenlimittilt" | "config/ubisys_j1_lifttotilttransitionsteps" | "config/ubisys_j1_lifttotilttransitionsteps2" | "config/ubisys_j1_mode" | "config/ubisys_j1_startupsteps" | "config/ubisys_j1_totalsteps" | "config/ubisys_j1_totalsteps2" | "config/ubisys_j1_turnaroundguardtime" | "config/ubisys_j1_windowcoveringtype" | "config/url" | "config/usertest" | "config/volume" | "config/windowcoveringtype" | "config/windowopen_set" | "attr/mode" | "state/orientation" | "state/airqualityformaldehyde" | "state/airqualityco2")[];
|
|
170
312
|
};
|
|
171
313
|
|
|
172
314
|
export declare function validate(data: unknown): DDF
|
package/dist/ddf-validator.mjs
CHANGED
|
@@ -1,5 +1,255 @@
|
|
|
1
1
|
import { z as t } from "zod";
|
|
2
|
-
const
|
|
2
|
+
const s = [
|
|
3
|
+
"attr/class",
|
|
4
|
+
"attr/configid",
|
|
5
|
+
"attr/extaddress",
|
|
6
|
+
"attr/groupaddress",
|
|
7
|
+
"attr/id",
|
|
8
|
+
"attr/lastannounced",
|
|
9
|
+
"attr/lastseen",
|
|
10
|
+
"attr/levelmin",
|
|
11
|
+
"attr/manufacturername",
|
|
12
|
+
"attr/modelid",
|
|
13
|
+
"attr/name",
|
|
14
|
+
"attr/nwkaddress",
|
|
15
|
+
"attr/poweronct",
|
|
16
|
+
"attr/poweronlevel",
|
|
17
|
+
"attr/powerup",
|
|
18
|
+
"attr/productid",
|
|
19
|
+
"attr/productname",
|
|
20
|
+
"attr/swconfigid",
|
|
21
|
+
"attr/swversion",
|
|
22
|
+
"attr/type",
|
|
23
|
+
"attr/uniqueid",
|
|
24
|
+
"state/action",
|
|
25
|
+
"state/airquality",
|
|
26
|
+
"state/airqualityppb",
|
|
27
|
+
"state/alarm",
|
|
28
|
+
"state/alert",
|
|
29
|
+
"state/all_on",
|
|
30
|
+
"state/angle",
|
|
31
|
+
"state/any_on",
|
|
32
|
+
"state/armstate",
|
|
33
|
+
"state/battery",
|
|
34
|
+
"state/bri",
|
|
35
|
+
"state/buttonevent",
|
|
36
|
+
"state/carbonmonoxide",
|
|
37
|
+
"state/charging",
|
|
38
|
+
"state/colormode",
|
|
39
|
+
"state/consumption",
|
|
40
|
+
"state/consumption_2",
|
|
41
|
+
"state/ct",
|
|
42
|
+
"state/current",
|
|
43
|
+
"state/current_P1",
|
|
44
|
+
"state/current_P2",
|
|
45
|
+
"state/current_P3",
|
|
46
|
+
"state/dark",
|
|
47
|
+
"state/daylight",
|
|
48
|
+
"state/deviceruntime",
|
|
49
|
+
"state/effect",
|
|
50
|
+
"state/errorcode",
|
|
51
|
+
"state/eventduration",
|
|
52
|
+
"state/expectedeventduration",
|
|
53
|
+
"state/expectedrotation",
|
|
54
|
+
"state/filterruntime",
|
|
55
|
+
"state/fire",
|
|
56
|
+
"state/flag",
|
|
57
|
+
"state/floortemperature",
|
|
58
|
+
"state/gpd_frame_counter",
|
|
59
|
+
"state/gpd_last_pair",
|
|
60
|
+
"state/gesture",
|
|
61
|
+
"state/gradient",
|
|
62
|
+
"state/heating",
|
|
63
|
+
"state/hue",
|
|
64
|
+
"state/humidity",
|
|
65
|
+
"state/lastcheckin",
|
|
66
|
+
"state/lastset",
|
|
67
|
+
"state/lastupdated",
|
|
68
|
+
"state/lift",
|
|
69
|
+
"state/lightlevel",
|
|
70
|
+
"state/localtime",
|
|
71
|
+
"state/lockstate",
|
|
72
|
+
"state/lowbattery",
|
|
73
|
+
"state/lux",
|
|
74
|
+
"state/moisture",
|
|
75
|
+
"state/mountingmodeactive",
|
|
76
|
+
"state/on",
|
|
77
|
+
"state/open",
|
|
78
|
+
"state/orientation_x",
|
|
79
|
+
"state/orientation_y",
|
|
80
|
+
"state/orientation_z",
|
|
81
|
+
"state/pm2_5",
|
|
82
|
+
"state/panel",
|
|
83
|
+
"state/power",
|
|
84
|
+
"state/presence",
|
|
85
|
+
"state/presenceevent",
|
|
86
|
+
"state/pressure",
|
|
87
|
+
"state/production",
|
|
88
|
+
"state/reachable",
|
|
89
|
+
"state/replacefilter",
|
|
90
|
+
"state/rotaryevent",
|
|
91
|
+
"state/sat",
|
|
92
|
+
"state/seconds_remaining",
|
|
93
|
+
"state/spectral_x",
|
|
94
|
+
"state/spectral_y",
|
|
95
|
+
"state/spectral_z",
|
|
96
|
+
"state/speed",
|
|
97
|
+
"state/status",
|
|
98
|
+
"state/sunrise",
|
|
99
|
+
"state/sunset",
|
|
100
|
+
"state/tampered",
|
|
101
|
+
"state/temperature",
|
|
102
|
+
"state/test",
|
|
103
|
+
"state/tilt",
|
|
104
|
+
"state/tiltangle",
|
|
105
|
+
"state/utc",
|
|
106
|
+
"state/valve",
|
|
107
|
+
"state/vibration",
|
|
108
|
+
"state/vibrationstrength",
|
|
109
|
+
"state/voltage",
|
|
110
|
+
"state/water",
|
|
111
|
+
"state/windowopen",
|
|
112
|
+
"state/x",
|
|
113
|
+
"state/y",
|
|
114
|
+
"cap/alert/trigger_effect",
|
|
115
|
+
"cap/bri/min_dim_level",
|
|
116
|
+
"cap/bri/move_with_onoff",
|
|
117
|
+
"cap/color/capabilities",
|
|
118
|
+
"cap/color/ct/computes_xy",
|
|
119
|
+
"cap/color/ct/max",
|
|
120
|
+
"cap/color/ct/min",
|
|
121
|
+
"cap/color/effects",
|
|
122
|
+
"cap/color/gamut_type",
|
|
123
|
+
"cap/color/gradient/max_segments",
|
|
124
|
+
"cap/color/gradient/pixel_count",
|
|
125
|
+
"cap/color/gradient/pixel_length",
|
|
126
|
+
"cap/color/gradient/styles",
|
|
127
|
+
"cap/color/xy/blue_x",
|
|
128
|
+
"cap/color/xy/blue_y",
|
|
129
|
+
"cap/color/xy/green_x",
|
|
130
|
+
"cap/color/xy/green_y",
|
|
131
|
+
"cap/color/xy/red_x",
|
|
132
|
+
"cap/color/xy/red_y",
|
|
133
|
+
"cap/groups/not_supported",
|
|
134
|
+
"cap/on/off_with_effect",
|
|
135
|
+
"cap/sleeper",
|
|
136
|
+
"cap/transition_block",
|
|
137
|
+
"config/alarmsystemid",
|
|
138
|
+
"config/alert",
|
|
139
|
+
"config/allowtouchlink",
|
|
140
|
+
"config/armmode",
|
|
141
|
+
"config/armed_away_entry_delay",
|
|
142
|
+
"config/armed_away_exit_delay",
|
|
143
|
+
"config/armed_away_trigger_duration",
|
|
144
|
+
"config/armed_night_entry_delay",
|
|
145
|
+
"config/armed_night_exit_delay",
|
|
146
|
+
"config/armed_night_trigger_duration",
|
|
147
|
+
"config/armed_stay_entry_delay",
|
|
148
|
+
"config/armed_stay_exit_delay",
|
|
149
|
+
"config/armed_stay_trigger_duration",
|
|
150
|
+
"config/battery",
|
|
151
|
+
"config/bri/execute_if_off",
|
|
152
|
+
"config/bri/max",
|
|
153
|
+
"config/bri/min",
|
|
154
|
+
"config/bri/on_level",
|
|
155
|
+
"config/bri/onoff_transitiontime",
|
|
156
|
+
"config/bri/startup",
|
|
157
|
+
"config/checkin",
|
|
158
|
+
"config/clickmode",
|
|
159
|
+
"config/colorcapabilities",
|
|
160
|
+
"config/color/ct/startup",
|
|
161
|
+
"config/color/execute_if_off",
|
|
162
|
+
"config/color/gradient/reversed",
|
|
163
|
+
"config/color/xy/startup_x",
|
|
164
|
+
"config/color/xy/startup_y",
|
|
165
|
+
"config/configured",
|
|
166
|
+
"config/controlsequence",
|
|
167
|
+
"config/coolsetpoint",
|
|
168
|
+
"config/ctmax",
|
|
169
|
+
"config/ctmin",
|
|
170
|
+
"config/delay",
|
|
171
|
+
"config/devicemode",
|
|
172
|
+
"config/disarmed_entry_delay",
|
|
173
|
+
"config/disarmed_exit_delay",
|
|
174
|
+
"config/displayflipped",
|
|
175
|
+
"config/duration",
|
|
176
|
+
"config/enrolled",
|
|
177
|
+
"config/externalsensortemp",
|
|
178
|
+
"config/externalwindowopen",
|
|
179
|
+
"config/fanmode",
|
|
180
|
+
"config/filterlifetime",
|
|
181
|
+
"config/gpd_device_id",
|
|
182
|
+
"config/gpd_key",
|
|
183
|
+
"config/group",
|
|
184
|
+
"config/heatsetpoint",
|
|
185
|
+
"config/hostflags",
|
|
186
|
+
"config/humiditymaxthreshold",
|
|
187
|
+
"config/humidityminthreshold",
|
|
188
|
+
"config/interfacemode",
|
|
189
|
+
"config/lastchange_amount",
|
|
190
|
+
"config/lastchange_source",
|
|
191
|
+
"config/lastchange_time",
|
|
192
|
+
"config/lat",
|
|
193
|
+
"config/ledindication",
|
|
194
|
+
"config/localtime",
|
|
195
|
+
"config/lock",
|
|
196
|
+
"config/locked",
|
|
197
|
+
"config/long",
|
|
198
|
+
"config/melody",
|
|
199
|
+
"config/mode",
|
|
200
|
+
"config/mountingmode",
|
|
201
|
+
"config/offset",
|
|
202
|
+
"config/on",
|
|
203
|
+
"config/on/startup",
|
|
204
|
+
"config/pending",
|
|
205
|
+
"config/preset",
|
|
206
|
+
"config/pulseconfiguration",
|
|
207
|
+
"config/reachable",
|
|
208
|
+
"config/resetpresence",
|
|
209
|
+
"config/schedule",
|
|
210
|
+
"config/schedule_on",
|
|
211
|
+
"config/selftest",
|
|
212
|
+
"config/sensitivity",
|
|
213
|
+
"config/sensitivitymax",
|
|
214
|
+
"config/setvalve",
|
|
215
|
+
"config/sunriseoffset",
|
|
216
|
+
"config/sunsetoffset",
|
|
217
|
+
"config/swingmode",
|
|
218
|
+
"config/temperaturemaxthreshold",
|
|
219
|
+
"config/temperatureminthreshold",
|
|
220
|
+
"config/temperature",
|
|
221
|
+
"config/temperaturemeasurement",
|
|
222
|
+
"config/tholddark",
|
|
223
|
+
"config/tholdoffset",
|
|
224
|
+
"config/unoccupiedheatsetpoint",
|
|
225
|
+
"config/triggerdistance",
|
|
226
|
+
"config/ubisys_j1_additionalsteps",
|
|
227
|
+
"config/ubisys_j1_configurationandstatus",
|
|
228
|
+
"config/ubisys_j1_inactivepowerthreshold",
|
|
229
|
+
"config/ubisys_j1_installedclosedlimitlift",
|
|
230
|
+
"config/ubisys_j1_installedclosedlimittilt",
|
|
231
|
+
"config/ubisys_j1_installedopenlimitlift",
|
|
232
|
+
"config/ubisys_j1_installedopenlimittilt",
|
|
233
|
+
"config/ubisys_j1_lifttotilttransitionsteps",
|
|
234
|
+
"config/ubisys_j1_lifttotilttransitionsteps2",
|
|
235
|
+
"config/ubisys_j1_mode",
|
|
236
|
+
"config/ubisys_j1_startupsteps",
|
|
237
|
+
"config/ubisys_j1_totalsteps",
|
|
238
|
+
"config/ubisys_j1_totalsteps2",
|
|
239
|
+
"config/ubisys_j1_turnaroundguardtime",
|
|
240
|
+
"config/ubisys_j1_windowcoveringtype",
|
|
241
|
+
"config/url",
|
|
242
|
+
"config/usertest",
|
|
243
|
+
"config/volume",
|
|
244
|
+
"config/windowcoveringtype",
|
|
245
|
+
"config/windowopen_set",
|
|
246
|
+
// Missing from resource.cpp
|
|
247
|
+
"attr/mode",
|
|
248
|
+
"state/orientation",
|
|
249
|
+
// Just present in at least one DDF
|
|
250
|
+
"state/airqualityformaldehyde",
|
|
251
|
+
"state/airqualityco2"
|
|
252
|
+
], c = [
|
|
3
253
|
"$TYPE_AIR_PURIFIER",
|
|
4
254
|
"$TYPE_AIR_QUALITY_SENSOR",
|
|
5
255
|
"$TYPE_ALARM_SENSOR",
|
|
@@ -11,8 +261,8 @@ const p = [
|
|
|
11
261
|
"$TYPE_DIMMABLE_LIGHT",
|
|
12
262
|
"$TYPE_DIMMABLE_PLUGIN_UNIT",
|
|
13
263
|
"$TYPE_DIMMER_SWITCH",
|
|
14
|
-
"$TYPE_DOOR_LOCK_CONTROLLER",
|
|
15
264
|
"$TYPE_DOOR_LOCK",
|
|
265
|
+
"$TYPE_DOOR_LOCK_CONTROLLER",
|
|
16
266
|
"$TYPE_EXTENDED_COLOR_LIGHT",
|
|
17
267
|
"$TYPE_FIRE_SENSOR",
|
|
18
268
|
"$TYPE_HUMIDITY_SENSOR",
|
|
@@ -36,86 +286,102 @@ const p = [
|
|
|
36
286
|
"$TYPE_WATER_LEAK_SENSOR",
|
|
37
287
|
"$TYPE_WINDOW_COVERING_DEVICE",
|
|
38
288
|
"$TYPE_ZGP_SWITCH",
|
|
39
|
-
"ZHAAirPurifier",
|
|
40
|
-
"ZHAAirQuality",
|
|
41
|
-
"ZHAAlarm",
|
|
42
|
-
"ZHABattery",
|
|
43
289
|
"Color dimmable light",
|
|
44
290
|
"Color light",
|
|
45
291
|
"Color temperature light",
|
|
46
|
-
"ZHAConsumption",
|
|
47
292
|
"Dimmable light",
|
|
48
293
|
"Dimmable plug-in unit",
|
|
49
294
|
"Dimmer switch",
|
|
50
295
|
"Door lock controller",
|
|
51
296
|
"Door Lock",
|
|
52
297
|
"Extended color light",
|
|
53
|
-
"ZHAFire",
|
|
54
|
-
"ZHAHumidity",
|
|
55
|
-
"ZHALightLevel",
|
|
56
298
|
"On/Off light",
|
|
57
299
|
"On/Off output",
|
|
58
300
|
"On/Off plug-in unit",
|
|
301
|
+
"Range extender",
|
|
302
|
+
"Smart plug",
|
|
303
|
+
"Warning device",
|
|
304
|
+
"Window covering device",
|
|
305
|
+
"ZGPSwitch",
|
|
306
|
+
"ZHAAirPurifier",
|
|
307
|
+
"ZHAAirQuality",
|
|
308
|
+
"ZHAAlarm",
|
|
309
|
+
"ZHAAncillaryControl",
|
|
310
|
+
"ZHABattery",
|
|
311
|
+
"ZHACarbonMonoxide",
|
|
312
|
+
"ZHAConsumption",
|
|
313
|
+
"ZHADoorLock",
|
|
314
|
+
"ZHAFire",
|
|
315
|
+
"ZHAHumidity",
|
|
316
|
+
"ZHALightLevel",
|
|
59
317
|
"ZHAOpenClose",
|
|
60
318
|
"ZHAPower",
|
|
61
319
|
"ZHAPresence",
|
|
62
320
|
"ZHAPressure",
|
|
63
|
-
"Range extender",
|
|
64
321
|
"ZHARelativeRotary",
|
|
65
|
-
"Smart plug",
|
|
66
322
|
"ZHASpectral",
|
|
67
323
|
"ZHASwitch",
|
|
68
324
|
"ZHATemperature",
|
|
69
325
|
"ZHAThermostat",
|
|
70
|
-
"ZHAVibration",
|
|
71
|
-
"Warning device",
|
|
72
|
-
"ZHAWater",
|
|
73
|
-
"Window covering device",
|
|
74
|
-
"ZGPSwitch",
|
|
75
|
-
"ZHAAncillaryControl",
|
|
76
326
|
"ZHATime",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
327
|
+
"ZHAVibration",
|
|
328
|
+
"ZHAWater"
|
|
79
329
|
];
|
|
80
|
-
function n
|
|
81
|
-
return
|
|
330
|
+
function e(n = void 0) {
|
|
331
|
+
return n === void 0 ? t.string() : t.string().length(2 + n);
|
|
82
332
|
}
|
|
83
333
|
function o() {
|
|
84
334
|
return t.string();
|
|
85
335
|
}
|
|
86
|
-
function
|
|
336
|
+
function l() {
|
|
87
337
|
return t.string();
|
|
88
338
|
}
|
|
89
339
|
function i() {
|
|
90
340
|
return t.union([
|
|
91
|
-
|
|
341
|
+
e(2),
|
|
92
342
|
t.number().min(0).max(255)
|
|
93
343
|
]);
|
|
94
344
|
}
|
|
95
|
-
function
|
|
345
|
+
function a() {
|
|
96
346
|
return t.string();
|
|
97
347
|
}
|
|
98
|
-
function
|
|
99
|
-
return t.custom((
|
|
100
|
-
if (!Array.isArray(
|
|
348
|
+
function _() {
|
|
349
|
+
return t.custom((n) => {
|
|
350
|
+
if (!Array.isArray(n) || n.length % 2 !== 0)
|
|
101
351
|
return !1;
|
|
102
|
-
for (let
|
|
103
|
-
const
|
|
104
|
-
if (typeof
|
|
352
|
+
for (let r = 0; r < n.length; r += 2) {
|
|
353
|
+
const m = n[r], d = n[r + 1];
|
|
354
|
+
if (typeof m != "number" || typeof d != "string")
|
|
105
355
|
return !1;
|
|
106
356
|
}
|
|
107
357
|
return !0;
|
|
108
358
|
}, "The value must be an array with an even number of values and alternating between number and string.");
|
|
109
359
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
360
|
+
function p() {
|
|
361
|
+
return t.union([
|
|
362
|
+
t.tuple([
|
|
363
|
+
t.literal("$address.ext"),
|
|
364
|
+
e(2)
|
|
365
|
+
]),
|
|
366
|
+
t.tuple([
|
|
367
|
+
t.literal("$address.ext"),
|
|
368
|
+
e(2),
|
|
369
|
+
e(4)
|
|
370
|
+
])
|
|
371
|
+
]);
|
|
112
372
|
}
|
|
113
|
-
function
|
|
373
|
+
function A(n) {
|
|
374
|
+
return b().parse(n);
|
|
375
|
+
}
|
|
376
|
+
function b() {
|
|
114
377
|
return t.discriminatedUnion("schema", [
|
|
115
|
-
|
|
378
|
+
y(),
|
|
379
|
+
v(),
|
|
380
|
+
O(),
|
|
381
|
+
P()
|
|
116
382
|
]);
|
|
117
383
|
}
|
|
118
|
-
function
|
|
384
|
+
function y() {
|
|
119
385
|
return t.strictObject({
|
|
120
386
|
$schema: t.optional(t.string()),
|
|
121
387
|
schema: t.literal("devcap1.schema.json"),
|
|
@@ -127,39 +393,29 @@ function E() {
|
|
|
127
393
|
vendor: t.optional(t.string()),
|
|
128
394
|
comment: t.optional(t.string()),
|
|
129
395
|
matchexpr: t.optional(o()),
|
|
130
|
-
path: t.optional(
|
|
396
|
+
path: t.optional(a()),
|
|
131
397
|
product: t.optional(t.string()),
|
|
132
398
|
sleeper: t.optional(t.boolean()),
|
|
133
399
|
supportsMgmtBind: t.optional(t.boolean()),
|
|
134
400
|
status: t.enum(["Draft", "Bronze", "Silver", "Gold"]).describe("The code quality of the DDF file."),
|
|
135
|
-
subdevices: t.array(
|
|
136
|
-
bindings: t.optional(t.array(
|
|
137
|
-
}).refine((
|
|
401
|
+
subdevices: t.array(h()),
|
|
402
|
+
bindings: t.optional(t.array(T()))
|
|
403
|
+
}).refine((n) => typeof n.manufacturername == "string" && typeof n.modelid == "string" || Array.isArray(n.manufacturername) && Array.isArray(n.modelid) && n.manufacturername.length === n.modelid.length, {
|
|
138
404
|
message: "manufacturername and modelid should be both strings or arrays with the same length.",
|
|
139
405
|
path: ["manufacturername", "modelid"]
|
|
140
|
-
});
|
|
406
|
+
}).innerType();
|
|
141
407
|
}
|
|
142
|
-
function
|
|
408
|
+
function h() {
|
|
143
409
|
return t.strictObject({
|
|
144
|
-
type: t.enum(
|
|
410
|
+
type: t.enum(c),
|
|
145
411
|
restapi: t.enum(["/lights", "/sensors"]),
|
|
146
|
-
uuid:
|
|
147
|
-
t.tuple([
|
|
148
|
-
t.literal("$address.ext"),
|
|
149
|
-
n(2)
|
|
150
|
-
]),
|
|
151
|
-
t.tuple([
|
|
152
|
-
t.literal("$address.ext"),
|
|
153
|
-
n(2),
|
|
154
|
-
n(4)
|
|
155
|
-
])
|
|
156
|
-
]),
|
|
412
|
+
uuid: p(),
|
|
157
413
|
fingerprint: t.optional(t.strictObject({
|
|
158
|
-
profile:
|
|
159
|
-
device:
|
|
414
|
+
profile: e(4),
|
|
415
|
+
device: e(4),
|
|
160
416
|
endpoint: i(),
|
|
161
|
-
in: t.optional(t.array(
|
|
162
|
-
out: t.optional(t.array(
|
|
417
|
+
in: t.optional(t.array(e(4))),
|
|
418
|
+
out: t.optional(t.array(e(4)))
|
|
163
419
|
})),
|
|
164
420
|
meta: t.optional(t.strictObject({
|
|
165
421
|
// TODO validate this
|
|
@@ -170,176 +426,228 @@ function d() {
|
|
|
170
426
|
buttons: t.optional(t.any()),
|
|
171
427
|
// TODO validate this
|
|
172
428
|
buttonevents: t.optional(t.any()),
|
|
173
|
-
items: t.array(
|
|
429
|
+
items: t.array(E()),
|
|
174
430
|
example: t.optional(t.unknown())
|
|
175
431
|
});
|
|
176
432
|
}
|
|
177
|
-
function
|
|
433
|
+
function E() {
|
|
178
434
|
return t.strictObject({
|
|
179
|
-
name: t.
|
|
435
|
+
name: t.enum(s),
|
|
180
436
|
description: t.optional(t.string()),
|
|
181
437
|
comment: t.optional(t.string()),
|
|
182
438
|
public: t.optional(t.boolean()),
|
|
183
439
|
static: t.optional(t.union([t.string(), t.number(), t.boolean()])),
|
|
184
440
|
range: t.optional(t.tuple([t.number(), t.number()])),
|
|
185
|
-
deprecated: t.optional(
|
|
441
|
+
deprecated: t.optional(l()),
|
|
186
442
|
access: t.optional(t.literal("R")),
|
|
187
|
-
read: t.optional(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
fn: t.literal("none")
|
|
191
|
-
}),
|
|
192
|
-
t.strictObject({
|
|
193
|
-
fn: t.undefined(),
|
|
194
|
-
at: t.optional(n(4).or(t.array(n(4)))),
|
|
195
|
-
cl: n(4),
|
|
196
|
-
ep: t.optional(i()),
|
|
197
|
-
mf: t.optional(n(4)),
|
|
198
|
-
eval: t.optional(o())
|
|
199
|
-
}),
|
|
200
|
-
t.strictObject({
|
|
201
|
-
fn: t.literal("zcl"),
|
|
202
|
-
at: t.optional(n(4).or(t.array(n(4)))),
|
|
203
|
-
cl: n(4),
|
|
204
|
-
ep: t.optional(i()),
|
|
205
|
-
mf: t.optional(n(4)),
|
|
206
|
-
eval: t.optional(o())
|
|
207
|
-
}),
|
|
208
|
-
t.strictObject({
|
|
209
|
-
fn: t.literal("tuya")
|
|
210
|
-
})
|
|
211
|
-
])
|
|
212
|
-
),
|
|
213
|
-
parse: t.optional(
|
|
214
|
-
t.discriminatedUnion("fn", [
|
|
215
|
-
t.strictObject({
|
|
216
|
-
fn: t.undefined(),
|
|
217
|
-
at: t.optional(n(4)),
|
|
218
|
-
cl: n(4),
|
|
219
|
-
ep: t.optional(i()),
|
|
220
|
-
cmd: t.optional(n(2)),
|
|
221
|
-
mf: t.optional(n(4)),
|
|
222
|
-
eval: t.optional(o()),
|
|
223
|
-
script: t.optional(r())
|
|
224
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
225
|
-
message: "eval and script should not both be present"
|
|
226
|
-
}).innerType(),
|
|
227
|
-
t.strictObject({
|
|
228
|
-
fn: t.literal("zcl"),
|
|
229
|
-
at: t.optional(n(4)),
|
|
230
|
-
cl: n(4),
|
|
231
|
-
ep: t.optional(i()),
|
|
232
|
-
cmd: t.optional(n(2)),
|
|
233
|
-
mf: t.optional(n(4)),
|
|
234
|
-
eval: t.optional(o()),
|
|
235
|
-
script: t.optional(r())
|
|
236
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
237
|
-
message: "eval and script should not both be present"
|
|
238
|
-
}).innerType(),
|
|
239
|
-
t.strictObject({
|
|
240
|
-
fn: t.literal("ias:zonestatus"),
|
|
241
|
-
mask: t.enum(["alarm1", "alarm2"])
|
|
242
|
-
}),
|
|
243
|
-
t.strictObject({
|
|
244
|
-
fn: t.literal("numtostr"),
|
|
245
|
-
srcitem: t.enum(["state/airqualityppb", "state/pm2_5"]),
|
|
246
|
-
op: t.literal("le"),
|
|
247
|
-
to: u()
|
|
248
|
-
}),
|
|
249
|
-
t.strictObject({
|
|
250
|
-
fn: t.literal("xiaomi:special"),
|
|
251
|
-
ep: t.optional(i()),
|
|
252
|
-
at: t.optional(n(4)),
|
|
253
|
-
idx: n(2),
|
|
254
|
-
eval: t.optional(o()),
|
|
255
|
-
script: t.optional(r())
|
|
256
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
257
|
-
message: "eval and script should not both be present"
|
|
258
|
-
}).innerType(),
|
|
259
|
-
t.strictObject({
|
|
260
|
-
fn: t.literal("tuya"),
|
|
261
|
-
dpid: t.number(),
|
|
262
|
-
eval: t.optional(o()),
|
|
263
|
-
script: t.optional(r())
|
|
264
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
265
|
-
message: "eval and script should not both be present"
|
|
266
|
-
}).innerType()
|
|
267
|
-
])
|
|
268
|
-
),
|
|
269
|
-
write: t.optional(
|
|
270
|
-
t.discriminatedUnion("fn", [
|
|
271
|
-
t.strictObject({
|
|
272
|
-
fn: t.literal("none")
|
|
273
|
-
}),
|
|
274
|
-
t.strictObject({
|
|
275
|
-
fn: t.undefined(),
|
|
276
|
-
at: t.optional(n(4).or(t.array(n(4)))),
|
|
277
|
-
"state.timeout": t.optional(t.number()),
|
|
278
|
-
"change.timeout": t.optional(t.number()),
|
|
279
|
-
cl: n(4),
|
|
280
|
-
dt: n(2),
|
|
281
|
-
ep: t.optional(i()),
|
|
282
|
-
mf: t.optional(n(4)),
|
|
283
|
-
eval: t.optional(o()),
|
|
284
|
-
script: t.optional(r())
|
|
285
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
286
|
-
message: "eval and script should not both be present"
|
|
287
|
-
}).innerType(),
|
|
288
|
-
t.strictObject({
|
|
289
|
-
fn: t.literal("zcl"),
|
|
290
|
-
at: t.optional(n(4).or(t.array(n(4)))),
|
|
291
|
-
"state.timeout": t.optional(t.number()),
|
|
292
|
-
"change.timeout": t.optional(t.number()),
|
|
293
|
-
cl: n(4),
|
|
294
|
-
dt: n(2),
|
|
295
|
-
ep: t.optional(i()),
|
|
296
|
-
mf: t.optional(n(4)),
|
|
297
|
-
eval: t.optional(o()),
|
|
298
|
-
script: t.optional(r())
|
|
299
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
300
|
-
message: "eval and script should not both be present"
|
|
301
|
-
}).innerType(),
|
|
302
|
-
t.strictObject({
|
|
303
|
-
fn: t.literal("tuya"),
|
|
304
|
-
dpid: t.number(),
|
|
305
|
-
dt: n(2),
|
|
306
|
-
eval: t.optional(o()),
|
|
307
|
-
script: t.optional(r())
|
|
308
|
-
}).refine((e) => !("eval" in e && "script" in e), {
|
|
309
|
-
message: "eval and script should not both be present"
|
|
310
|
-
}).innerType()
|
|
311
|
-
])
|
|
312
|
-
),
|
|
443
|
+
read: t.optional(u()),
|
|
444
|
+
parse: t.optional(f()),
|
|
445
|
+
write: t.optional(g()),
|
|
313
446
|
awake: t.optional(t.boolean()),
|
|
314
447
|
default: t.optional(t.unknown()),
|
|
315
448
|
values: t.optional(t.unknown()),
|
|
316
449
|
"refresh.interval": t.optional(t.number())
|
|
317
450
|
});
|
|
318
451
|
}
|
|
319
|
-
function
|
|
452
|
+
function u() {
|
|
453
|
+
return t.discriminatedUnion("fn", [
|
|
454
|
+
t.strictObject({
|
|
455
|
+
fn: t.literal("none")
|
|
456
|
+
}),
|
|
457
|
+
t.strictObject({
|
|
458
|
+
fn: t.undefined(),
|
|
459
|
+
at: t.optional(e(4).or(t.array(e(4)))),
|
|
460
|
+
cl: e(4),
|
|
461
|
+
ep: t.optional(i()),
|
|
462
|
+
mf: t.optional(e(4)),
|
|
463
|
+
eval: t.optional(o())
|
|
464
|
+
}),
|
|
465
|
+
t.strictObject({
|
|
466
|
+
fn: t.literal("zcl"),
|
|
467
|
+
at: t.optional(e(4).or(t.array(e(4)))),
|
|
468
|
+
cl: e(4),
|
|
469
|
+
ep: t.optional(i()),
|
|
470
|
+
mf: t.optional(e(4)),
|
|
471
|
+
eval: t.optional(o())
|
|
472
|
+
}),
|
|
473
|
+
t.strictObject({
|
|
474
|
+
fn: t.literal("tuya")
|
|
475
|
+
})
|
|
476
|
+
]);
|
|
477
|
+
}
|
|
478
|
+
function f() {
|
|
479
|
+
return t.discriminatedUnion("fn", [
|
|
480
|
+
t.strictObject({
|
|
481
|
+
fn: t.undefined(),
|
|
482
|
+
at: t.optional(e(4)),
|
|
483
|
+
cl: e(4),
|
|
484
|
+
cppsrc: t.optional(t.string()),
|
|
485
|
+
ep: t.optional(i()),
|
|
486
|
+
cmd: t.optional(e(2)),
|
|
487
|
+
mf: t.optional(e(4)),
|
|
488
|
+
eval: t.optional(o()),
|
|
489
|
+
script: t.optional(a())
|
|
490
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
491
|
+
message: "eval and script should not both be present"
|
|
492
|
+
}).innerType(),
|
|
493
|
+
t.strictObject({
|
|
494
|
+
fn: t.literal("zcl"),
|
|
495
|
+
at: t.optional(e(4)),
|
|
496
|
+
cl: e(4),
|
|
497
|
+
cppsrc: t.optional(t.string()),
|
|
498
|
+
ep: t.optional(i()),
|
|
499
|
+
cmd: t.optional(e(2)),
|
|
500
|
+
mf: t.optional(e(4)),
|
|
501
|
+
eval: t.optional(o()),
|
|
502
|
+
script: t.optional(a())
|
|
503
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
504
|
+
message: "eval and script should not both be present"
|
|
505
|
+
}).innerType(),
|
|
506
|
+
t.strictObject({
|
|
507
|
+
fn: t.literal("ias:zonestatus"),
|
|
508
|
+
mask: t.optional(t.enum(["alarm1", "alarm2"]).or(t.literal("alarm1,alarm2")))
|
|
509
|
+
}),
|
|
510
|
+
t.strictObject({
|
|
511
|
+
fn: t.literal("numtostr"),
|
|
512
|
+
srcitem: t.enum(["state/airqualityppb", "state/pm2_5"]),
|
|
513
|
+
op: t.literal("le"),
|
|
514
|
+
to: _()
|
|
515
|
+
}),
|
|
516
|
+
t.strictObject({
|
|
517
|
+
fn: t.literal("time")
|
|
518
|
+
}),
|
|
519
|
+
t.strictObject({
|
|
520
|
+
fn: t.literal("xiaomi:special"),
|
|
521
|
+
ep: t.optional(i()),
|
|
522
|
+
at: t.optional(e(4)),
|
|
523
|
+
idx: e(2),
|
|
524
|
+
eval: t.optional(o()),
|
|
525
|
+
script: t.optional(a())
|
|
526
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
527
|
+
message: "eval and script should not both be present"
|
|
528
|
+
}).innerType(),
|
|
529
|
+
t.strictObject({
|
|
530
|
+
fn: t.literal("tuya"),
|
|
531
|
+
dpid: t.number(),
|
|
532
|
+
eval: t.optional(o()),
|
|
533
|
+
script: t.optional(a())
|
|
534
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
535
|
+
message: "eval and script should not both be present"
|
|
536
|
+
}).innerType()
|
|
537
|
+
]);
|
|
538
|
+
}
|
|
539
|
+
function g() {
|
|
540
|
+
return t.discriminatedUnion("fn", [
|
|
541
|
+
t.strictObject({
|
|
542
|
+
fn: t.literal("none")
|
|
543
|
+
}),
|
|
544
|
+
t.strictObject({
|
|
545
|
+
fn: t.undefined(),
|
|
546
|
+
at: t.optional(e(4).or(t.array(e(4)))),
|
|
547
|
+
"state.timeout": t.optional(t.number()),
|
|
548
|
+
"change.timeout": t.optional(t.number()),
|
|
549
|
+
cl: e(4),
|
|
550
|
+
dt: e(2),
|
|
551
|
+
ep: t.optional(i()),
|
|
552
|
+
mf: t.optional(e(4)),
|
|
553
|
+
eval: t.optional(o()),
|
|
554
|
+
script: t.optional(a())
|
|
555
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
556
|
+
message: "eval and script should not both be present"
|
|
557
|
+
}).innerType(),
|
|
558
|
+
t.strictObject({
|
|
559
|
+
fn: t.literal("zcl"),
|
|
560
|
+
at: t.optional(e(4).or(t.array(e(4)))),
|
|
561
|
+
"state.timeout": t.optional(t.number()),
|
|
562
|
+
"change.timeout": t.optional(t.number()),
|
|
563
|
+
cl: e(4),
|
|
564
|
+
dt: e(2),
|
|
565
|
+
ep: t.optional(i()),
|
|
566
|
+
mf: t.optional(e(4)),
|
|
567
|
+
eval: t.optional(o()),
|
|
568
|
+
script: t.optional(a())
|
|
569
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
570
|
+
message: "eval and script should not both be present"
|
|
571
|
+
}).innerType(),
|
|
572
|
+
t.strictObject({
|
|
573
|
+
fn: t.literal("tuya"),
|
|
574
|
+
dpid: t.number(),
|
|
575
|
+
dt: e(2),
|
|
576
|
+
eval: t.optional(o()),
|
|
577
|
+
script: t.optional(a())
|
|
578
|
+
}).refine((n) => !("eval" in n && "script" in n), {
|
|
579
|
+
message: "eval and script should not both be present"
|
|
580
|
+
}).innerType()
|
|
581
|
+
]);
|
|
582
|
+
}
|
|
583
|
+
function T() {
|
|
320
584
|
return t.discriminatedUnion("bind", [
|
|
321
585
|
t.strictObject({
|
|
322
586
|
bind: t.literal("unicast"),
|
|
323
587
|
"src.ep": i(),
|
|
324
588
|
"dst.ep": t.optional(i()),
|
|
325
|
-
cl:
|
|
589
|
+
cl: e(4),
|
|
326
590
|
report: t.optional(t.array(t.strictObject({
|
|
327
|
-
at:
|
|
328
|
-
dt:
|
|
329
|
-
mf: t.optional(
|
|
591
|
+
at: e(4),
|
|
592
|
+
dt: e(2),
|
|
593
|
+
mf: t.optional(e(4)),
|
|
330
594
|
min: t.number(),
|
|
331
595
|
max: t.number(),
|
|
332
|
-
change: t.optional(
|
|
596
|
+
change: t.optional(e().or(t.number()))
|
|
333
597
|
})))
|
|
334
598
|
}),
|
|
335
599
|
t.strictObject({
|
|
336
600
|
bind: t.literal("groupcast"),
|
|
337
601
|
"src.ep": i(),
|
|
338
|
-
cl:
|
|
602
|
+
cl: e(4),
|
|
339
603
|
"config.group": t.number()
|
|
340
604
|
})
|
|
341
605
|
]);
|
|
342
606
|
}
|
|
607
|
+
function v() {
|
|
608
|
+
return t.strictObject({
|
|
609
|
+
$schema: t.optional(t.string()),
|
|
610
|
+
schema: t.literal("constants1.schema.json"),
|
|
611
|
+
manufacturers: t.record(t.string().startsWith("$MF_"), t.string()),
|
|
612
|
+
"device-types": t.record(t.string().startsWith("$TYPE_"), t.string())
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
function O() {
|
|
616
|
+
return t.strictObject({
|
|
617
|
+
$schema: t.optional(t.string()),
|
|
618
|
+
schema: t.literal("resourceitem1.schema.json"),
|
|
619
|
+
id: t.string(),
|
|
620
|
+
description: t.string(),
|
|
621
|
+
deprecated: t.optional(l()),
|
|
622
|
+
datatype: t.enum(["String", "Bool", "Int8", "Int16", "Int32", "Int64", "UInt8", "UInt16", "UInt32", "UInt64", "Array", "Array[3]", "ISO 8601 timestamp"]),
|
|
623
|
+
access: t.enum(["R", "W", "RW"]),
|
|
624
|
+
public: t.boolean(),
|
|
625
|
+
implicit: t.optional(t.boolean()),
|
|
626
|
+
managed: t.optional(t.boolean()),
|
|
627
|
+
static: t.optional(t.boolean()),
|
|
628
|
+
virtual: t.optional(t.boolean()),
|
|
629
|
+
parse: t.optional(f()),
|
|
630
|
+
read: t.optional(u()),
|
|
631
|
+
write: t.optional(g()),
|
|
632
|
+
"refresh.interval": t.optional(t.number()),
|
|
633
|
+
// TODO Validate this
|
|
634
|
+
values: t.optional(t.unknown()),
|
|
635
|
+
range: t.optional(t.tuple([t.number(), t.number()])),
|
|
636
|
+
default: t.optional(t.unknown())
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
function P() {
|
|
640
|
+
return t.strictObject({
|
|
641
|
+
$schema: t.optional(t.string()),
|
|
642
|
+
schema: t.literal("subdevice1.schema.json"),
|
|
643
|
+
type: t.enum(c),
|
|
644
|
+
name: t.string(),
|
|
645
|
+
restapi: t.enum(["/lights", "/sensors"]),
|
|
646
|
+
order: t.number(),
|
|
647
|
+
uuid: p(),
|
|
648
|
+
items: t.array(t.enum(s))
|
|
649
|
+
});
|
|
650
|
+
}
|
|
343
651
|
export {
|
|
344
|
-
|
|
652
|
+
A as validate
|
|
345
653
|
};
|