I’m trying to update the pimatic-sunrise plugin to support when its $variable before sunset. This is also a registered issue on GitHub (#901).

It’s still a work a progress, feel free to have a look at my varsupport branch.

In my code (line 148) I have added ‘at’ as a disambiguate word for the sunrise plugin. So if I use when at $variable before sunset, there is no ambiguity and my rule works. This is just a test and I would like the ‘at’ te be removed from the code eventually.

However, if I use its or it is instead of at I get an error from Pimatic “Next predicate of “its $variable before sunset” is ambiguous”.

Digging in I’ve found that it’s ambiguous for:

  1. Matching its $variable, leaving before sunset as a remainder to be parsed.
  2. Matching its $variable before sunset with no remainer.

[edit]
Did some more analysis and these are the overlaps I’ve found:
$variable minutes before sunset works
at $variable minutes before sunset works (with my addition of at)
its $variable minutes before sunset pimatic-cron also matches its $variable, ambiguous
10 minutes before sunset works
at 10 minutes before sunset also matches pimatic-cron, ambiguous
its 10 minutes before sunset works
[/edit]

Does anyone have a suggestion, other than using ‘at’, to resolve this ambiguity?

Kind regards,
Chris