i really dont understand why people like to change their lights at random times.
it could be implemented but i like you to give that a try yourself.
setting dimmer percentage in an automation would make sense in combination with sunset or a lightsensor i guess, but i have no way to test that out, so i am sorry i cant give you that.
yeah, you need to restart the app. and for that you have 3 options right now:
restart appdaemon
edit the app (add a comment with the date from your file update for instance)
edit the cfg (make an entry in the light app section with the lastchanged date for instance)
in all 3 cases all old schedules are removed.
i use(d) input_booleans for 433 mhz switches with a mysensors remote.
now they are switches because i made a custom component from it.
and last: i have no idea what you mean with dynamic sensor creator.
Thanks for following up. Random is so I can use it for when traveling and want to deviate from a set schedule. I think I have a few ideas on how to build on your code to add it. I’ll give it a try. I also want to add overrides so I can pause a schedule if needed.
The “dynamic sensor” is a reference to a post you had in the appdaemon Q&A thread. I was wondering if it is possible to use appdaemon to create entities on the fly and configure them without putting them in HA config files.
if you normally have a set schedule running and set a random when you are traveling, you tell everyone that you are not home
but if it is for that case you can add
random_start = -300, random_end = 300
to the run_at_sunrise, run_at_sunset and run_daily lines.
you could also make an input boolean in hass, which sets random on and on.
in that case use get_state to know if it is on and if it is on set the value to a specific amount, else to 1 (i dont know if random 0 would give a problem, thats why i say 1)
i didnt implement overrides because you can use callback constraints inputboolean in the cfg file.
yeah you can create an entity on the fly.
and you can change that value anytime you like.
just use setstate(“your_own_domain.your_sensor_name”)
the first time it will be created and after that updated.
i havent been able to create attributes for it though.
and setting states from existing entities still isnt working like expected.
I made the adjustments to allow for overrides. I’m new to Python, so if I’m wrong I apologize, but I think I found a bug or am misunderstanding the logic.
The spreadsheet shows something like “sunset + 00:59:55”. When the code splits this value based on “:” and then references int(sunsetparts[1]) to create the offset, it looks like the “+ or -” is lost and just the 59 is picked up. When you set the offset in the call run_at_sunset it will offset by 59 seconds (offset value is in seconds). I’m not sure if this is what is intended. Does the code match up with the spreadsheet or has the format of the spreadsheet changed?
I’ll take a look. That’s probably what I need to do and keep the lightschedule simple.
BTW, is there like an “App Store” where all these ideas are posted and maintained? HASS has the examples, but I don’t see anything where Appdaemon is highlighted or a repository. I’m just picking up Appdaemon in the last 24 hours, just searching in the forum.
Thank you for all the great work. I hope to have all my scripts\automation ported to Appdaemon today.
Ok, just to make it a little clearer for me, you know I’m kind of dense. Because run_at_sunset actually kicks off a listen_state(callback, “sun.sunset”), the listen state makes it so I don’t have to re-schedule it every day. Run_at_sunset is equivalent to run_daily(callback,self.sunset) (but with the sunset time corrected every day). Right???
i thought so to, but andrew told me that the time gets calculated inside appdaemon, but that he is using the same calculation as hass.
but the effect is the same.
the difference between run_at_sunset and run_daily(callback,self.sunset) is this:
run_at sunset will always be triggered at sunset.
run_daily(callback,self.sunset) would take the time that sunset is on the time the app is initialized. and then run at that time daily.