Skip to content
Open
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
18 changes: 6 additions & 12 deletions custom_components/dirigera_platform/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,12 @@ async def async_step_init(
# Called when configure is called from an existing configured integration
# The first screen that is shown, asl called after IP when submitted

logger.error("OPTIONS async_step_init called....")
logger.error(user_input)
logger.debug("OPTIONS async_step_init called....")

errors: Dict[str, str] = {}

if user_input is not None:
logger.error("async step init user input is not none...")
logger.error("user_input is ")
logger.error(user_input)
logger.debug("async step init user input is not none...")

self.ip = user_input[CONF_IP_ADDRESS]
self.hide_device_set_bulbs = user_input[CONF_HIDE_DEVICE_SET_BULBS]
Expand All @@ -165,7 +162,7 @@ async def async_step_init(
errors["base"] = "ip_not_specified"
else:
try:
logger.error("Moving to second step....")
logger.debug("Moving to second step....")
if self.ip == "mock":
logger.warning(
"Using mock ip, skipping token generation step 1"
Expand Down Expand Up @@ -193,12 +190,11 @@ async def async_step_action(
self, user_input: Dict[str, Any] = None
) -> Dict[str, Any]:
logger.debug("CONFIG async_step_action called....")
logger.debug(user_input)
# Since IP is specified we will try and get the auth token an set that up in
# the config for use at a later time
errors: Dict[str, str] = {}
logger.error("ip {}".format(self.ip))
logger.error(f"hide device set bulbs {self.hide_device_set_bulbs}")
logger.debug("ip {}".format(self.ip))
logger.debug(f"hide device set bulbs {self.hide_device_set_bulbs}")
# Try and get the token step_2
try:
if self.ip == "mock":
Expand All @@ -209,13 +205,11 @@ async def async_step_action(
get_dirigera_token_step_two, self.ip, self.code, self.code_verifier
)
logger.info("Successful generating token")
logger.error(token)

user_input[CONF_IP_ADDRESS] = self.ip
user_input[CONF_TOKEN] = token
user_input[CONF_HIDE_DEVICE_SET_BULBS] = self.hide_device_set_bulbs
logger.error("before create entry...")
logger.error(user_input)
logger.debug("before create entry...")

self.hass.config_entries.async_update_entry(self.config_entry, data=user_input,
title="IKEA Dirigera Hub : {}".format(user_input[CONF_IP_ADDRESS]),)
Expand Down