Using Pyscript In JupyterLab¶
Pyscript is a Home Assistant add-on (custom component) which allows you to ...
Setup¶
Install HACS¶
TBD
Install Pyscript¶
Install Pyscript from the HACS Integrations page:
Install JupyterLab¶
The addon can be installed from the Home Assistant add-on store.
Once it's installed it'll look something like this:
Click on Configuration then 'Edit in YAML':
Next, paste the code:
config.yaml
github_access_token: ''
system_packages: []
init_commands:
- pip install hass_pyscript_kernel
- jupyter pyscript install
- echo "[homeassistant]" > /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
# change this to your HA host's IP, see below
- echo "hass_host = 1.2.3.4" >> /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
- echo "hass_url = http://supervisor/core/" >> /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
- echo "hass_token = $SUPERVISOR_TOKEN" >> /usr/local/share/jupyter/kernels/pyscript/pyscript.conf
- ln -sf /config/pyscript /config/notebooks/pyscript
- curl https://raw.githubusercontent.com/craigbarratt/hass-pyscript-jupyter/master/pyscript_tutorial.ipynb -o /config/notebooks/pyscript_tutorial.ipynb
And click Save:
Click Restart:
You should now see "JupyterLab" in your Sidebar:
The file pyscript_tutorial.ipynb
contains the PyScript tutorial:
Last update: 2023-03-30