Hi all. I am struggling to run a python script that will switch my gpio ports on for 1 second.
I get error on the first line of code import RPi.GPIO as GPIO
I am using this solution on my rPi3B and works fine. I wanted to integrate and automate.
So I installed hassio to run the code with ifttt and so on…
I can use following code in configuration:
switch:
Thank you. I tried second way and also simplified. but it is not working:
error>
Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 77, column 8
Be very careful with the number of preceding spaces (not tabs!), also note the the use of lower case letters.
If you look at the developer tools menu (left hand side lower down on the main web page) and press the states button that looks like this: <> it will show you all your entity names and their states. Note how your switch id was converted to lower case.
Tom thank you. It works. But not quite good.
On restart of system it started the script for no reason to me. (maybe the missing cleanup of gpio?)
2nd question can I somehow combine it in just a script or hide the switch from home screen?
The 'Pull" columns of this chart shows the state of the GPIOs before they have been initialised (i.e. before HA starts). The GPIOs with pull-up resistors will be high until HA starts. The ones with pull-down resistors will be low until HA starts:
Yeah that won’t work to hide the switches. The GPIO switch definition has to go under the switch section of your configuration.yaml file (or in the switches.yaml file if you use switch: !include switches.yaml).