AppDaemon Q&A

Voice control?

This link is mentioned in the Guide, it will explain how you can use the kwargs.

/R

1 Like

nope distance.
something like the watertaps where you only need to get your hands near it and the water start flowing.

Thanks,
I haven’t gotten far enough to worry about that yet. I had assumed it was some kind of “Python” version of the typical variable arguments, but I wasn’t sure. I’m just glad I have it running now. :smile:

1 Like

it is python all the way.
with a library for hass commands. :wink:

if you are not very familiar with python, maybe this is helpfull:

http://appdaemon.reot.org/AppDaemon_for_beginner.html
http://appdaemon.reot.org/AppDaemon_for_beginner_app_2.html

it isnt looking very slick as it is right now, and @rpitera would check out my language failures, but thats gonna take a little while and in the meantime i could help people.

if there are people enough who think this is helpfull i will write some more parts.

2 Likes

Would you like me to take a first shot at the grammar for you?

As @ReneTode says it is all basic python. He has just put a Home assistant abstraction layer available in AppDaemon.

Don’t sweat it! Python is a pretty easy language to get going in, it has many layers ofc, but to do automations that have some level of complexity will be simpler than to learn the yaml config in HASS.

/R

1 Like

The language isn’t bothering me. I have programmed in Basic, Fortran, Pascal, three different assemblers, C, C++, Objective C, Java, and probably a few I have forgotten over the years. What’s one more. It’s all about learning how to do the basic things.
Write Hello World - Teaches output and how to compile/run
Hello Chip - how to edit the file
Hello Chip with a Loop 10 times - basic for loop and simple integer variable
Hello (input name from keyboard) - Input from keyboard with simple string handling
Hello input name from keyboard and repeat until a specific name is entered - if statement and probably a while loop.
Make a function called hello world, call it from inside a loop in the main program - how to create a function.

Now I have the building blocks I need to really start learning the language. After that I should have the basic syntax down, and I’m ready to start playing with objects, and other types of I/O.

That’s why I think some of my questions are stupid sometimes, because I know I should be able to find the answer, but for some reason I’m not finding it on Google so I’m not looking under the correct keywords. That’s when I need someone to tell me (Oh we don’t use MOV we use STO in this assembler to put a variable in a location. Silly me, I was searching under MOVe in google.

1 Like

Sorry I have been absent from this thread for a while - busy at work. A big thanks to everyone who has been pitching in and helping answer questions - I really appreciate it!

Then you will be up and running in no time :smile:

Remember Mr Garrison! There are no stupid questions, only stupid people.

/R

Everyone has other responsibilities, @ReneTode has done a good job covering for you.

1 Like

because you made it and shared it, doesnt mean you have to be there for everyone all the time :wink:

i will help out when it lies in my power anytime :wink:

i already stated it in my tutorial also, google is my friend with programming.

i learned that python programming is very well documented if you use google the right way.

searching for “python [ any commando ]” almost always gives the answer. and for sure when you know a commando in java, C or any other often used language.

Ok, I just finished part 2 and I have a question. Being that I’m actually at work and don’t have Python, or my HA install available, I’m going to ask first instead of try first.

There were 4 functions you talked about.
self.run_at_sunset
self.run_at_sunrise
self.sun_up
self.sun_down

I’m guessing that the two run_at functions are more to schedule events in the initialization function (although I guess they could be used to add something to the schedule later if you needed to), and the sun_up and sun_down functions test the current state of the sun. Here is where I have run into problems with HA. lets say I have a run_at_sundown callback that turns on the front porch lights. I reboot my HA and AppDaemon environments at 10:00 for some reason. Will the run_at_sundown event trigger it’s call back and turn the front porch light on, or will I need to have some type of reboot callback that checks the current state of the sun to handle that type of activity on a one time basis?

The run_at functions are a one shot callback. If you want it that way you need to have some kind of book keeping if you want that to work with reboots.

If you are after a reoccurring event you can use the run_daily, you can get the same behaviour only also with a repetition.

/R

there is a possibility to listen to events like “ha started”
at 10:00 the run at sundown wont start, but in the ha startup you could check the time and make actions according to that time.
andrew also did write an app to set the lights in the last known state.

Thanks,
The difference between run_once and run_daily is that run_once literally only runs once per reboot cycle at the time specified (even if that time is past so it waits till tomorrow), and run_daily runs at the same time every day. Is that right?

I’ve never used it, copy+paste from @aimc documentation: Run_once() - Run the callback once, at the specified time of day. If the time of day is in the past, the callback will occur on the next day.

@aimc has written some nice documentation with examples explaining all the different functionality, you can find it here https://github.com/home-assistant/appdaemon/blob/master/API.md#run_once

run once runs 1 time only at the time after the run once is called.
as an example:

you could make a run daily at 0:00 which has several run once in its callback. then you could make the time random.

so in an app like that you could make a light go on and off at random time and change that time every night at 0:00

yep, I’ve been using @almc’s documentation to get started.

1 Like