Hey!
I just can’t seem to make this work in a automation, I simply want a automation to have the condition (or trigger) that a motion sensor (mysensors) has/has not been activated within a certain amount of time etc:
If I put this in the template validator (if that is what it’s called) it returns a True or False, so it seems to work, but it doesn’t work once run on the automation, nothing happens, no matter the values. Triggering the automation manually works of course. After searching online I’ve seen some having issues with this (as_timestamp(now())- etc etc), is there any alternative way to go about this? I just feel like having this condition for the motionsensor would simplify things so much in the house without using scripts with delays etc…
Is AppDaemon a alternative maybe that would work @ReneTode? (mentioning you since you are so active with it )
Thank for any help, I don’t know what else to try after all the troubleshooting…
yeah, you could use appdaemon also for this, but i cant say why this wont work.
i see you have a condition, but i dont see a trigger.
i would say make a template sensor that gives true or false and then make an automation based on that.
in appdaemon you would need the same or you would need an app with run_minutely
the callback function would take 2 lines i think.
Hey!
That was just an extract of the condition itself, I didn’t add the entire automation in the post, but the trigger is the motion sensor.
Also I’m not sure why it doesn’t work in the automation since it works when verifying it in the template validator, it returns true or false depending on the elapsed time value on it…and the automation can be triggered manually and it works that way, it’s quite frustrating for something so simple thats why I would even want to try Appdaemon, but don’t know how/what to write code-wise for it.
I tried creating a template sensor too, but don’t know if I did it correctly, how should that be done as you describe? I’ll try researching template sensors some more when I get home too.
Also for future reference realize that there is a difference between “True” and “true”. Seems obvious but we’ve all been tripped up by this one - myself included.
@ReneTode hey, either I totally don’t get this or something is off, I’ve tried a few variations but it never works properly, I’ve tried a few combos back and forth, using other motion sensors as trigger, after a certain time etc, and while the template validate on hass frontend shows that it’s correct and return right values/states it just doesn’t work in the automation
the first automation only gets triggered at 18:00:00 exactly, but only when the sensor isnt updated for that long.
Yes, but it should work if those conditions are met, right? But it doesn’t… It was just one of the tests, in this case with a specific time…
the trigger is the moment that your condition is checked.
so you need something like “every minute” in your trigger
Yes, I tried that too, with every 5 minutes, every 15 minutes or every minute, as a trigger, since I use that as a trigger for other automations, but it still doesn’t work
but you have a working testsensor, which gives on or off based on your test.
so make that your trigger.
so take your second automation. replace the motion sensor with your template sensor and lose the condition.
Yes, I did make that as a test too, making basically a time condition (before: after: time condition) instead, still not working.
But thanks for your time trying to help, I’ll see if I can try some more, otherwise I’ll skip it all for now.