def initialize(self):
self.listen_state(self.object_controle, self.args["object_type"])
if self.args["time_gone_by"] == "true" or self.args["time_gone_by"] == "True":
time = datetime.time(0, 0, 0)
self.run_minutely(self.object_controle_minutely, time)
but it seems like it only happens when i start the app at ?:59 new.
and i seem to have another randomly occuring error that is bugging me, so if you dont see a problem in your code there may be something else happening here.
Yep, it was a wrong assumption on my part about how the Python date libraries work - I changed the technique I was using to add 1 minute to the base time to fix it.
Oh, I’m sorry, I should have mentioned if it actually fixed my problem lol Yes, it worked perfectly. Today alone I was able to replace 12 automations with only 4 appdaemon Apps!!
If I use dot notation, appdaemon will throw an error.
All of my apps are using forward slash notation, but I don’t know why I would have done that in the first place since the docs say otherwise.
I’m not sure if you wanted it as “service.servicename” or as “service/servicename”, however, the slash notation is in all my apps and works fine, but the API documentation still says to use dot notation, which does not work.
Correct - I changed it from “.” to “/” before I released v1.0, and I thought I had fixed the docs but I guess not Thanks for spotting that, I’ll fix it.
you know what i was trying to accomplish.
and i had it working
i made 2 apps.
1 to listen to minutes or to state change.
1 for general functions, which saved the times in different files that could be compared.
i made an commandlinesensor for all the objects i wanted to checkup on.
and after all the little bugs i had (some difficult to find) removed, i was satisfied.
it worked and finally without strange updates.
then i thought: havent i seen somthing about creating battery sensors automaticly?
i looked that up and started trying to make a custom component.
that would make it easier then creating lots of commandline sensors, dont you think?
i made something like the hello_state and i tried to update that component with your set_state (you know the problems i had with input_slider and template sensor)
and it works like charm.
so that gave me confidence to go on.
but i struggled.
i took a look at how template sensors are setup and tried to simplefy that.
i didnt get it working.
and suddenly there it was:
you dont need any sensor in the YAML!!
your set_state creates 1 and you can give it any name and platform you like and update it anyway you want.
off course you can set attributes to!
off course it is to bad from all my work, which i now can flush down the drain.
all you need is some code like this:
import appdaemon.appapi as appapi
import datetime
class objectcontrole(appapi.AppDaemon):
def initialize(self):
self.listen_state(self.object_controle, "input_boolean")
def object_controle(self, entity, attribute, old, new, kwargs):
update_time = datetime.datetime.now().strftime("%H:%M:%S")
self.set_state("controle_" + entity, state = update_time)
off course i can use small part from my work to save the time and compare it, so i can see time gone by.
but for now i’m starting to downsize again, because off you!
I am unable to use set_state on non existent entities. When I try to set_state on an entity that does not exist in Home Assistant, I get the following error:
2016-09-01 19:38:03,700 WARNING set_state: Entity battery_level.media_room_window not found in Home Assistant
** UPDATE **
Nevermind, not an issue… it gives a warning, but it still allows it to go through, so thats not a problem Thanks!!!
Based on how AppDaemon is working I would expect the warnings to stop after up to 10 minutes or so -0 can you confirm if that is the case? Either way I’ll look at a fix so that it warns you the first time but not after that.