Hi all,
I built a Homey app that lets you run Python code directly from Advanced Flows. Sharing it here while App Store review is pending.
Three flow cards:
Run Script — Python inline in the card, sandboxed (no network, no filesystem). Good for logic and calculations.
Run Script with Packages — full Python with pip packages. Install requests, numpy, anything. Packages are cached in a virtual environment.
Run Named Script — save scripts in the built-in IDE, call them by name from any flow. Sandbox mode and venv configured in the IDE, not the card.
From any script, the Homey API is available:
value = await homey.logic.get_variable("temperature")
await homey.logic.set_variable("target", 21)
state = await homey.devices.get_capability(device_id, "onoff")
await homey.devices.set_capability(device_id, "dim", 0.5)
await homey.flow.trigger("my_flow_id")
homey.set_tag("result", 42)
return "done"
Example — fetch live weather:
import requests
r = requests.get("https://api.open-meteo.com/v1/forecast?latitude=52.37&longitude=4.90¤t=temperature_2m")
return r.json()["current"]["temperature_2m"]
The return value becomes the return_value flow token.
IDE — settings page with Monaco editor (same as VS Code), Python syntax highlighting, run directly from the IDE, manage virtual environments.
Install: Python Script | Homey
Requires Homey Pro (local) or SHS v13.0.0+. Source: GitHub - jaccoh/homey-pythonscript: A Homey app to execute Python script in cards · GitHub
Very early (v0.2.2) — bugs and PRs welcome on GitHub.