Thank You!
it helps when you dont call the appdaemon app an automation.
those are 2 different things.
in the app i wrote you have the following going on:
a function is started (get_values) that reads the website and creates a sensor.
the amount of minutes you put in the offset before the game another function is started (start_game)
with that function you call your homeassistant script
then after the amount of seconds you did put in the yaml another function is started (start_automation)
homeassistant doesnt know what appdaemon is doing.
so you can use the automation that you started in appdaemon as trigger or add some more lines to the app
Well I havenât done anything else yet, but Iâm happy to report the station changed perfectly!
Do you know how I would start a automation using the start_game function?
yes.
in the last code i gave you there is already an automation started.
with this part:
#################################################################
# and we want to start an automation some time after the script #
# has been started #
#################################################################
self.run_in(self.start_automation,self.args["seconds_automation_after_script"])
def start_automation(self,kwargs):
#################################################################
# so its time to start the automation #
#################################################################
if "automation_name" in self.args:
self.turn_on(self.args["automation_name"])
self.run_in starts the function start_automation after the amount of seconds set in the yaml.
the self.run_in is called from the script start function, so it happens after that.
the home assistant automation has an entityname that you set in the yaml.
if you want to start another homeassistant automation after a certain time that would be exactly the same.
if you want to run it after the first automation then we set another run_in inside the start_automation function, but it can also be on a specific time or based on the game time, then we need to place the run_in elswhere.
that new run_in would call a new fuction which is a copy from start_automation but with a different function name.
so exactly what would you like to do and when?
I would like to run a automation after the tv changes to the appropriate channel each week.
I agree.
I didnât know thatâs what he was asking about.
Im sorry, im trying to learn all of this stuff. I will get there!
no problem. we were all clueless at one point or another.
not that iâm saying youâre cluelessâŚ
lol, Im much better at yaml then appdaemon. This is very new to me
me too.
i havenât even tried to tackle AD yet.
I threatened to try it once but luckily I found a way to work around what I was trying to do without it so I dodged that bullet for now.
dont feel threatened.
i wrote some instructions just for people who have never used any python.
and if you read all the comments that i did put into the browns app for corey, it will also make a lot clear.
and @Corey_Maxim i know you will. thats why i point things out to you
Yes, I actually started reading your tutorials.
They made sense but at that point I didnât need to dive in fully and figure it out.
Maybe Iâll need it at some point in time. For now I can get by without it.
i didnt know much about python when i started, but i found yaml a hasle.
and then AD showed up and python got a lot easier.
i know can do 1000x more then i could ever have done in yaml, just because i didnt get yaml
working with python and AD did teach me to work with yaml as well and now i can do 100x more in yaml then i could do at the beginning.
still there is an extreme amount of stuff that i could never do in HA only with yaml and jinja.
if you are tempted the just start by trying small automations to move over to AD, and if you are a home automation freak, you soon will be hooked.
but it all depends on how far you like to automate.
i still get a kick every time i go to bed and without doing anything i see that lights go off, the heating goes down and alarms are set. or when the soccergame from the favourite team from my wife starts to play and she gets live (by TTS) told what is happening. or alexa tells us every hour to put out the trash untill we tell HA that we did it.
I hope one day I will get there too!
for now its baby steps, I love my browns sensor! its just figuring how to extend it now
I vote @ReneTode for forum president!
lol you really know how to make a person smile
ill settle for the title teacher
Teacher @ReneTode
any starting ideas for getting animations to run, im not sure where to start.
Ideally if I can use something to trigger yaml automations it would be easier.
to trigger yaml automations you need triggers
i am still no yaml expert (or any other kind of expert), but automating in yaml is out of my reach.
just because i never did use it and i find it not logical.
i created my own app for automations and now i program also in yaml, but the how its for me logical.
like:
movement_kitchen:
module: actions
class: actions
if:
binary_sensor.kitchen_10_100: {"new_state": "on","delay":300}
do_first:
switch.heating_kitchen_25_1: {"value": "on"}
light.kitchen_above_vitrine: {"value": "on", "rgb_color": [255, 127, 0], "brightness": 250}
do_after_some_delay:
switch.heating_kitchen_25_1: {"value": "off"}
light.kitchen_above_vitrine: {"value": "off"}
hold_for:
input_boolean.movement_kitchen_app: "off"
time: {"start": "sunrise", "end": "sunset - 01:00:00"}
animations? hmm you mean on TV, or a tablet?
first you need to think what you want to trigger it.
a button, a movement, a moment in time, or whatever is happening in your life.
off course you need to be able to capture that event, for instance by a sensor
then you need to specify what you actually want to do.
start an animation on tv or a tablet (i guess in this case)
so you need a mediaplayer that activates a file. (you dont want to start automating creating animations)
most helpfull is to keep things small.
dont try things like i sometimes see here like:
if the sun goes down then switchs all lights but if there is motion in livingroom then dont switch that light and if there is no motion in bedroom then switch only the one light, and in the meantime set the heating to 25 and also make sure that the bathroom is only reacting to motion if the lights there are not on.
oops. try to automate that.
instead do:
if the sun goes down switch light a on but only if no motion in livingroom
if the sun goes down switch light a on but only if someone is home
if the sun goes down switch light b on but only if someone is in the room
if the sun goes down turn the heating to 25 but only if someone is home
if the sun goes down turn the heating to 18 but only if noone is home
thats what i call eventbased programming. small and understandable. can you split it up then do.
because when you can split it up you can control both elements.
the more you try to combine stuff, the more difficult it is to see what is happening.
for example:
i want the lights to go on and the heating to go to a certain level when i come home.
makes sense doesnt it?
so i start:
if i = home then (lights on, heating to 25)
that works for the winter, but not for the summer
i could try to get that to a oneliner
if i=home then (lights on, (if summer do nothing, if winter heating to 25)
your brain is already starting to twirl but not for
if i = home then lights on
if i = home then heating to 25, hold when summer
so i say: simplefy, simplefy, simplefy.
so to get back to your question:
what action do you want to happen to what trigger?
lol, Firstly your funny. I almost have a mancrush⌠(just kidding well about the mancrush part)
I didnât mean animations hehe rather automations.
well I made some scripts for alexa tts and lights during the games.
script.letsgobrowns
script.browns_football_time_tts
script.browns_lights
script.kitchen_loop
script.nfl_tts
script.here_we_go
I did have these setup in a automation with delays in-between of-course so they fired at different time leading up to the game.
i would start these after the tv changes to the station at the 15min before start time.
let me know if you have any questions.
im actually getting a error now, maybe because the game is over?
Maybe because the page is going to update?
2018-10-14 21:00:23.177171 INFO AppDaemon: Initializing app browns using class browns from module browns
2018-10-14 21:00:24.545945 WARNING AppDaemon: ------------------------------------------------------------
2018-10-14 21:00:24.546522 WARNING AppDaemon: Unexpected error running initialize() for browns
2018-10-14 21:00:24.547032 WARNING AppDaemon: ------------------------------------------------------------
2018-10-14 21:00:24.549568 WARNING AppDaemon: Traceback (most recent call last):
File â/usr/lib/python3.6/site-packages/appdaemon/appdaemon.pyâ, line 1575, in init_object
init()
File â/config/appdaemon/apps/browns.pyâ, line 29, in initialize
self.get_values(self)
File â/config/appdaemon/apps/browns.pyâ, line 113, in get_values
opponent = schedule_card.div.div.nextSibling.nextSibling.p.nextSibling.nextSibling.string.strip()
AttributeError: âNoneTypeâ object has no attribute âstripâ
2018-10-14 21:00:24.550106 WARNING AppDaemon: ------------------------------------------------------------