ArtistAOP / hassio

https://github.com/Hypfer/Cybele for Hass.io (Home Assistant)
Apache License 2.0
11 stars 5 forks source link

Add configuration schema #1

Closed mrwogu closed 3 years ago

mrwogu commented 3 years ago

I'm still working on it. There is validation problem with nested here. Same as here: https://github.com/home-assistant/supervisor/issues/2560

Just tried add configuration schema to avoid following error.

image Also mentioned here: https://community.home-assistant.io/t/xiaomi-kettle/34170/21

I've tried to add complete schema:

"schema": {
    "mqtt": {
      "url": "url"
    },
    "dongles": [
      {
        "hciDevice": "str",
        "mode": "str",
        "services": [
          {
            "bus": "str?",
            "hciDevice": "str?"
          }
        ],
        "devices": [
          {
            "type": "str",
            "friendlyName": "str",
            "mac": "match(^([0-9A-F]{2}:){5}([0-9A-F]{2})$)",
            "productId": "int"
          }
        ]
      }
    ]
  }

but there was a following warning in logs (this is related with array nesting): 21-02-16 22:38:26 WARNING (MainThread) [supervisor.store.data] Can't read /data/addons/git/d2d32cc6/cybele/config.json: expected string or buffer @ data['schema']['dongles'][0]['devices'][0]. Got {'type': 'str', 'friendlyName': 'str', 'mac': 'match(^([0-9A-F]{2}:){5}([0-9A-F]{2})$)', 'productId': 'int'}

ArtistAOP commented 3 years ago

hi. thank you for your investigation. unfortunately, I also couldn’t do schema for three level options. in this reason I was forced to refuse from using of Configuration Tab in the add-on. I used JSON file in the configuration folder. new release 1.0.1 now is available.

ArtistAOP commented 3 years ago

here is workaround https://github.com/ArtistAOP/hassio/commit/7bdb60f0474aa8a0ee4e08451f9c10fcc1fca60e