From 86888aef1fbf7c610dc67d96fc817ff4598e7774 Mon Sep 17 00:00:00 2001 From: iloveicedgreentea <31193909+iloveicedgreentea@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:46:25 -0400 Subject: [PATCH] should fix config flow UI --- custom_components/jvc_projectors/__init__.py | 1 - custom_components/jvc_projectors/config_flow.py | 14 ++++---------- custom_components/jvc_projectors/manifest.json | 2 +- custom_components/jvc_projectors/strings.json | 12 ++++++++---- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/custom_components/jvc_projectors/__init__.py b/custom_components/jvc_projectors/__init__.py index 6797696..df7341a 100644 --- a/custom_components/jvc_projectors/__init__.py +++ b/custom_components/jvc_projectors/__init__.py @@ -25,7 +25,6 @@ async def async_setup_entry(hass, entry): timeout = entry.data.get(CONF_TIMEOUT, 3) port = 20554 - _LOGGER.debug(f"Setting up JVC Projector with host: {host}") options = JVCInput(host, password, port, timeout) # Create a coordinator or directly set up your entities with the provided information coordinator = JVCProjectorCoordinator(options, _LOGGER) diff --git a/custom_components/jvc_projectors/config_flow.py b/custom_components/jvc_projectors/config_flow.py index 8122086..b588cb3 100644 --- a/custom_components/jvc_projectors/config_flow.py +++ b/custom_components/jvc_projectors/config_flow.py @@ -5,10 +5,8 @@ from homeassistant.const import ( CONF_HOST, CONF_NAME, - CONF_PASSWORD, - CONF_TIMEOUT, + CONF_PASSWORD ) -import homeassistant.helpers.config_validation as cv from jvc_projector.jvc_projector import JVCProjectorCoordinator, JVCInput from .const import DOMAIN # Import the domain constant @@ -28,7 +26,7 @@ async def async_step_user(self, user_input=None): if user_input is not None: host = user_input.get(CONF_HOST) password = user_input.get(CONF_PASSWORD) - timeout = user_input.get(CONF_TIMEOUT, 3) + timeout = 5 valid = await self.validate_setup(host, password, timeout) @@ -45,8 +43,7 @@ async def async_step_user(self, user_input=None): { vol.Required(CONF_NAME): str, vol.Required(CONF_HOST): str, - vol.Optional(CONF_PASSWORD): str, - vol.Optional(CONF_TIMEOUT, default=3): int, + vol.Optional(CONF_PASSWORD): str } ) @@ -114,10 +111,7 @@ async def async_step_init(self, user_input=None): vol.Optional(CONF_HOST, default=current_config.get(CONF_HOST)): str, vol.Optional( CONF_PASSWORD, default=current_config.get(CONF_PASSWORD) - ): str, - vol.Optional( - CONF_TIMEOUT, default=current_config.get(CONF_TIMEOUT, 3) - ): int, + ): str } ) diff --git a/custom_components/jvc_projectors/manifest.json b/custom_components/jvc_projectors/manifest.json index 1226412..606c54f 100644 --- a/custom_components/jvc_projectors/manifest.json +++ b/custom_components/jvc_projectors/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://github.com/iloveicedgreentea/jvc_homeassistant", "requirements": [ - "pyjvc==4.3.48" + "pyjvc==4.3.49" ], "ssdp": [], "zeroconf": [], diff --git a/custom_components/jvc_projectors/strings.json b/custom_components/jvc_projectors/strings.json index dd1e711..2ac8710 100644 --- a/custom_components/jvc_projectors/strings.json +++ b/custom_components/jvc_projectors/strings.json @@ -5,10 +5,14 @@ "user": { "title": "Connect to your JVC Projector", "data": { - "name": "Name", - "host": "Host", - "password": "Password", - "timeout": "Timeout" + "name": "[%key:common::config_flow::data::name%]", + "host": "[%key:common::config_flow::data::host%]", + "password": "[%key:common::config_flow::data::password%]" + }, + "data_description": { + "name": "Name for your projector", + "host": "IP address or hostname of projector", + "password": "Optional password if NZ series or higher" } } },