File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
custom_components/rinnaicontrolr-ha Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -83,3 +83,21 @@ async def async_remove_config_entry_device(
8383) -> bool :
8484 """Remove a config entry from a device."""
8585 return True
86+
87+ async def async_migrate_entry (hass : HomeAssistant , config_entry : ConfigEntry ):
88+ """Migrate old entry."""
89+ _LOGGER .debug ("Migrating from version %s" , config_entry .version )
90+
91+ if config_entry .version == 1 :
92+ data = {** config_entry .data }
93+
94+ if not data .get (CONF_ACCESS_TOKEN ):
95+ data [CONF_ACCESS_TOKEN ] = config_entry .data [CONF_REFRESH_TOKEN ]
96+ if not data .get (CONF_REFRESH_TOKEN ):
97+ data [CONF_REFRESH_TOKEN ] = config_entry .data [CONF_REFRESH_TOKEN ]
98+
99+ hass .config_entries .async_update_entry (config_entry , data = data , version = 2 )
100+
101+ _LOGGER .info ("Migration to version %s successful" , config_entry .version )
102+
103+ return True
Original file line number Diff line number Diff line change 2323class ConfigFlow (config_entries .ConfigFlow , domain = DOMAIN ):
2424 """Handle a config flow for Rinnai."""
2525
26- VERSION = 1
26+ VERSION = 2
2727
2828 entry : config_entries .ConfigEntry | None
2929
Original file line number Diff line number Diff line change 55 "documentation" : " https://github.com/explosivo22/rinnaicontrolr-ha/" ,
66 "codeowners" : [ " @explosivo22" ],
77 "requirements" : [ " aiorinnai==0.4.0a2" ],
8- "version" : " 1.5.4 " ,
8+ "version" : " 1.5.5 " ,
99 "iot_class" : " cloud_polling"
1010}
You can’t perform that action at this time.
0 commit comments