Raspberry Pi GPIO Switch not working

Hi Everyone!
Thx for reading this.

I’m new in Home Assistant, I tried to make a rpi gpio switch for test, later I want to make the garden watering system out of this project. I made everything just like it write down in Raspberry “Pi GPIO Switch” but always get the error.

This:

And here is my configuration,ymal:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 0
  longitude: 0
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: UTC
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

http:
  # Secrets are defined in the file secrets.yaml
  # api_password: !secret http_password
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  # base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
sensor:
  - platform: yr

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

# proba
switch:
    - platform: rpi_gpio
      ports:
        10: elso
        12: masodik

Thx for the reading again, if got any idea pls tell it to me!

Thx
SgtCorvo

try…

switch:
  - platform: rpi_gpio
    ports:
      10: elso
      12: masodik

Note that - platform is indented two spaces ports: should be directly below - platform: and the remaining bits should be indented two spaces from where ports: is.

Spacing if very important in yaml pay close attention to it.

Did you run the config checker before you restarted? It often will flag items like this and tell you the exact line to review.

Thx! I will try this when home again.
And yes I used the config checker and dont show any problem, got a green light.

Haver a nice day! :wink:

Hi!

It’s not working for me :frowning:

this is the code:

switch:

  • platform: rpi_gpio
    ports:
    10: elso
    12: masodik

do it as you wrote:
switch:
[2]-[1]platform: [1]rpi_gpio
[4] port:
[4+2] 10: elso
[4+2] 12: masodik

[ number of space ]

What am I doing wrong?

I read the log and find this in it:

2018-07-18 18:29:25 WARNING (MainThread) [homeassistant.components.http] You have been advised to set http.api_password.
2018-07-18 18:29:45 WARNING (MainThread) [homeassistant.setup] Setup of config is taking over 10 seconds.
2018-07-18 18:30:02 ERROR (MainThread) [homeassistant.setup] Error during setup of component rpi_gpio
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”, line 146, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.6/site-packages/homeassistant/components/rpi_gpio.py”, line 22, in setup
import RPi.GPIO as GPIO
RuntimeError: This module can only be run on a Raspberry Pi!
2018-07-18 18:30:02 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of switch.rpi_gpio. Setup failed for dependencies: rpi_gpio
2018-07-18 18:30:02 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.rpi_gpio: Could not setup all dependencies.
2018-07-18 18:30:16 WARNING (SyncWorker_5) [netdisco.ssdp] Found malformed XML at http://192.168.2.34:47816:
invalid request

Is this mean the Home Assistant thinks this is not a PI? ( RPi 3B+ what I use, and the newest version of Home Assistant)

I have the same problem. Any updates on this?