I don’t have a relay or led attached to GPIO21 as yet, so have not been able to test if it work, I suspect it does.
I now would like to create a timer for the same GPIO pin
I would like to have it come on at a specific time and then off at a specific time, I understand it will be 2 time triggers. One for switching on and One for switchin off.
The problem that I am having is that there is very little info out there that I have found (May be searching incorrect wording) that deals with GPIO’s
I am also not familiar with the hass.io configuration file as yet, to be able to understand from examples on the site.
If someone could help with the config of the above GPIO21 to be switched on at time of 18:00, I am sure I would be able to do the off time myself by learning from that code.
Firstly I would like to create a timer that triggers a GPIO to be on at a certain time.
Then secondly instead of these two GPIO’s being displayed as switches I would like them to be listed as taps.
Thank you for your reply, I have gone through the documentation, but it does not make it clear, even in the examples it’s not clear.
I understand that I will need to have something like this:
automation:
trigger: time
time: xx:xx
The problem I am having is that the documentation does not really cover time based on and time based off, along with the GPIO pins, as somewhere I would need to specify what must be switched on and off
It’s for this reason I am looking for an example config for a GPIO pin, from there I am sure I will pick up what needs to be done.
Also where does one find the valid entity id’s to specify which device you want switched.
None of the examples for Automation have time based event, that triggers a switch or device from what I can see, maybe missing it, but so far I have not found anything that helps in me setting up a time based switch event on a GPIO pin
That is correct!
Basically if you define entities by a friendly name only, you can expect HA to create the entity id by making the friendly name lower case and replacing blanks by underscores.
At the moment yes, it’s just a pi connected to a relay, no additional hardware as yet, busy learning this setup and so on.
Before I implement it any further I want to have a better understanding on the automation setup on hass.io, currently running webiopi and custom scripts run from cron to do the job and has been working for 2 years, but would like to add voice commands in the future so learning hass IO to do that
The interface is nice, but the automation side of things seems very difficult
My code bellow to switch on at a time failed but the code validated
I did manage to get all switches on using the builder under automation, but can’t get it to trigger just GPIO16
- automation:
- alias: 'GPIO16 Timer switch on at xx:xx'
trigger:
platform: time
entity_id: switch.gpio16
at '11:59:00'
action:
service: switch.turn_on
I changed the code to this
- automation:
- alias: 'GPIO16 Timer switch on at xx:xx'
trigger:
platform: time
at: '12:08:00'
action:
service: switch.turn_on
entity_id: switch.gpio16
What that did was fix the colon on the line with at, and moved entity_id to action, this now triggers both gpio16 and gpio20