Struggling with using device attribute to trigger a time event

I started out wanting to store values in Influx and my driver has evolved but I can't get it to work.
I want to take a device attribute (or even a device state) and use its value as a value in a rule.

Basically, I take a get from sunrise-sunset.org and store the twilight begin and ends values to an attribute.
In Rules, I want to run a daily scheduled rule that pulls my values and set porch lights to go on and off using these values.
Rules seems to only use Epoch but won't pull from a device attribute as far as I can tell. So I tried to write the attribute to global variables.
I read that you can store attributes into global variables with a rule but can't see how to accomplish that. Guidance? info on how to do it in my driver? thanks!

Are you using RM

In RM you would use the below value

Then you select your device and it's attribute for the comparison.

I know this doesn't address your question but your use case seems overly complex. I looked at sunrise-sunset.org for my area and twilight is mostly 25 minutes after sunset so wouldn't it be easier to set your rules to fire +25 minutes after sunset?

3 Likes

yep. easier.

I had previously explored that - only option is to compare it to something.

I want to trigger on the time I'm stored.
I was pursuing this but having problems writing my value to a hub global variable.

There is also a 'epoch' time option which i've been working at. I can form the variable correctly as milis from 1970, but cant' quite get it to write back into a hub variable. I might have to use a connector maybe?

I would suggest in your driver create a custom attribute that you change to a value. Then on a daily basis pull the times you need then when you do thay pull have the driver schedule a job to change the custom attibute to a value. That will give you a event to look for. Then just use RM to trigger off that atteibute change.

You should be able to schedule with a crom string