Raspberry gpio

hi,

I’m very new for HA.

i have always used raspi with webiopi and simple python file to command my relay on raspi gpio port.

now i am in complete confusion.

can someone help me for command the relay from configuration.yaml?

thanks

hi omeasire,

thank for your answer.

i just do it and i can put on/off the relay from the web page.

but i will know a procedure to do it by an automation for example when a device is home.

greg

Hi @magre

You probably want to look at automations

https://home-assistant.io/getting-started/automation/

The home page has some good docs and on the homeassistant gitter channel there are many users that can help get you going

thanks,

but the problem remain for me.

i have this configuration.yaml part file:


switch:
platform: rpi_gpio
ports:
7: S1
8: S2

i try this for automation:

automation:
trigger:
platform: time
after: ‘15:00:00’
action:
service: switch.turn_on
entity_id: switch.S1

why it does not work?

Please re-paste your config and highlight the text, then press the < / > in the bar just above your post. This preserves the spacing and formatting. Formatting is very important in HA and can cause issues even if the text is correct.

Everything looks OK here, however, it may be a formatting/spacing issue. Is there anything in your error log?

Also, did you wait until after 15:00? Not sure if it will trigger on restart if its after 15:00 or if it has to pass 15:00 while running, someone else will have to answer that.

here:

switch:
  platform: rpi_gpio
  ports:
    7: S1
    8: S2

automation:
   trigger:
     platform: time
     after: '15:00:00'
   action:
     service: switch.turn_on
     entity_id: switch.S1

i hope this is right.

thanks

greg

It looks ok.

You could try, for the service homeassistant.turn_on. Also make sure that is the correct entity name, by going to the entity developer tools (bottom row of icons in the sidebar/menu)

You will have to pass the time as @silvrr pointed out