Appdaemon lightschedule

maybe that @aimc would think about that :wink:

You are correct but I’m not renaming it this late in the game - it will break stuff :wink: Maybe I will deprectae it and add the new name or something.

LOL, As long as I understand, you can call it foo. LOL

1 Like

You could start with being more explicit in the documentation, that would go a long way. :slight_smile:

hmm, yeah, didnt think about that :wink:
dont change it or deprecate, that means work for me :stuck_out_tongue:
just adding a comment to the docs should be enough :wink:

1 Like

I only learn about AppDaemon now. But it seems like the thing I would want to try next.

If I have time, I will look into creating the lightschedule based on a GoogleDocs spreadsheet, or a dedicated GoogleCalendar.
Like this you could update the times online in realtime without restarting anything. Just have another timer to recheck the configuration every couple of minutes or so.

then everything should be taken out of the initialize.
because the init is only restarted when you change something in the app. the cfg or restart appdaemon.

i guess it would be possible to make an app that checks the file once in a while and then take the complete init to a callback.
but then you also need to store and cancel all timer handles, before a reinitialize.

it might be an idea to store the complete file in a dict and then once in a while compare the dict with the file.
and then only cancel the changed handle and restart it, or cancel a deleted handle, or add a handle.

i keep everything local, but it would be nice if i dont have to restart after an update from the file.
on the other hand, how often would i edit the file if it is allright? so is it worth the trouble?

The google calendar component already returns an on/off based on whether there is a current event. The message attribute contains a text field. You can also show multiple calendars by sharing them on google with your main account. I have a calendar for each of my kids and I see them all on my HA page. So when an calendar meeting or event starts, it should kick off a HA event to set the flag calendar component to on for that calendar. That could trigger an event in AD causing you to turn on/off whatever lights are in the message, or have a calendar based on each room kind of a thing. I’m thinking about implementing that for my kids to use to set their alarm clocks instead of having to use the input sliders to set time.

Yeah, i would indeed create a shadow copy locally and only update the changed times. You can use pickle to quickly save and restore files.
My problem is not really that I need to restart something if it changes, but I think it’s much easier to teach my fiancee to update a google document or calendar than ssh’ing into the pi and restarting the appdaemon or home-assistant :wink:

EDIT: I just thought, then I could probably even create a simple google form to generate the timers.

i dont want my wife to start changing automations. or anyone in my home.
they can tell me if something isnt like they wish, but after the startup the automations shouldnt be changed anymore at all.

my wife can actively change the lights, the thermostat, the radio, etc. and if she Always does that on the same time i make it automated for her.
letting more people change automations is setting you up for failure.

yeah, you could do it like turboc suggest. but if internet fails, your automation fails to.

i dont ssh at all. appdaemon and hass are visible on the rpi monitor and can be restarted by an icon.
and the lightsetting file is just a spreadsheet that can be changed in a spreadsheet program.
(but i dont see the need to tell my wife where that is :wink: )

True,
But everyone’s world is a little different and their families have differing degrees of technological capabilities. On of my kids (19 years old) I would never think of giving the ability to adjust automations through anything more complicated than a tablet and a web page. His 21 year old brother, is a completely different story. He understands computers and programming so I’m more comfortable with him looking at the automations at a lower level. It all depends on the degree of automation, what you have automated, and the ability/patience of the person in question.

thats right.
I let my wife look at the file when i am there.
i show it her so he understands what is goin on. and the way i made it she probably could change it also.
but who would like several captians on the ship?
1 person should keep the overview of what is goin on all the time, or you get problems.

@ReneTode I got the file but I think its old and needs updating not working?? Are there any changes? What do I need to do I get the app seen but all changes are not working inside of appdaemon.

in 11 months appdaemon has changed a lot.
but the biggest change is that the config is now yaml.

so in apps.yaml it should look like

lights:
module: lights
class: switches
settingsfile: /yourpath/lichtschema.csv

i havent used this in a long time now, because in yaml things were a bit more easy to configure.

How do you do that? I would love to implement that in my HA. I can restart HA via script.

you can also restart AD from HA
you can create a switch like this:

  - platform: command_line
    switches:
      appdaemon:
        command_on: "sudo /home/pi/appdaemon.shl"
        command_off: "sudo /home/pi/appdaemon_kill.shl"

and then in those scripts you start and close AD
but if you use AD as a service you could also use the start and stop service command for AD.

Hey! Why you killing AppDaemon??? :cry:

2 Likes

lol.

i actually never use it :wink:
i created it to reinitialise from far away before i was going on holiday.
lets hope i never have to use it :wink:

1 Like

ROTFL :rofl: That’s good one. AppDaemon works great. I was just curious to see if I can see AppDaemon process status on HA.

1 Like

Like this

1 Like