Raspberry pi gpipo how to?

hi all
im kinda new to0 HA , just installed it, but cant figur out
how to control my gpios on the pi ? (been running pi for some years now)
how howto setup up in HA ?

What are you doing with the GPIO? There are a number of switch and sensor components for the GPIO.

I Want to be able to control my relays for now,
But currently im lost on what to do where in HA

Heres pictures of my home setup
http://dehulesider.dk/lychee/#14783717321861

And the rest is at http://dehulesider.dk/lychee
It public for all to see :wink:

I would use the GPIO switch component.

I’ve read that part, but it makes no sense at all, because what it port X is that the GPIO?
and how to i add it to the desktop of HA, very weak guide :slight_smile:

Because I’ve added this

switch:

  • platform: rpi_gpio
    ports:
    11: Fan Office
    12: Light Desk

to /home/homeassistant/.homeassistant/configuration.yaml

and rebooted

If you think the documentation needs to be improved here is how to improve it…

Keep in mind that the page tells you how to setup that component, not everything about Home Assistant.

Formatting is very important for yaml so ensure that your spacing is correct.

switch:
  - platform: rpi_gpio
    ports:
      11: Fan Office
      12: Light Desk

If you followed that guide and have things wired correctly you should be controlling your GPIO now. Keep in mind the Port number is the pin number not that GPIO number.

The switches should automatically show up on the front end (unless you have messed with your default view already)

If something isn’t showing up check your error log and post up what is showing up for further help.

1 Like

The front end is default havent player with it :wink:
Yes copy pasted em in, but nothing is showing in the panel,

no errors in the log, And i reload with

sudo systemctl --system daemon-reload

What code editor are you using? You should double check that spaces are correct and there aren’t any tabs being added.

Nano from the Linux terminal

https://pastebin.com/KruGyhBb

tripple checked an no unwanted spaces

I’m using notepad++ and Samba to access my RPi as a network folder. There’s really good tutorials to follow to set up notepad++ so it shows any code formatting problems, which might not be detected by the error logger.

Have a go at using this code and adjust as needed:-

switch:
  platform: rpi_gpio
  ports:
    26: Central Heating
    4: Hot Water

I haven’t got multiple switches, which is why I don’t need the ‘-’ infront of ‘platform’. I’ve also got ‘platform’ and ‘ports:’ in line. Not sure what difference this all makes but yaml is definitely really picky about formatting!

https://gyazo.com/b12caf1f68d280d6acb6c182e49c6d74

done with notepad++

and still nothing on the frontdesk

Could you post your whole config code and omit any sensitive info?

also, have you got anything in your groups.yaml file?

https://pastebin.com/EfEHS1pi

Hopefully someone will stumble across this with more suggestions because I’m at a loss. The only other thing I could suggest is double check if the entity names are showing in HA <> section. Should be switch.central_heating, etc.

Are you definitely editing configuration.yaml the in the correct file location? not meaning to be obvious but this is a strange problem.

Finally, just try reloading again. You can do this within HA at the bottom of the Configuration menu.

Good luck!

1 Like

the fil im editing

/home/homeassistant/.homeassistant/configuration.yaml

From the pin numbers you used it looks like you are using the GPIO number not the PIN number.

For example you have PIN 4 in use. PIN 4 is 5V, you wouldn’t be turning that PIN to Hi/Lo to control it, its always 5V. You need use the PIN numbers not the GPIO numbers.

Finally, can you post your groups.yaml file? I want to see if you have any views setup that would be conflicting with the switches showing up on the front end.

my groups is empty