Comments (6)
Can you try to make a following change in the code (in __init__.py file) and check if it works?
...
- @asyncio.coroutine
- def async_added_to_hass(self):
- state = yield from self.async_get_last_state()
+ async def async_added_to_hass(self):
+ state = await self.async_get_last_state()
if state is not None \
and state.attributes is not None \
...
from home-assistant-custom-components-saver.
After changing that a new error popups up:
Traceback (most recent call last):
File "/srv/hass/lib/python3.11/site-packages/homeassistant/loader.py", line 813, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 936, in exec_module
File "<frozen importlib._bootstrap_external>", line 1074, in get_code
File "<frozen importlib._bootstrap_external>", line 1004, in source_to_code
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/hass/.homeassistant/custom_components/saver/__init__.py", line 150
state = yield from self.async_get_last_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'yield from' inside async function
from home-assistant-custom-components-saver.
It looks like you haven't applied all changes from the fragment I have posted above. The updated code should look the following way:
@property
def state(self):
return len(self._entities_db) + len(self._variables_db)
async def async_added_to_hass(self):
state = await self.async_get_last_state()
if state is not None \
and state.attributes is not None \
and "variables" in state.attributes and not isinstance(state.attributes["entities"], list) \
and "entities" in state.attributes and not isinstance(state.attributes["variables"], list):
self._variables_db = state.attributes["variables"]
self._entities_db = state.attributes["entities"]
from home-assistant-custom-components-saver.
state = await self.async_get_last_state()
Ah you're right. I only changed the first part earlier today. The full change seems to work fine as entity saver.saver
is now back.
from home-assistant-custom-components-saver.
Great, thank you. I will adjust the integration 👍
from home-assistant-custom-components-saver.
Fixed in v1.1.5
from home-assistant-custom-components-saver.
Related Issues (19)
- How to use variables in scripts HOT 1
- not restore state save HOT 4
- How to save/delete/restore all the entites in one call-service command? HOT 1
- Saving two media_player states and then trying to restore, result in error HOT 12
- test saver component HOT 1
- Restore whole entity HOT 2
- Using "saver" as a workaround to generate persistent "on the fly" scenes. HOT 7
- How to restore a text string + restoring state also deletes the saved state. HOT 11
- error after update HOT 1
- no unique ID
- Not working, for some reason HOT 7
- Produces "unknown error" in template HOT 4
- Cant restore state HOT 1
- Script constructor has been changed HOT 1
- Unable to restore state using attributes HOT 3
- wled effect HOT 3
- Information required HOT 1
- I'm trying to save/restore all attributes of a binary_sensor, but its not working HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from home-assistant-custom-components-saver.