So it should be "or" instead of "and"
making
door sensor = open and (Time > Sunset or Time < Sunrise)
btw on a sidenote when using the abstractions time and sunset, from a logic point of view it is totally correct to use "AND". Time does not reset at 00:00 (this is not groundhog day) just like 1+99 does not reset to 00 but result in 100, and in case of time representation the 1 in 100 is a brand new day!
That the abstraction translation and representation to actual numbers (like sunset to 06:34 AM, time to 03:22 AM stripping the day carrier) make things difficult and the ambiguous of how time is defined more so if you are not a programmer: does time include days, months and years or time for just one day. There in lies the problem.
Logically speaking: Sun is Down = Time < Sunrise and Time > Sunset
But yeah then time, it's all bout the forgotten days...
Time, abstractions and logic, all funny stuff...