AppDaemon Q&A

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.

i dont have Alexa, i think we will get google home in the future, but…
my wife gets annoyed enough that i speak to myself :wink:

1 Like

quick question, in the examples it always has “import appdaemon.appapi as appapi”
but in the API guide it has “import homeassistant.appapi as appapi”

Which is the correct one or do they both work?

the first (example) ones work.

Then I should put in a change for that file?

if you mean a change for the API then yeah :wink:

submitted a request to change the few places in the API.md that reference homeassistant.appapi

Thanks very much :slight_smile:

I’m trying to get the time passed since the last update of a sensor with the following code:
lsensor_time_since_updated = self.datetime() - self.convert_utc(self.get_state(self.light_sensor, "last_updated"))

Unfortunately, convert_utc seems to fail with:
lsensor_time_since_updated = self.datetime() - self.convert_utc(self.get_state(self.light_sensor, "last_updated"))

Any tips?

self.get_state(self.light_sensor, “last_updated”) gives probably a string.
and self.convert_utc() could need a time

i think you should look in that direction.

(didnt look anything up right now, API could tell you more)

Nope, the api says that the parameter is a string :-\

try self.log(self.get_state(self.light_sensor, “last_updated”) )
and see if in the log you get
An ISO 8601 encoded date and time string in the following format: 2016-07-13T14:24:02.040658-04:00

if not then thats the problem.

I am trying to handle weather underground alerts and I was not sure how such can be implemented when dealing with attributes and which are not guaranteed to exist all the time. Some more discussion is going on here in this thread

alias: "Weather Warning Tornado"
trigger:
  - platform: numeric_state
    entity_id: sensor.pws_alerts
    above: 1
condition:
   condition: or
   conditions:
     - condition: template
       value_template: '{{ states.sensor.pws_alerts.attributes.Description == "Tornado Warning" }}'
     - condition: template
       value_template: '{{ states.sensor.pws_alerts.attributes.Description_TOR == "Tornado Warning" }}'
action:
  service: script.weather_warning_tornado
1 Like

I’d be interested to see how you do this as it seems a better use case for AD than for traditional automation because of all the different alert condition types.

Let me know if you need help. I’ve been playing in AD lately with Weather Underground’s forecast data so I’m in the neighborhood so to speak.

1 Like

@turboc, thanks for the offer, let see how much good I can describe what I need.

I have AppDaemon app that listen to change on Weather Underground alert changes but want to filter those alerts to most critical one like tornado, hail etc but not like fog advisory as I have audio announcement using Google cast devices and definitely do not want to wake middle of the night just for fog alert but would like to for tornado.

sensor.pws_alerts is just number of active alerts but in order to get type of alerts looks like we need to check attributes but depending on the number of active alert the attribute(s) formulated differently as mentioned in the other discussion thread.

My goal is to notify via audio and text notifications on certain types of alerts but not all, I have notification code/app working but trying to figure out (need help) how to identify specific alerts which I am interested in. May be in future Weather Underground component alert sensor will have better way to see the alert types.

May be I can use hasattr() function to check presence of each possible values like Description_TOR, Description_SEW?

Thanks all

1 Like