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

TypeError: 'type' object is not subscriptable #2

Closed
honkbonk opened this issue May 3, 2021 · 5 comments · Fixed by #3
Closed

TypeError: 'type' object is not subscriptable #2

honkbonk opened this issue May 3, 2021 · 5 comments · Fixed by #3

Comments

@honkbonk
Copy link

honkbonk commented May 3, 2021

When running as documented I see the following error...

Traceback (most recent call last):
File "mqtt2kasa/main.py", line 12, in
from mqtt2kasa.keep_alive import (
File "/home/pi/kasa/mqtt2kasa/mqtt2kasa/keep_alive.py", line 76, in
kasas: dict[str, Kasa], kas: dict[str, KeepAlive], mqtt_send_q: asyncio.Queue
TypeError: 'type' object is not subscriptable

My configuration looks like this...


knobs:
# Note: normally you don't set these... here just to show how to
# devel and debug
# log_to_console: false
# log_level_debug: false
mqtt:
# ip/dns for the mqtt broker
host: 192.168.35.90
globals:
# every location will be managed using a unique mqtt topic
# unless explicitly specified, this format will be used
topic_format: /{}/switch
# kasa will monitor the current state of the device every
# poll interval, in seconds. You can override on a per device
poll_interval: 11
locations:
# coffee maker. To turn it on, use mqtt publish
# topic: /coffee_maker/switch payload: on
# subscribe to /coffee_maker/switch to know its state
living_room_lights
host: 192.168.35.103
desk_lights:
host: 192.168.35.120

Any help would be appreciated.

@flavio-fernandes
Copy link
Owner

Hi,

I suspect you are having the same issue as in
#1

As documented in readme file:
NOTE: Use python 3.7 or newer, as this project requires a somewhat
recent implementation of asyncio.

Maybe we should make that a little more visible, what do you think?

@honkbonk
Copy link
Author

honkbonk commented May 4, 2021

Hi,

I suspect you are having the same issue as in
#1

As documented in readme file:
NOTE: Use python 3.7 or newer, as this project requires a somewhat
recent implementation of asyncio.

Maybe we should make that a little more visible, what do you think?

I'm using Python 3.7.3 so maybe it's more about the version of asyncio.

I'll dig deeper there and see.

@williamp0044
Copy link

Hi,
I suspect you are having the same issue as in
#1
As documented in readme file:
NOTE: Use python 3.7 or newer, as this project requires a somewhat
recent implementation of asyncio.
Maybe we should make that a little more visible, what do you think?

I'm using Python 3.7.3 so maybe it's more about the version of asyncio.

I'll dig deeper there and see.

Hi! Did you make any progress? Having the same issue. On the same python version.

@flavio-fernandes
Copy link
Owner

flavio-fernandes commented Jul 23, 2021

Sorry to hear. I use 3.9 and was not aware that anything lower than that is not working. Please consider using 3.9 or see if 3.8 is also good? I should update that readme as soon as we find out.

@flavio-fernandes
Copy link
Owner

Hi,
I suspect you are having the same issue as in
#1
As documented in readme file:
NOTE: Use python 3.7 or newer, as this project requires a somewhat
recent implementation of asyncio.
Maybe we should make that a little more visible, what do you think?

I'm using Python 3.7.3 so maybe it's more about the version of asyncio.
I'll dig deeper there and see.

Hi! Did you make any progress? Having the same issue. On the same python version.

Can you try a small change and see your python version works better? Basically, simply rewrite the trouble line:

kasas: dict[str, Kasa], kas: dict[str, KeepAlive], mqtt_send_q: asyncio.Queue

as

kasas, kas, mqtt_send_q

flavio-fernandes added a commit that referenced this issue Jul 23, 2021
Remove typing that is not supported in python 3.7:

File "/home/pi/kasa/mqtt2kasa/mqtt2kasa/keep_alive.py", line 76, in
kasas: dict[str, Kasa], kas: dict[str, KeepAlive], mqtt_send_q: asyncio.Queue
TypeError: 'type' object is not subscriptable

Fixes #2

Signed-off-by: Flavio Fernandes <[email protected]>
flavio-fernandes pushed a commit that referenced this issue May 27, 2024
introduced throttle and receive queue configurations
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

Successfully merging a pull request may close this issue.

3 participants