#Moving a cronjob to hass

1 messages · Page 1 of 1 (latest)

near talon
#

I got a python script running in a cronjob on a remote machine and sends the data I want to a webhook on home assistant which in turn notifies my phone. Is there any way to move that script to and run from home assistant? I'm consolidating things

valid sandal
near talon
#

the time pattern trigger could work. So I put the script somewhere on the hass filesystem and then use the shell integration?

#

can I create a venv and install modules?

valid sandal
#

Yeah the shell command integration could be an option.

There are also some python specific integrations that might be worth looking into. The python scripts integration doesn't support imports, but it points at pyscript (a HACS custom integration) as an alternative which does.

I haven't used it myself, but it looks like it might do what you're looking for (minus use of venv). The docs have details on how to install additional packages.

Home Assistant

Instructions on how to setup Python scripts within Home Assistant.

GitHub

Pyscript adds rich Python scripting to HASS. Contribute to custom-components/pyscript development by creating an account on GitHub.