Skip to content

Commit

Permalink
Attempt to fix validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
magico13 committed Feb 2, 2025
1 parent 92647f6 commit 27442a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
12 changes: 2 additions & 10 deletions custom_components/emporia_vue/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from .const import (
CONFIG_TITLE,
CONFIG_SCHEMA,
CUSTOMER_GID,
DOMAIN,
ENABLE_1D,
Expand Down Expand Up @@ -105,17 +106,8 @@ async def async_step_user(self, user_input=None) -> config_entries.ConfigFlowRes
_LOGGER.exception("Unexpected exception")
errors["base"] = "unknown"

config_schema = {
vol.Required(CONF_EMAIL): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(ENABLE_1M, default=True): cv.boolean,
vol.Optional(ENABLE_1D, default=True): cv.boolean,
vol.Optional(ENABLE_1MON, default=True): cv.boolean,
vol.Optional(SOLAR_INVERT, default=True): cv.boolean,
}

return self.async_show_form(
step_id="user", data_schema=vol.Schema(config_schema), errors=errors
step_id="user", data_schema=CONFIG_SCHEMA, errors=errors
)

async def async_step_reconfigure(
Expand Down
16 changes: 16 additions & 0 deletions custom_components/emporia_vue/const.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
"""Constants for the Emporia Vue integration."""

import voluptuous as vol

from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
import homeassistant.helpers.config_validation as cv

DOMAIN = "emporia_vue"
VUE_DATA = "vue_data"
ENABLE_1S = "enable_1s"
Expand All @@ -9,3 +14,14 @@
SOLAR_INVERT = "solar_invert"
CUSTOMER_GID = "customer_gid"
CONFIG_TITLE = "title"

CONFIG_SCHEMA = vol.Schema(
{
vol.Required(CONF_EMAIL): cv.string,
vol.Required(CONF_PASSWORD): cv.string,
vol.Optional(ENABLE_1M, default=True): cv.boolean,
vol.Optional(ENABLE_1D, default=True): cv.boolean,
vol.Optional(ENABLE_1MON, default=True): cv.boolean,
vol.Optional(SOLAR_INVERT, default=True): cv.boolean,
}
)
2 changes: 1 addition & 1 deletion custom_components/emporia_vue/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"name": "Emporia Vue",
"codeowners": ["@magico13"],
"config_flow": true,
"single_config_entry": true,
"documentation": "https://github.com/magico13/ha-emporia-vue",
"integration_type": "hub",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/magico13/ha-emporia-vue/issues",
"requirements": ["pyemvue==0.18.7"],
"single_config_entry": true,
"version": "0.10.3"
}

0 comments on commit 27442a9

Please sign in to comment.