Skip to content

Commit 358963a

Browse files
committed
add compatibility with previous HASS versions
1 parent 53e6de2 commit 358963a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

custom_components/pyscript/state.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ async def register_persist(cls, var_name):
220220
restore_data = await RestoreStateData.async_get_instance(cls.hass)
221221
this_entity = PyscriptEntity()
222222
this_entity.entity_id = var_name
223-
restore_data.async_restore_entity_added(this_entity)
224223
cls.persisted_vars[var_name] = this_entity
224+
try:
225+
restore_data.async_restore_entity_added(this_entity)
226+
except TypeError as e:
227+
restore_data.async_restore_entity_added(var_name)
225228

226229
@classmethod
227230
async def persist(cls, var_name, default_value=None, default_attributes=None):

0 commit comments

Comments
 (0)