# How to control a node-red GPIO python script from hassio (docker homeassistant)

**URL:** <https://discourse.nodered.org/t/how-to-control-a-node-red-gpio-python-script-from-hassio-docker-homeassistant/33870>\
**Category:** Developing Nodes\
**Created:** [7 October 2020 08:25 UTC](https://discourse.nodered.org/t/how-to-control-a-node-red-gpio-python-script-from-hassio-docker-homeassistant/33870 "2020-10-07T08:25:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jycemea](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jycemea](https://discourse.nodered.org/u/jycemea)\
**Post date:** [7 October 2020 08:25 UTC](https://discourse.nodered.org/t/how-to-control-a-node-red-gpio-python-script-from-hassio-docker-homeassistant/33870/1 "2020-10-07T08:25:58Z")

</div>

Hi,

I'm looking to control a scripted GPIO python3-function node from hassio (not homeassistant with python venv installed ... but hassio) to MANUALLY control a GPIO. Everything is already running fine in node-red. The problem is simple : hassio can't execute a python script. Only the python venv environnement is able to do that... and I can't use it!

I already installed node-red-contrib-home-assistant-websocket and I can create any switch/sensor/binary sensor, it is correctly seen in hassio.

Everything I've tried does not work. The python script can't be triggered from hassio cause I do not know how to do it correctly.

Of course there are a some other method to succeed... but I do not know them.

Here is my node-red python3-function node :

```auto
[{"id":"7d6fa4e9.2d3e0c","type":"tab","label":"HASSIO1","disabled":false,"info":""},{"id":"2ce907dc.0750b8","type":"debug","z":"7d6fa4e9.2d3e0c","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":300,"y":280,"wires":[]},{"id":"8f86f93e.7ab178","type":"python3-function","z":"7d6fa4e9.2d3e0c","name":"","func":"\nimport RPi.GPIO as GPIO\nimport time\n\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(27, GPIO.OUT)\n\nGPIO.output(27, GPIO.LOW)\ntime.sleep(3)\n\nGPIO.output(27, GPIO.HIGH)\nGPIO.cleanup()\n\nprint \"Porte ouverte!\"\n\nreturn msg","outputs":1,"x":310,"y":180,"wires":[["2ce907dc.0750b8"]]},{"id":"4a232312.277bcc","type":"inject","z":"7d6fa4e9.2d3e0c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Porte_Ouverte","payload":"","payloadType":"date","x":170,"y":100,"wires":[["8f86f93e.7ab178"]]}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 December 2020 08:26 UTC](https://discourse.nodered.org/t/how-to-control-a-node-red-gpio-python-script-from-hassio-docker-homeassistant/33870/2 "2020-12-06T08:26:00Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
