currently i dabling with a Ardunio with a Servo since Rpi Home assistant and a Servo Doesnt work
so i have a button on Ardunino that turns on and off Servo… i hooked it up to Rpi so it can control a Control Pin and a Status Pin
so its a Arduino Uno hooked to a RPi 4 to monitor things… now i have a script that simulates button press of a momentary switch so it does… button press delay .5 button press delay 60 (for now testing using 1 min) button press delay.5 button press
so it simulates you pressing the button to open a valve it delays 1 min then it buton press’s again to shut off
the issue i find is how can if the Script is running but if i Hit the Button it should Cancel the script …
right now what it does is if the script is running… i hit the button to basiclly cancel the script… and then by the minute is done the script is running again well because it does a button press
how do i set up the Script that when Change State of the Binary_sensory gpio if it sees a change
it will CTRL +C the script how do you do that? so if script is running i press the button… the button state has changed… so Force End script
how do you do that?
this is my script… and i want it to be killed if a state change from ON to OFF for the one gpio
or if i change the whole setup to run on the PI that the Relay would shut off by a button press
Icon
The mode controls what happens when script is invoked while it is still running from one or more previous invocations. Check the script documentation for more info.
Mode
Single (default)
Sequence
The sequence of actions of this script.
Learn more about available actions.
Action type
Call service
Service
switch.turn_on
Name(s) of entities to turn on
switch.servo
Service data
1
Action type
Delay
Delay
1
Action type
Call service
Service
switch.turn_off
Name(s) of entities to turn off.
switch.servo
Service data
1
Action type
Delay
Delay
60
Action type
Call service
Service
switch.turn_on
Name(s) of entities to turn on
switch.servo
Service data
1
Action type
Delay
Delay
1
Action type
Call service
Service
switch.turn_off
Name(s) of entities to turn off.
switch.servo
Service data
1
so what i want is if the script is running and you press button it cancels the script. it sees the sensor from ON to OFF
or if the Sensor is ON already and the script comes on it doesnt get cancelled so the script will start with the sensor OFF or ON but when button is pressed it cancels the script
im still new to home assistant
so you need to explain it so someone new would understand
i also plan to make this Rpi a secondary home assistant… id like to run a main home assistant that connects to this one… but ya this is the current yami
so the water postion is just a High or Low arduino sends to say if the Water Valve operated by a servo is open or closed and “servo” is just wire to simulate you pressing a Momemtary switch
and can i change words for Enity Card. for On and Off?
i want to change ON to Open and Off To Closed to better display a Valve Open Closed not On or Off
so i tried googling and came up with some stuff… i tried couple examples and it didnt work… also i dont understand this template stuff either… wish there was a detailed video on each component so i can understand how it works trying to figure it out from the limited examples of each componenet name doesnt help someone with learning disability as i a visual learner. … but this herei tried the alias but didnt work either…
i want like an Emergency Button … you hit it and it kills the Script
i dont understand “templates” “covers” etc i havent found a video that explains in detail of these and brakes it down so any 5 yr old can understand… so i wanted it simplified
but basiclly i have that Status and i want it 1
to change from ON OFF to OPEN and Closed
and if Script is running and STATE changes from OPEN to Closed
that it kills the script
as right now to simulate a button
i do
ON
OFF
Delay
On
OFF
in the script so
ON
OFF
simulates me pressing a Momentary switch in and then releasing
ok ill google that device class as i dont know how to set this easily
and thats ok. you helped with the other one… i had to google it and found that is a call service script
i still havent found a good video that explains everything im simplistic form… still havent seen a video to explain templates etc…
and doesnt help i use a Mometary Switch to control my project i guess if i used a toggle would been better for Home assistant to work with…
but slowly learning it…
@anon43302295
i having tough time… i google and i try to follow peoples examples but when i run the test configuration it always fails
its the same with the examples of the docs.
always confuses me it doesnt tell me you need to add this line to configuration.yaml
or automations.yaml
or i found scripts /automation section you can add yaml configuration
so i never know know as i also trying to get Modem Caller ID to work it doesnt tell me exactly place this code here place this code exactly in this file.
is there an actual Step By Step instructions how do do this
i looked at Button Card love lace but it seems i guess thats just an add on you still need to get this ahead of the game
i wish it was user friendly for a dumb bum to understand like simplisitic
but ill keep googling was hoping some good simple videos explainings a 5 yr old could understand well maybe 10 but something easy
instead of people only posting like 5 lines of there code but doesnt say where you place it what you gotta do ahead of time. etc
The problem is that where to paste the code depends on how you have chosen to split up your configuration.
Basically, when homeassistant starts it combines all of your configuration files in to one big ‘document’ that it uses to apply your configuration.
So, if you so choose, you could just use one big configuration.yaml, but of course this gets disorderly very quickly, so we use things like packages, !include and !include_dir_named so that we can split the configuration into manageable chunks. Then the system merges these files back into the single ‘document’ based on the type of splitting method you declared.
So basically when someone posts an automation, they don’t say which file you should put it in because they don’t know. Depending on your configuration it could go directly in configuration.yaml, or it could go in automations.yaml, or it could go in a file called bob.yaml in an included directory, or it could go in a package…
Homeassistant is very very very very flexible, which is great because it makes it powerful, but it makes it hard to do ‘step by step’ instructions because everyone’s configuration is completely different.
All I can suggest is to read the documentation about how yaml is used by homeassistant (the getting started bits, not the integrations) and try to get your head round that first. One day it will just ‘click’ and then when you see a snippet of code that you want to use, you’ll know how to apply it to your specific configuration.
On a mobile the list of all the documents is at the bottom of the page, I think on a desktop they’re down the right hand side. But work your way through them as best you can. That is to say this list of documents…
@anon43302295
ah ok ill try it
it gets confusing at times and i get frustrated
because when you goto Automation and post the yami it doesnt like it…
if i edit an card entity it will tell me no you cant do it… tells you off
if i post in the configuration yami and check it it tells me no good… or if i have the Visual Code Editor it doesnt like things
like I trying do Caller ID… but the Caller ID info is outdate it doesnt work period
there is no “sudo” there is no “usermod”
the yami. i posted it in the automations.yami and when you check configurations it hates it
load up the visual code editor… and its all in red as it doesnt work
and dont see how you edit the Initialization strings for modems
i had a post about caller ID before no one replied maybe you can help
cuz i stuck… i got my modem plugged in i ran did this Modem Caller ID - Home Assistant (home-assistant.io)
Error loading /config/configuration.yaml: while scanning for the next token
found character '%' that cannot start any token
in "/config/automations.yaml", line 38, column 80
and i thought modem: !include modem.yami
would worked like the other names but it didnt like that… but ill look up that info
ya right now past couple months i been bashing my head off the wall and the Node Red its not as simplie as the youtube videos so i step away from it for a week or so as i wish i had someone beside me telling me showing or taking live questions you ask what your question is and t hen someone live could explain it… it be nice…
as i want those fancy Squares not the plain ones but i not there yet lol still dealing wth code issues and learn the node red
Very short reply just focusing on a couple of issues, but the main reason your automations.yaml isn’t working is because you have
automation:
At the top of it. As I said earlier everything gets merged. In your configuration.yaml you have this
automation: !include automations.yaml
Now when that gets merged it will add the contents of automations.yaml, currently resulting in
automation:
automation:
- [YOUR FIRST AUTOMATION]
Which is invalid. What you want it to do after merge is
automation:
- [YOUR FIRST AUTOMATION]
So you need to remove the automation: line from the top of automations.yaml.
There looks to be a problem with the template on line 38 too, the errors after that are probably related to the config checker not determining the template on line 38 properly so expecting the things after it to be different.
As for
modem: !include modem.yaml
There is no modem component. The word before the colon at the far left edge of configuration.yaml is the declaration of the component (tts, automation, sensor etc), it’s not just something that you randomly make up.
@anon43302295
ah ok well what i did was just click the Copied Icon and you copy the text and then paste it
and if i paste it in configuration skip the automation.yami then it fails too
and if i remove automation: in the automation
then it creates more errors with -alias: it gives me indentation problems it says or
bad indentations
or action required depending on how you type it
maybe you can try it but ok
and ya i didnt know aboutr making your own yamis
i guess it goes as customize… !include
but ya all i did for the modem you see i just copy and pasted the yami there is no instructions not to include automation:
and if u put in configuration it still gives errors
but i only read a little from ur link so ill read more tonight as i stilll want to change that ON off to Open Closed figured 5 min fix takes days to read to get there lol