Hello -
If you are doing this at the Agent level, I’m curious why not query a web API to do give the sunrise/sunset time?
When you run this is sunrise working right? Just trying to confirm that you know the problem is in the last portion of your code.