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

Validator #32

Merged
merged 8 commits into from
Dec 11, 2023
Merged
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
14 changes: 14 additions & 0 deletions .github/workflows/json_validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Validate JSONs

on: [push, pull_request]

jobs:
verify-json-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: ./schema.json
INPUT_JSONS: custom_components/battery_notes/data/library.json
32 changes: 16 additions & 16 deletions custom_components/battery_notes/data/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@
"model": "[Flower sensor](http://modkam.ru/?p=1700) (DIYRuZ_Flower)",
"battery_type": "AAA",
"battery_quantity": 2
},
},
{
"manufacturer": "Fantem",
"model": "4 in 1 multi sensor (ZB003-X)",
"battery_type": "CR123A",
"battery_quantity": 2
},
},
{
"manufacturer": "GiEX",
"model": "Water irrigation valve (QT06_2)",
"battery_type": "AA",
"battery_quantity": 4
},
},
{
"manufacturer": "HEIMAN",
"model": "Smart carbon monoxide sensor (HS1CA-E)",
"battery_type": "CR123A"
},
},
{
"manufacturer": "OSRAM",
"model": "Smart+ switch mini (AC0251100NJ/AC0251600NJ/AC0251700NJ)",
Expand Down Expand Up @@ -70,24 +70,24 @@
"manufacturer": "SONOFF",
"model": "Motion sensor (SNZB-03)",
"battery_type": "CR2450"
},
},
{
"manufacturer": "Sonoff",
"model": "Temperature and humidity sensor (SNZB-02)",
"battery_type": "CR2430"
},
},
{
"manufacturer": "Sure Petcare",
"model": "Pet flap",
"battery_type": "C",
"battery_quantity": 4
},
},
{
"manufacturer": "SwitchBot",
"model": "W340001X",
"battery_type": "AAA",
"battery_quantity": 2
},
},
{
"manufacturer": "Tado",
"model": "RU01",
Expand All @@ -99,13 +99,13 @@
"model": "VA02",
"battery_type": "AA",
"battery_quantity": 2
},
},
{
"manufacturer": "TT Lock",
"model": "SN511-180MS_PV53",
"battery_type": "AA",
"battery_quantity": 4
},
},
{
"manufacturer": "TuYa",
"model": "Soil sensor (TS0601_soil)",
Expand Down Expand Up @@ -153,12 +153,12 @@
"manufacturer": "Xiaomi",
"model": "Aqara D1 double key wireless wall switch (WXKG07LM)",
"battery_type": "CR2032"
},
},
{
"manufacturer": "Xiaomi",
"model": "Aqara D1 single key wireless wall switch (WXKG06LM)",
"battery_type": "CR2032"
},
},
{
"manufacturer": "Xiaomi",
"model": "Aqara wireless switch (WXKG11LM)",
Expand All @@ -169,7 +169,7 @@
"model": "Aqara TVOC air quality monitor (VOCKQJK11LM)",
"battery_type": "CR2450",
"battery_quantity": 2
},
},
{
"manufacturer": "Xiaomi",
"model": "Aqara water leak sensor (SJCGQ11LM)",
Expand All @@ -184,16 +184,16 @@
"manufacturer": "Xiaomi",
"model": "HHCCJCY01",
"battery_type": "CR2032"
},
},
{
"manufacturer": "Xiaomi",
"model": "LYWSD03MMC",
"battery_type": "CR2032"
},
},
{
"manufacturer": "Xiaomi",
"model": "MiJia wireless switch (WXKG01LM)",
"battery_type": "CR2032"
}
]
}
}
44 changes: 44 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/andrew-codechimp/HA-Battery-Notes.schema.json",
"title": "Battery Notes Library",
"description": "Library of battery types for devices",
"type": "object",
"properties": {
"version": {
"description": "Version of the library schema",
"type": "integer"
},
"devices": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"manufacturer",
"model",
"battery_type"
],
"properties": {
"manufacturer": {
"type": "string"
},
"model": {
"type": "string"
},
"battery_type": {
"type": "string"
},
"battery_quantity": {
"type": "integer"
}
}
}
}
},
"additionalProperties": false,
"required": [
"version",
"devices"
]
}
Loading