Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): import config files from zwa #7339

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 242 additions & 0 deletions packages/config/config/devices/0x0208/za-216001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
{
"manufacturer": "HANK Electronics, Ltd.",
"manufacturerId": "0x0208",
"label": "ZA-216001",
"description": "Ness Z-Wave Smart Plug",
"devices": [
{
"productType": "0x0102",
"productId": "0x0029",
"zwaveAllianceId": 4196
}
],
"firmwareVersion": {
"min": "0.0",
"max": "255.255"
},
"associations": {
"1": {
"label": "Lifeline",
"maxNodes": 5,
"isLifeline": true
}
},
"paramInformation": [
{
"#": "20",
"label": "Overload Protection",
"description": "Smart plug keep detecting the load power, once the ac current exceeds 11.5a for more than 5s, smart plug's relay will turn off",
"valueSize": 1,
"minValue": 0,

Check failure on line 30 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

For parameters with "allowManualEntry = false" and predefined options, "minValue" is unnecessary and should not be specified
"maxValue": 1,

Check failure on line 31 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

For parameters with "allowManualEntry = false" and predefined options, "maxValue" is unnecessary and should not be specified
"defaultValue": 1,
"unsigned": true,

Check failure on line 33 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

Defining this parameter as unsigned is unnecessary
"allowManualEntry": false,
"options": [
{
"label": "The function is disabled",
"value": 0
},
{
"label": "The function is enabled",
"value": 1
}
]
},
{
"#": "21",
"label": "Device State After Power On",
"description": "Defines the state of the plug when the power is turned on",
"valueSize": 1,
"minValue": 0,

Check failure on line 51 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

For parameters with "allowManualEntry = false" and predefined options, "minValue" is unnecessary and should not be specified
"maxValue": 2,

Check failure on line 52 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

For parameters with "allowManualEntry = false" and predefined options, "maxValue" is unnecessary and should not be specified
"defaultValue": 0,
"unsigned": true,

Check failure on line 54 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

Defining this parameter as unsigned is unnecessary
"allowManualEntry": false,
"options": [
{
"label": "The smart plug will remain in the same state as it was before the power off",
"value": 0
},
{
"label": "The smart plug is turned on by default",
"value": 1
},
{
"label": "The smart plug is turned off by default",
"value": 2
}
]
},
{
"#": "24",
"label": "Send Reports When Load Status Changes",
"description": "Defines whether to send report to the associated device (lifeline group) when the load status of the smart plug changes",
"valueSize": 1,
"minValue": 0,

Check failure on line 76 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

For parameters with "allowManualEntry = false" and predefined options, "minValue" is unnecessary and should not be specified
"maxValue": 2,

Check failure on line 77 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

For parameters with "allowManualEntry = false" and predefined options, "maxValue" is unnecessary and should not be specified
"defaultValue": 1,
"unsigned": true,

Check failure on line 79 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

Defining this parameter as unsigned is unnecessary
"allowManualEntry": false,
"options": [
{
"label": "The function is disabled",
"value": 0
},
{
"label": "Send basic report",

Check failure on line 87 in packages/config/config/devices/0x0208/za-216001.json

View workflow job for this annotation

GitHub Actions / lint-zwave (18)

Parameter descriptions must be in Sentence case, except for Command Class names
"value": 1
},
{
"label": "Send basic report only when load condition is not changed by Z-Wave command",
"value": 2
}
]
},
{
"#": "27",
"label": "The State of Indicator Light",
"description": "Define the corresponding state of the indicator light when the load changes",
"valueSize": 1,
"minValue": 0,
"maxValue": 1,
"defaultValue": 0,
"unsigned": true,
"allowManualEntry": false,
"options": [
{
"label": "The indicator light remains the same as the load on/off status. when the load is on, the light is on. when the load is off, the light is off",
"value": 0
},
{
"label": "Within 5 seconds after the operation load, the indicator light is consistent with the load on/off status, and then the indicator turns off",
"value": 1
}
]
},
{
"#": "151",
"label": "Threshold of Power Report",
"description": "Set the power threshold. when the load power value exceeds this threshold, the smart plug will send a power report to the associated device (lifeline group)",
"valueSize": 2,
"minValue": 0,
"maxValue": 200,
"defaultValue": 50,
"unsigned": true,
"options": [
{
"label": "0 - the function is disabled",
"value": 0
}
]
},
{
"#": "152",
"label": "Percentage Threshold For Power Reporting",
"description": "Set the power percentage threshold. when the load power percentage value exceeds this threshold, the smart plug will send a power report to the associated device (lifeline group)",
"valueSize": 1,
"unit": "%",
"minValue": 0,
"maxValue": 100,
"defaultValue": 10,
"unsigned": true,
"options": [
{
"label": "The function is disabled",
"value": 0
}
]
},
{
"#": "171",
"label": "Frequency of Power Reports",
"description": "Defines how often power reports are sent to associated devices (lifeline group)",
"valueSize": 4,
"minValue": 0,
"maxValue": 2678400,
"defaultValue": 3600,
"unsigned": true,
"options": [
{
"label": "The function is disabled",
"value": 0
}
]
},
{
"#": "172",
"label": "Frequency of Energy Reports",
"description": "Defines how often energy reports are sent to associated devices (lifeline group)",
"valueSize": 4,
"minValue": 0,
"maxValue": 2678400,
"defaultValue": 7200,
"unsigned": true,
"options": [
{
"label": "The function is disabled",
"value": 0
}
]
},
{
"#": "173",
"label": "Frequency of Voltage Reports",
"description": "Defines how often voltage reports are sent to associated devices (lifeline group)",
"valueSize": 4,
"minValue": 0,
"maxValue": 2678400,
"defaultValue": 0,
"unsigned": true,
"options": [
{
"label": "The function is disabled",
"value": 0
}
]
},
{
"#": "174",
"label": "Frequency of Electric Current Reports",
"description": "Defines how often electric current reports are sent to associated devices (lifeline group)",
"valueSize": 4,
"minValue": 0,
"maxValue": 2678400,
"defaultValue": 0,
"unsigned": true,
"options": [
{
"label": "The function is disabled",
"value": 0
}
]
},
{
"#": "254",
"label": "Enable/Disable The Configuration Command",
"description": "Enable:the values of other parameters can be changed. disable:the values of other parameters cannot be changed",
"valueSize": 1,
"minValue": 0,
"maxValue": 1,
"defaultValue": 0,
"unsigned": true,
"allowManualEntry": false,
"options": [
{
"label": "Enable",
"value": 0
},
{
"label": "Disable",
"value": 1
}
]
}
],
"metadata": {
"inclusion": "Add for inclusion (non-security and security):\n1)Connect the power supply.\n2)Set the Z-Wave™ network main controller into learning mode.\n3)Triple click the Z-button, the LED indicator will be flashing 3 times in Blue.\n4)Smart Plug should be recognized and included into the Z-Wave™ network",
"exclusion": "1) Insert the Plug into a socket.\n2) Set the Z-Wave™ network controller into the exclusion mode. \n3) Triple click the Z button.\n4) LED will blink in blue for 3 times, and then start slow flashing to indicate that the remove for exclusion is successful. LED will indicate network status after it is removed from Z-Wave™ network",
"reset": "Please use this procedure only when the network primary controller is missing or otherwise inoperable.\nLong press the button for 20 seconds and the blue LED will speed up the flash and then LED will keep on for 3 seconds in blue and Smart Plug will send ”Device Reset Locally Notification” to the main controller and exclude from the Z-Wave™ network, this procedure will reset Smart Plug to factory default. Please use this procedure only when the network primary controller is missing or otherwise inoperable",
"manual": "https://products.z-wavealliance.org/ProductManual/File?folder=&filename=product_documents/4196/Manual-SmartPlug.pdf"
}
}
33 changes: 13 additions & 20 deletions packages/config/src/LogicParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ const peggyParser: { parse: any; SyntaxError: any; DefaultTracer?: any } = // Ge
// @ts-ignore
var s = this.location.start;
// @ts-ignore
var offset_s = (this.location.source
&& (typeof this.location.source.offset
=== "function"))
// @ts-ignore
? this.location.source.offset(s)
// @ts-ignore
: s;
var offset_s =
(this.location.source
&& (typeof this.location.source.offset
=== "function"))
// @ts-ignore
? this.location.source.offset(s)
// @ts-ignore
: s;
// @ts-ignore
var loc = this.location.source
+ ":"
Expand All @@ -116,19 +117,11 @@ const peggyParser: { parse: any; SyntaxError: any; DefaultTracer?: any } = // Ge
// @ts-ignore
var hatLen = (last - s.column) || 1;
// @ts-ignore
str += "\n --> "
+ loc
+ "\n" // @ts-ignore
+ filler
+ " |\n" // @ts-ignore
+ offset_s.line
+ " | "
+ line
+ "\n" // @ts-ignore
+ filler
+ " | "
+ peg$padEnd("", s.column - 1, " ") // @ts-ignore
+ peg$padEnd("", hatLen, "^");
str += "\n --> " + loc + "\n" // @ts-ignore
+ filler + " |\n" // @ts-ignore
+ offset_s.line + " | " + line + "\n" // @ts-ignore
+ filler + " | " + peg$padEnd("", s.column - 1, " ") // @ts-ignore
+ peg$padEnd("", hatLen, "^");
// @ts-ignore
} else {
// @ts-ignore
Expand Down
Loading