@andre3000 said in [Solved] When sunrise then...:
Is that right?
Yes, exactly
[Solved] When sunrise then...
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig Thanks! Now I managed to set the german location in my raspi config and still see the Vietnam time zone in Pimatic! Thats a great step forward.
Sorry, I have to revise my reply! The plugin shows now the german sunrise time.
EDIT: I reloaded everything and now it looks like this:
Sunrise Vietnam and Sunset Vietnam are set correctly but in German time
@andre3000 That’s great.
Note, daylight hours in Ho Chi Minh vary only between 11:30 and 12:45 hours throughout the year. Does one hour 15 minutes already make a big difference for the given habitat? Wouldn’t it be simpler to use an average of 12 hours a day?
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
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.
Are there any other ideas we could try?
Just a quick summary:
LED-Stripe has to be turned on between sunrise and sunset
Tageslicht has to be turned on 2h after sunrise and turned off 2h before sunset
Spot has to be turned on 5h after sunrise and turned off 4h before sunset
Sunset and Sunrise time has to be displayed correctly.
I appreciate any help.
Best regards,
André
I think its a bit late but sorry for my English
@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.
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
Another thing to consider: While I am not an expert on reptiles, I can image the daylight savings might be an issue, i.e. when we switch to summer time and back to normal time. In this case the lightning cycle is shifted by one hour from one day to the other which is no natural, of course, and might impact the reptile. So, may be you need a more calculation to normalize the sunDown time accordingly.
EDIT: Another strategy might be the following: Simply use Vietnam sunrise and sunset times as if they were at local time. This way, the light will be switched on before sunrise, but that would never be fore 6:00 am as this is the earliest sunrise time for Vietnam. You may also want to normalize the time for this strategy to ignore daylight savings.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig said in [Solved] When sunrise then...:
Another thing to consider: While I am not an expert on reptiles, I can image the daylight savings might be an issue, i.e. when we switch to summer time and back to normal time. In this case the lightning cycle is shifted by one hour from one day to the other which is no natural, of course, and might impact the reptile. So, may be you need a more calculation to normalize the sunDown time accordingly.
EDIT: Another strategy might be the following: Simply use Vietnam sunrise and sunset times as if they were at local time. This way, the light will be switched on before sunrise, but that would never be fore 6:00 am as this is the earliest sunrise time for Vietnam. You may also want to normalize the time for this strategy to ignore daylight savings.
Now you lost me…
But you are right with the daylight savings! We cant put so much effort in this project because of 1 h and 15
and then totally forget the daylight savings. Oo
So finally what do you recommend?
@andre3000 said in [Solved] When sunrise then...:
So finally what do you recommend?
Well, I came to conclusion that daylight savings is not an issue as
So, the solution I have drafted in my earlier post should work fine if it is OK for you to let the reptile’s artificial day start at local.sunrise which has a higher variation between summer and winter than it is in Vietnam.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
It´s so frustrating -.- The rule still not working.
There is no error message but the rule is not applied at all.
I can switch the state to on and off.
The ideal solution would be that the raspi is located in Germany but the sunrise devise should show the correct vietnam time.
Any other ideas? I could offer direct access to my machine via TeamViewer, if someone wants to have a deeper look.
Best regards,
André
EDIT:
Would it be a possible solution if we store weather data with time stamps in a table and then use this data with pimatic?
@mwittig said in [Solved] When sunrise then...:
@andre3000 Rather than just using the builtin events which are tied to the timezone set on the operating system, You can create a
SunriseDevice
with the geo coordinates in question. Additionally make sure to configure sunset and sunrise attributes on the device as part of the devise configuration. Say, you device is called “vietnam” you should be able to use “vietnam.sunrise” and “vietnam.sunset” as part of rules. It is still somewhat tricky to calculate the daylight hours, minutes. I may come back to you later with a proposal
I read again trough all your posts and wanted to try this a second time. Unfortunately this feature is not working for me. The Plugin has German GPS data configured and the new device has vietnam gps data. But the plugin still recognizes the german location of my raspi and do not apply this setting.
@andre3000 said in [Solved] When sunrise then...:
I read again trough all your posts and wanted to try this a second time. Unfortunately this feature is not working for me. The Plugin has German GPS data configured and the new device has vietnam gps data. But the plugin still recognizes the german location of my raspi and do not apply this setting.
Ok, so far, I have only tested certain aspects of the setup, like calculating Vietnam daylight hours and the calculation of the switch-off time for the lights. I haven’t tested using these calculation to actually switch the light with a rule. I’ll create a a full demo setup to check it is working as intended and then we can work it from there according to your needs.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
@mwittig said in [Solved] When sunrise then...:
@andre3000 said in [Solved] When sunrise then...:
I read again trough all your posts and wanted to try this a second time. Unfortunately this feature is not working for me. The Plugin has German GPS data configured and the new device has vietnam gps data. But the plugin still recognizes the german location of my raspi and do not apply this setting.
Ok, so far, I have only tested certain aspects of the setup, like calculating Vietnam daylight hours and the calculation of the switch-off time for the lights. I haven’t tested using these calculation to actually switch the light with a rule. I’ll create a a full demo setup to check it is working as intended and then we can work it from there according to your needs.
That´s fantastic, thank you
Note, there is a new version pimatic-sunrise which allows for setting a timezone
property on a SunriseDevice
to transform the times from the given timezone to the local timezone while ignoring the timezone offsets as shown in the example below.
{
"latitude": 10.7659164,
"longitude": 106.4034617,
"timezone": "Asia/Ho Chi Minh",
"attributes": [
{
"name": "sunrise",
"label": "Sunrise"
},
{
"name": "sunset",
"label": "Sunset"
}
],
"id": "vietnam",
"name": "Vietnam/Ho Chi Minh",
"class": "SunriseDevice"
}
Note, all times will be given in the local time zone of the system on which pimatic is installed. If you wish to obtain the times in the local timezone of the location at given coordinates you can additionally set the timezone
property to the appropriate timezone. This will transform the times to the
given timezone and will cut off the timezone offsets before converting the resulting times to the localized time string. For a list of valid “TZ” timezone strings, see Wikipedia - List of Timezones. If the timezone
property is absent or set to an empty string no transformation will be performed.
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Hi and thanks for your time so far!
I tried to implement this new feature in my config but this is all I get:
error [pimatic]: Invalid config of device “vietnam”: Property “timezone” is not a valid property
I already updated my sunrise plugin and created a completely new device for this scenario.
{
"latitude": 21.028511,
"longitude": 105.804817,
"timezone": "Asia/Ho_Chi_Minh",
"attributes": [
{
"name": "sunrise",
"label": "Sunrise"
},
{
"name": "sunset",
"label": "Sunset"
}
],
"id": "vietnam",
"name": "Vietnam",
"class": "SunriseDevice"
}
Any ideas?
Best regards,
André
@andre3000 said in [Solved] When sunrise then...:
I already updated my sunrise plugin and created a completely new device for this scenario.
Did you restart pimatic after the plugin update?
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
Now I restarted everything and its working fine!
I´m so happy right now! This is a huge improvement and brings me a big step forward to a smart terrarium.
Now there is still the “issue” with the temperature day/night cycle. I have to go deeper with @mwittig to discuss further steps.
Thank you all and have a good start into this week.
BR,
André
My turtle can´t wait to see the new terrarium