Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'get' #1

Open
TheAmitMa opened this issue Jan 19, 2020 · 10 comments
Open

AttributeError: 'NoneType' object has no attribute 'get' #1

TheAmitMa opened this issue Jan 19, 2020 · 10 comments
Assignees

Comments

@TheAmitMa
Copy link

When setting the cooker variable with AnovaCooker('my device ID')
I'm getting this error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/anova/AnovaCooker.py", line 48, in __init__ self.update_state() File "/usr/local/lib/python3.6/dist-packages/anova/AnovaCooker.py", line 63, in update_state self.heater_duty_cycle = float(device_state.get('heater-control').get('duty-cycle')) AttributeError: 'NoneType' object has no attribute 'get'
Funny thing that last week it worked...
Tried it with 2 different systems..
Any Idea?

@ammarzuberi ammarzuberi self-assigned this Jan 19, 2020
@ammarzuberi
Copy link
Owner

I’ve only seen this error when I use an invalid cooker ID - have you tried to hit the API directly with your cooker ID?

@TheAmitMa
Copy link
Author

Yes.
I've tried the query my device with
https://anovaculinary.io/devices/MYANOVAID/states/?limit=1&max-age=10s
and I'm getting the results.

My firmware version is: VM176_A_01.04.03 if it matters.

@ammarzuberi
Copy link
Owner

Can you post the output of that request? Please remove any identifying fields.

@TheAmitMa
Copy link
Author

[ { "body": { "boot-id": "XXXXXXXXX", "job": { "cook-time-seconds": 0, "id": "XXXXXXXXX", "mode": "IDLE", "ota-url": "", "target-temperature": 56, "temperature-unit": "C" }, "job-status": { "cook-time-remaining": 0, "job-start-systick": 1736, "provisioning-pairing-code": 0, "state": "", "state-change-systick": 1736 }, "network-info": { "bssid": "XXXXXXXXX", "connection-status": "connected-station", "is-provisioning": false, "mac-address": "XXXXXXXXX", "mode": "station", "security-type": "XXXXXXXXX", "ssid": "XXXXXXXXX" }, "pin-info": { "device-safe": 1, "water-leak": 0, "water-level-critical": 1, "water-temp-too-high": 0 }, "system-info-3220": { "firmware-version": "VM176_A_01.04.03", "largest-free-heap-size": 26648, "systick": 48330561, "total-free-heap-size": 27856, "total-heap-size": 65536 }, "system-info-nxp": { "version-string": "VM171_A_01.04.03" }, "temperature-info": { "heater-temperature": 17.25, "triac-temperature": 20.28, "water-temperature": 17.68 } }, "header": { "created-at": "2020-01-20T09:08:18.975188Z", "e-tag": "XXXXXXXXX", "entity-id": "XXXXXXXXX" } } ]

@TheAmitMa
Copy link
Author

Anything?

@ammarzuberi
Copy link
Owner

Apologies for the delay. What type of Anova device do you have?

@TheAmitMa
Copy link
Author

Precision. The new model.

@niekbuurmah2o
Copy link

Precision. The new model.

Same here - I have the precision 2.0 and get the same error message.

@niekbuurmah2o
Copy link

niekbuurmah2o commented Jul 14, 2020

I compared the output of the device query and noticed that the website doesn't report the answers to the following lines in the script (not sure whether this is Precision 2.0 specific, but I guess it is if others find the script still works):

	# self.heater_duty_cycle = float(device_state.get('heater-control').get('duty-cycle'))
	# self.motor_duty_cycle = float(device_state.get('motor-control').get('duty-cycle'))

These lines are also exactly where I get the NoneType error. As you see above, I've #ed them out and the script works again!

The easiest option to allow cross-cooker compatibility might be to first identify the type of cooker and then place if-statements before the lines above. I wonder whether the following bit might identify the cooker?

"system-info-nxp": {
"version-string": "VM171_A_01.04.04"

@fabriba
Copy link

fabriba commented Mar 1, 2021

I forked this with something similar to what niekbuurmah2o mentioned there, and it works.
It seems to expose much fewer details than the old api used to (eg: https://github.com/bmedicke/anova.py ) , I am not sure if this is limitation of this code, or of the new API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants