@andre3000 said in [Solved] When sunrise then...:
It was my own goal to imitate the natural habitat of my turtle as closely as possible and the daylight is an important part of it. If it is not possible to reach my target with a reasonable effort, I would have to rethink my setup.
No worries. I was just wondering.
I have no experience with reptiles at all
Please try the following. It’s perhaps not perfect, but it should work under the assumption that the local sunrise time plus Ho Chi Minh daylight hours offset is before midnight local time. This is the case for Germany, at least.
Setup two SunriseDevices, one with the coords for Ho Chi Minh and one with the coords for your home town. I have named these devices “vietnam” and “local” in my example. Please change names to what you prefer. Now you can do the following to switch off the light.
WHEN its "{timeFormat(timeDecimal($local.sunrise) + timeDecimal($vietnam.sunset) - timeDecimal($vietnam.sunrise))}"
THEN turn tageslicht off
EDIT: My assumption is that it is OK to switch on the light at “local.sunrise” and let the artificial day last for Vietnam daylight hours. Hence switching on the light is as follows:
WHEN its sunrise
THEN turn tageslicht on
If you prefer to have a variable for the switch off time you’ll need a rule to update it as variable are not updated automatically per se.
- Define a variable, for example “sunDown” and set it to some default value, say “18:00:00”
- Now create a rule as follows:
WHEN its sunrise
THEN set $sunDown to "{timeFormat(timeDecimal($local.sunrise) + timeDecimal($vietnam.sunset) - timeDecimal($vietnam.sunrise))}"
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law