Comments (16)
Hello,
the problem occurs here:
def _fetch(self):
self._api.get_products()
products = self._api.data
for attr, val in products[self._dev_id].items():
setattr(self, str(attr), val)
So it seems that "products" for some reason is True or False rather than a data-structure.
products = self._api.data
So, after
def __init__(self):
self._worx_mqtt_client_id = ''
self._worx_mqtt_endpoint = ''
self._api = WorxLandroidAPI()
The only reason for _api to be Bool, that I see is this:
pyworxcloud/pyworxcloud/worxlandroidapi.py
Line 109 in 42a464d
@MTrab What do you think?
Best regards,
Hendrik
from pyworxcloud.
Hi Morten,
could you please consider this fix and release a new version of pyworxcloud?
Best regards,
Hendrik
from pyworxcloud.
@henfri is this still an issue on the latest release?
from pyworxcloud.
Strange - we are not seeing this issue in Home Assistant.
Is it every time you poll the API or only occasional?
from pyworxcloud.
Hello,
sorry, I was on holidays.
I am using 1.4.13, I think this is the latest release.
File "/usr/local/smarthome/lib/scheduler.py", line 657, in _task
obj()
File "/usr/local/smarthome/plugins/landroid/__init__.py", line 345, in poll_device
self.worx.update()
File "/usr/local/lib/python3.8/site-packages/pyworxcloud/__init__.py", line 300, in update
self._fetch()
File "/usr/local/lib/python3.8/site-packages/pyworxcloud/__init__.py", line 294, in _fetch
for attr, val in products[self._dev_id].items():
AttributeError: 'str' object has no attribute 'items'
So, it seems that "products" as returned by the API could be
- list (expected)
- bool (see my initial error)
- str (see above)
I think, this should be caught by the code:
if type(products)=='list':
for attr, val in products[self._dev_id].items():
else:
logger.warning(...)
Or similar.
Currently, I am getting this Error on every call. Previously, it was working though (without me changing any code).
Best regards,
Hendrik
from pyworxcloud.
Can you post the code you are using for this call?
Again - this is not an issue we see using this with Home Assistant
from pyworxcloud.
Hello,
yes, it would be good to understand why the API provides bool or str sometimes for us...
You find the call of update() here:
https://github.com/Andrek01/landroid/blob/134aa286577a58afead2083b461f899ec65c89d3/plugins/__init__.py#L343
The only call that is done before is this one:
https://github.com/Andrek01/landroid/blob/134aa286577a58afead2083b461f899ec65c89d3/plugins/__init__.py#L225
So basically:
self.auth = self.worx.initialize(self.user,self.pwd) #called once
if self.auth: #called every 300s
try:
self.worx.update()
self.worx.getStatus()
Note that the Code at github has try/except around which I don't have for my running code in order to see this issue.
Best regards,
Hendrik
from pyworxcloud.
Using this quick test code, I don't see any errors.
https://gist.github.com/MTrab/abcce994ba0e1e10652455d456bb6363
from pyworxcloud.
Hello,
thanks, I am testing now.
Greetings,
Hendrik
from pyworxcloud.
Hello,
I get many successes, but then:
Updating Worx
- Update done
Sleeping 300 seconds
Updating Worx
- Update done
Sleeping 300 seconds
Updating Worx
Error: Unauthorized
Ooops - something went wrong!
Best regards,
Hendrik
from pyworxcloud.
Yup, that's a known bug. It's actually a timeout handled wrong
from pyworxcloud.
Ok, but that is not the same one as the one, that I was reporting, right?
File "/home/smarthome/.local/lib/python3.9/site-packages/pyworxcloud/init.py", line 293, in _fetch
for attr, val in products[self._dev_id].items():
TypeError: 'bool' object is not subscriptable`
Or would the kown bug then lead also to my issue?
Best regards,
Hendrik
from pyworxcloud.
No, this error is, althou incorrectly, handled by the API.
The one you reported is unhandled, so not the same.
BUT - if the test code is not producing this error, I'd say it's something in the way you are using the module.
from pyworxcloud.
Hello,
would you have any Idea?
A significant difference is, that I do not use asyncio... But my code is super simple... So I would not know, what the reason could be...
Greetings,
Hendrik
from pyworxcloud.
Can you post your full code to trigger the issue?
I'd really like to fix this, but as I can't seem to reproduce it's rather hard to guess what need to be changed and still be compatible with either systems.
from pyworxcloud.
Will close this issue as version 2 is right on the steps, containing major (BREAKING!) changes
from pyworxcloud.
Related Issues (20)
- How do I define "CloudType" and the WorxCloud object HOT 3
- Issue installing this in home assistant HOT 4
- Needs to import mqtt from awsiotsdk, not awsiot HOT 28
- Connection broken HOT 6
- MQTT connection is not automatically reconnected on drop/errors HOT 1
- Error initializing an account with multiple mowers
- Missing handling of timeout
- Not aligned requirements file HOT 1
- Python version requirement HOT 8
- Can I use this as a bridge HOT 3
- last_status is None HOT 4
- Loading fails when missing last_status HOT 2
- How to send mover to specific zone HOT 11
- AttributeError: 'Client' object has no attribute '_on_pre_connect'. Did you mean: 'on_pre_connect'? HOT 9
- Firmware version is no longer a floating point number and parsing fails as a result HOT 2
- enhancement: handle Cloudflare Turnstile interception HOT 2
- Question - how can i write current api data to a file HOT 11
- Internal mower state not updated when update message is received HOT 1
- BUG: unhandled exception if no gps key stops MQTT data receive
- Request: More stable API HOT 6
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 pyworxcloud.