Skip to content

Running via Crontab #92

@dubleigh

Description

@dubleigh

This repo is awesome btw. I have a script that reads the on time and turns off a device (Kitchen Cabinet - Glass Cabinet) if the on time exceeds a threshold. The code runs fine when initiated by the command line, and sends the below error message when run via the crontab scheduler. Running ubuntu 18.04.4 LTS (Bionic Beaver). Any help would be appreciated, thank you!

Trying to discover Kitchen Cabinet - Glass Cabinet using 3 attempts of 1 seconds
Attempt 1 of 3
Traceback (most recent call last):
File "/usr/local/bin/kasa", line 8, in
sys.exit(cli())
File "/usr/local/lib/python3.7/dist-packages/asyncclick/core.py", line 799, in call
return anyio.run(self._main, main, args, kwargs, backend=_anyio_backend)
File "/usr/local/lib/python3.7/dist-packages/anyio/init.py", line 72, in run
return asynclib.run(func, *args, **backend_options) # type: ignore
File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 114, in run
raise exception
File "/usr/local/lib/python3.7/dist-packages/anyio/_backends/_asyncio.py", line 76, in wrapper
retval = await func(*args)
File "/usr/local/lib/python3.7/dist-packages/asyncclick/core.py", line 802, in _main
return await main(*args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/asyncclick/core.py", line 748, in main
rv = await self.invoke(ctx)
File "/usr/local/lib/python3.7/dist-packages/asyncclick/core.py", line 1172, in invoke
await Command.invoke(self, ctx)
File "/usr/local/lib/python3.7/dist-packages/asyncclick/core.py", line 994, in invoke
return await ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/dist-packages/asyncclick/core.py", line 588, in invoke
rv = await rv
File "/usr/local/lib/python3.7/dist-packages/kasa/cli.py", line 56, in cli
host = await find_host_from_alias(alias=alias, target=target)
File "/usr/local/lib/python3.7/dist-packages/kasa/cli.py", line 195, in find_host_from_alias
if dev.alias.lower() == alias.lower():
File "/usr/local/lib/python3.7/dist-packages/kasa/smartdevice.py", line 112, in wrapped
"You need to await update() to access the data"
kasa.exceptions.SmartDeviceException: You need to await update() to access the data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions