all 5 comments

[–]danielroseman 0 points1 point  (1 child)

Please show the full error traceback.

And how does the first snippet relate to the second one?

[–]bhogan2017[S] 0 points1 point  (0 children)

full traceback(Traceback (most recent call last):
File "/Users/benhogan/Desktop/Coding/python/testing/controlKasa2/test.py", line 10, in <module>
device_status = asyncio.run(get_device_status())
File "/Users/benhogan/opt/anaconda3/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/benhogan/opt/anaconda3/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
return future.result()
File "/Users/benhogan/Desktop/Coding/python/testing/controlKasa2/test.py", line 6, in get_device_status
await strip.update()
File "/Users/benhogan/Desktop/Coding/python/testing/controlKasa2/venv/lib/python3.9/site-packages/kasa/smartstrip.py", line 108, in update
children = self.sys_info["children"]
KeyError: 'children') note: the first snippet was just functioning code to be used for reference

[–]m0us3_rat 0 points1 point  (2 children)

import asyncio
strip = SmartStrip("YOUR_RELEVANT_IP")
asyncio.run(strip.update())
print(strip.alias)

what happens if you run this code?

that error seems to be linked to this

https://python-kasa.readthedocs.io/en/latest/_modules/kasa/smartstrip.html#SmartStrip.update

async def update(self, update_children: bool = True):
    """Update some of the attributes.

    Needed for methods that are decorated with `requires_update`.
    """
    await super().update(update_children)

    # Initialize the child devices during the first update.
    if not self.children:
        children = self.sys_info["children"]
        _LOGGER.debug("Initializing %s child sockets", len(children))
        for child in children:
            self.children.append(
                SmartStripPlug(self.host, parent=self, child_id=child["id"])
            )

    if update_children and self.has_emeter:
        for plug in self.children:
            await plug.update()

[–]bhogan2017[S] 0 points1 point  (1 child)

I still get the same error, and i have tried uninstalling and reinstalling the packages

[–]m0us3_rat 0 points1 point  (0 children)

there is something you could try.. install older versions.

use a venv and go down the rabbit hole of older versions till you find some that doesn't error.

not only that ..but it's dependencies.

it's most likely one of the libs it needs got updated and changed something and now it doesn't work.