any idea when the next release of AD is going to come out. That terminate thing every time I have an error is killing me. LOL
I am planning a release for the weekend But it will require Home Assistant v0.34 or later as I am moving from SSE to Websockets.
I could not figure out how to call service with data needed for html5 notification.
Can I pass string for data or do I need json object?
This is what it should be: (and if I use this in HA developer tool -> service, it works as expected)
{
"message": "Anne has arrived home",
"data": {
"actions": [
{
"action": "open",
"icon": "/static/icons/favicon-192x192.png",
"title": "Open Home Assistant"
},
{
"action": "open_door",
"title": "Open door"
}
]
}
}
I have tried so far but it is not sending notification
msgStr = "Test html5 notification actions"
dataStr = '"data": {"actions": [{"title": "Action1", "action": "open"},{"title": "Action2", "action": "close"}]}'
or
dataStr = '"data": {"actions": {"title": "Action1", "action": "open"}}'
self.call_service("notify/chrome", message = msgStr, data = dataStr)
When I tried with following code it did send notification but did not show action button
mydata = {}
mydata["data"] = {}
mydata["data"]["actions"] = {}
mydata["data"]["actions"]["action"] = "open"
mydata["data"]["actions"]["title"] = "Action1"
self.call_service("notify/chrome", message = msgStr, data = mydata)
Here is the link to HTML5 component documentation:
Here are the relevant lines I use for HTML5 (including custom actions):
actionData={"entityName":"{}".format(entity),"entityType":"{}".format(self.entityType), "secureAction":"{}".format(self.secureAction), "actions": [ {"action": "manual_action", "title": "Secure {}".format(self.friendlyEntityType).title() } ] }
self.call_service("notify/notifyall", message=msg, data=actionData)
Here is a bit more detail on my use:
Perfect, this helped me a lot. Looks like I was trying to pass as string and was not working but in your example you have as object and once I did this it started working:
actionData={"actions": [ {"action": "manual_action", "title": "Secure {}".format(self.friendlyEntityType).title() } ] }
By the way I am handling the notification events also in AppDaemon using event listeners like this: (still WIP)
self.listen_event(self.html5_notification_events, "html5_notification.received")
self.listen_event(self.html5_notification_events, "html5_notification.clicked")
self.listen_event(self.html5_notification_events, "html5_notification.closed")
def html5_notification_events(self, event_name, data, kwargs):
try:
self.log("Event data: " + event_name + ", " + str(data))
except Exception as e:
msgStr = "Exception:html5_notification_events(): " + str(e)
self.log(msgStr)
You know i cant follow updates like that?
still 0.28.2 here for a reason!,
i will try an update to the newest release next week but if it fails i need to hang on to this version. So please wait till i can be sure that i am ab,e to follow.
(I won . E mad if you dont wait)
edit bad tablet
Well this is terrible news! I will immediately delay all AppDaemon development until I know you have successfully upgraded!
I was half worried that this might be the case anyway, not just you Rene, but others as well. I’ll take a look if I can add code that works for both for a while.
EDIT: Done. The next version will work with SSE or Websockets depending on your version of Home Assistant.
Thank Andrew. I know it was a lot of work, but I know people would hate to have to stop using AD.
Ooohh. Thanks for this. Didn’t realize those listeners were available!
Assuming that means it won’t be this weekend. Can you sneak out a release that fixes the terminate issue on errors or at least post the changes to fix it so we can fix that locally? It’s really killing me. I’m working on testing out and learning to work with google calendar and improving my snmp printer app, and the learning process creates quite a few errors. So I’m having to restart AD every time I edit the code just about.
That is not a safe assumption
I am very well waiting for Websockets version, as if you remember I have/had lots of issue of AD getting disconnected and everything stops working, TIMEOUT parameter for SSEClient didn’t help much either for me so I have heartbeat app which checks connected clients every minute if it’s zero then call another python app to recycles AD.
Great work on this AD, appreciate it and thank you so much.
The HA component which gives me connected client is documented here: (Assuming you have only one app AD running)
Yes - this is one reason I was keen to upgrade to Websockets as it seems simpler and hopefully more reliable - we’ll see!
I can fire up another instance of AD for testing once you ready with websockets update, no rush though take your time.
Thanks
Ok need some help with the example code for motion_lights.py
How do you get it to cancel the timer so it doesn’t just turn off ever specified triggered time after say 1 minute with the results on-off-on-off.
So that the light stays on as long as motion keeps triggering it.
I took a quick look and found a bug in the code.
If you change line 44 to this:
self.handle = self.run_in(self.light_off, delay)
It should behave better.
Yes! That worked like a charm. Was that Porch a relic from your system? Thanks for this App it’s awesome.
@aimc
Is the MiniMote code from Zwave running on a Zwave stick direct to HA or passed via Vera?
Yes, I guess I wrote this for my porch then generalized it
I wrote the minimote code using a ZWave stick - I am not sure how the integration with Vera works so I am not sure if it will work the same or not. If you have a minimote hooked up to a vera you can find out by pressing buttons and checking the HA log for which events are generated.
Just getting this installed.
I created folders in /.homeassistant to hold my apps and .cfg file.
/.homeassistant/appdaemon/apps
I directed the .cfg file to the apps folder and can start it all fine with:
appdaemon -c /home/homeassistant/.homeassistant/appdaemon/appdaemon.cfg
I get the Hello World message to load fine.
Unfortunately, I can’t get the systemd script to work. I edited the file like this and then moved it to /etc/systemd/system
[Unit]
Description=AppDaemon service for Home Assistant
[Service]
ExecStart=/usr/local/bin/appdaemon -c /home/homeassistant/.homeassistant/appdaemon/appdaemon.cfg
[Install]
WantedBy=multi-user.target
however, when I try to execute
systemd enable appdaemon
I get: “Excess Arguments”
This is on a AIO Raspberry Pi 3
Any ideas?