Skip to content

Commit

Permalink
Fix #816: Error when trying to update camera settings
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajNyiri committed Jan 13, 2025
1 parent 0e34ca2 commit f83227b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions custom_components/tapo_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ def update_unique_id(entity_entry):

hass.config_entries.async_update_entry(config_entry, data=new, version=18)

if config_entry.version == 18:
new = {**config_entry.data}
new[CONTROL_PORT] = int(new[CONTROL_PORT])

hass.config_entries.async_update_entry(config_entry, data=new, version=19)

LOGGER.info("Migration to version %s successful", config_entry.version)

return True
Expand Down
8 changes: 4 additions & 4 deletions custom_components/tapo_control/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
class FlowHandler(ConfigFlow):
"""Handle a config flow."""

VERSION = 18
VERSION = 19

@staticmethod
def async_get_options_flow(config_entry):
Expand Down Expand Up @@ -557,7 +557,7 @@ async def async_step_ip(self, user_input=None):
"""Enter IP Address and verify Tapo device"""
errors = {}
host = ""
controlPort = "443"
controlPort = 443
if user_input is not None:
LOGGER.debug("[ADD DEVICE] Verifying IP address")
try:
Expand Down Expand Up @@ -647,7 +647,7 @@ async def async_step_ip(self, user_input=None):
): str,
vol.Required(
CONTROL_PORT, description={"suggested_value": controlPort}
): str,
): int,
}
),
errors=errors,
Expand Down Expand Up @@ -1386,7 +1386,7 @@ async def async_step_auth(self, user_input=None):
): str,
vol.Required(
CONTROL_PORT, description={"suggested_value": controlPort}
): str,
): int,
vol.Required(
CONF_USERNAME, description={"suggested_value": username}
): str,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tapo_control/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from homeassistant.helpers import config_validation as cv

CONTROL_PORT = "control_port"
PYTAPO_REQUIRED_VERSION = "3.3.37"
PYTAPO_REQUIRED_VERSION = "3.3.38"
DOMAIN = "tapo_control"
BRAND = "TP-Link"
ALARM_MODE = "alarm_mode"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tapo_control/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"version": "6.0.1",
"requirements": [
"pytapo==3.3.37"
"pytapo==3.3.38"
],
"dependencies": [
"ffmpeg",
Expand Down

0 comments on commit f83227b

Please sign in to comment.