Thank, just when someone arrives at home
You can use the device tracker group for that:
class Presence(appapi.AppDaemon):
def initialize(self):
self.listen_state(self.someone_home, "group.all_devices", old = "not_home", new = "home")
def someone_home(self, entity, attribute, old, new, kwargs):
# This gets executed when the first person gets into an empty house
Thank you very much
Okay, so I am going to be the odd one here, I think.
I didn’t want to set this up on my RPi as it is running HA of course and I didn’t want to risk messing things up. So I installed HA, OZW and OZWCP on a Linux Mint machine then installed AppDaemon. Everything seemed to go well. HA is installed in /opt/homeassistant. So when I edited the appdaemon.cfg I set the following:
ha_url = http://myipaddress:8123
app_dir = /opt/homeassistant
I set the Lat. and Lon. and TimeZone but then tried running the appdaemon -c appdaemon.cfg command and it seems to stall. I saw the Got initial state, the app initialization complete messages, but then it just sits there. When I CTRL +C out I see a warning “Not connected to Home Assistant”.
I can run HA and get to the front end without issue, I have also started and ran OZWCP so all of that seems fine. Any ideas where I can start looking?
there are no apps in your homeassistant dir.
you need a dir where you put your apps in.
when no apps are there, appdaemon just initializes and because you didnt tell it to do anything, it will not do anything.
as soon as you use ctrl+c you disconnect from hass, so thats all just normal behaviour.
so the only thing i can say is:
congratulations, you have installed appdaemon correct, now give it something to do
LOL
Okay, well the documentation said to run appdaemon -c appdaemon.cfg so that it would run the already provided hello world program so as to confirm appdaemon was installed correctly.
And if that program is correctly in the apps directory, you should see the entry in the appdaemon logs
2016-11-28 22:13:17.404122 INFO AppDaemon Version 1.3.6 starting
2016-11-28 22:13:22.864944 INFO Got initial state
2016-11-28 22:13:22.866142 INFO Loading Module: /home/pi/appdaemon/conf/apps/hello.py
2016-11-28 22:13:22.868694 INFO Loading Object hello_world using class HelloWorld from module hello
2016-11-28 22:13:22.869751 INFO Waiting for App initialization: 1 remaining
2016-11-28 22:13:22.870307 INFO hello_world: Hello from AppDaemon
2016-11-28 22:13:22.870716 INFO hello_world: You are now ready to run Apps!
2016-11-28 22:13:23.871689 INFO App initialization complete
Okay, I guess that was where I was a little unclear in how to check the logs. I need to get adapted to this way as it seems a much better way to do thing over using Yaml, I just know next to nothing about Python. I bought a course for it once but then got side tracked by other certifications I needed for work and never got back to it.
@ReneTode Thank you for that link, I will be reading it as I sit here at work. Getting paid to educate myself, LOL.
let me know if it did help you. feedback can help me making the next few lessons even better.
Absolutely will do.
I do have one suggestion, if I may. The blue highlights, those are hard to read. It obscures the black text quite a bit, maybe a faint green or continue with the yellow highlighter. Just a suggestion.
thx i look into that.
guess that depends on how the pc or other device gives the colors.
Did you ever figure out the problem with it chopping off the end of what it’s saying?
yeah that problem is gone.
dont know what was the solution though.
i edited the code so much for so many reasons that dont know now what caused that problem.
it was something with timing. and processes running together
bummer,
I got back to it today and got it working with a fire_event message. Now the client just fires the event and the component catches it and pushes it into the file queue like before.
maybe you should check out the topic i made for it.
could be helpfull to see how i got it going right.
homeassistant is speaking to me now all the time without problems.
it tells me when someone is ringing the doorbell, app errors, nice things for my wife, and more.
i even bought a new cheap speaker for it, but that shuts off when it is quiet for 10 minutes.
now i send a very small signal to the speaker every 9 minutes and it keeps on running.
do you have a link to the topic?
I just had HA tell Alexa to turn on my stairway light switch. LOL Does that mean that HA is talking to itself now.