Thanks for your time.
I have to use the 7h term because my sunrise plugin is pulling information from Vietnam.
There is an offset time of 7 h. Im trying to avoid that the light goes on at 4 a.m. german time.
BR,
Andre
[Solved] When sunrise then...
Thanks for your time.
I have to use the 7h term because my sunrise plugin is pulling information from Vietnam.
There is an offset time of 7 h. Im trying to avoid that the light goes on at 4 a.m. german time.
BR,
Andre
I got it:
When power of schlafzimmer is off and it is 7 hours after sunset then turn schlafzimmer on
Just remove the if in the when clause.
Why are you using Vietnam? :D`
Does Power
work? I´m using state
Yes it works. I also use it on my rules.
I think it depends on the device type. Milight devices have power and switches have state.
Seems legit but still not working. No errors showing up…
Thats how it looks now
{
"id": "led-leiste",
"name": "LED Leiste an",
"rule": "when led-stripe is turned off and it is 7 h after sunrise then turn led-stripe on",
"active": true,
"logging": true
},
{
"id": "led-leiste-aus",
"name": "LED Leiste aus",
"rule": "when led-stripe is turned on and it is 7 h after sunset then turn led-stripe off",
"active": true,
"logging": true
},
@michael-rudek said in When sunrise then...:
Why are you using Vietnam? :D`
DoesPower
work? I´m usingstate
I have to use it because I want to imitate all the climatic information from Vietnam (asian leaf turtle) into my vivarium.
If the sun rises in Vietnam at 7:06 am then the lamps should go on at the same time. I dont want to set the time manually. It has to be updated by the sunrise plugin.
Now the plugin shows a sunrise time from 00:09 a.m because my raspi is located in Germany. <- And thats why I have to add the 7H offset time.
Change
“rule”: “when led-stripe is turned off and it is 7 h after sunrise then turn led-stripe on”
to
“rule”: “when power of led-stripe is off and it is 7 h after sunrise then turn led-stripe on”
That works but is only triggered exactly in the moment when the 7h are gone.
Maybe you could calculate the moment and write it to a variable. The the rule triggers as long it’s later than variable.
@saxnpaule said in When sunrise then...:
Maybe you could calculate the moment and write it to a variable. The the rule triggers as long it’s later than variable.
I would need help doing so. But it sounds like this is the only way to solve my issues with the rules.
Have a look here: https://forum.pimatic.org/topic/3170/some-help-for-setting-variable
date() is what you’re looking for.
Try this:
When its 7 h after sunset then set $sunset-offset to date("hh:mm")
When power of schlafzimmer is off and it is after $sunset-offset then turn schlafzimmer on
@saxnpaule said in When sunrise then...:
Try this:
When its 7 h after sunset then set $sunset-offset to date("hh:mm")
When power of schlafzimmer is off and it is after $sunset-offset then turn schlafzimmer on
Wow, this seems to work!
I will try it now with my other rules and report.
Thanks for your help.
Best regards,
André
Hey all,
thanks for your efforts so far! Still locking good but further testing ongoing.
That´s the actual status:
"id": "led-leiste",
"name": "LED Leiste an",
"rule": "when state of LED-Stripe is off and it is after $sunrise-Offset and before $sunset-offset then turn led-stripe on",
"active": true,
"logging": true
},
{
"id": "tageslicht-aus",
"name": "Tageslicht aus",
"rule": "when state of Tageslicht is on and it is after $sunset-tageslicht then turn tageslicht off",
"active": true,
"logging": true
},
{
"id": "sunset-offset",
"name": "LED Sunset Offset",
"rule": "when it is 6 h before sunset then set $sunset-offset to date(\"hh:mm\")",
"active": true,
"logging": true
},
{
"id": "led-leiste-2",
"name": "LED Leiste aus",
"rule": "when state of LED-Stripe is on and it is after $sunset-offset then turn led-stripe off",
"active": true,
"logging": true
},
{
"id": "tageslicht_an",
"name": "Tageslicht an",
"rule": "when state of Tageslicht is off and it is after $sunrise-tageslicht and before $sunset-tageslicht then turn tageslicht on",
"active": true,
"logging": true
},
{
"id": "lucky_reptile_an",
"name": "Lucky Reptile an",
"rule": "when state of Lucky Reptile Jungle is off and it is after $sunrise-lucky and before $sunset-lucky then turn Lucky Reptile Jungle on",
"active": true,
"logging": true
},
{
"id": "lucky_reptile_aus",
"name": "Lucky Reptile aus",
"rule": "when state of Lucky Reptile Jungle is on and it is after $sunset-lucky then turn Lucky Reptile Jungle off",
"active": true,
"logging": true
},
{
"id": "sunrise-offset",
"name": "LED Sunrise Offset",
"rule": "when it is 6 h before sunrise then set $sunrise-Offset to date(\"hh:mm\")",
"active": true,
"logging": true
},
{
"id": "lucky-offset",
"name": "Lucky Sunrise Offset",
"rule": "when it is 1 h before sunrise then set $sunrise-lucky to date(\"hh:mm\")",
"active": true,
"logging": true
},
{
"id": "lucky-offset-2",
"name": "Lucky Sunset Offset",
"rule": "when it is 10 h before sunset then set $sunset-lucky to date(\"hh:mm\")",
"active": true,
"logging": true
},
{
"id": "tageslicht-offset",
"name": "Tageslicht Sunrise Offset",
"rule": "when it is 5 h before sunrise then set $sunrise-tageslicht to date(\"hh:mm\")",
"active": true,
"logging": true
},
{
"id": "tageslicht-sunset-offset",
"name": "Tageslicht Sunset Offset",
"rule": "when it is 7 h before sunset then set $sunset-tageslicht to date(\"hh:mm\")",
"active": true,
"logging": true
}
Hey Guys!
I would need your help again. Unfortunately its still not working correctly.
Please have a look at my offset variables. The date is set correctly.
Keep in mind that I changed my raspi location to asia - Hồ Chí Minh timezone. I had to do this because I want to display the correct sunrise and sunset time. -> Thats why im using the offset variable.
Here comes the actual issue. My rule to turn off LED-Stripe is not working because the variable $sunset-offset is set to 00:06 o clock. It´s quite difficult to explain -.- I´ll try to give you as many information as possible.
Please forget about the other rules. They are not correct. We are just talking about the Offset rules and LED rules.
Talking about the times:
Our target timezone is Ha Noi - Vietnam. They are 6 h later than German time.
When the sun rises in Vietnam (~6 a.m.) it´s 12 a.m. in Germany. Thats why I have to use the offset variable.
When the sun goes down in Vietnam (~6 p.m) it´s 00:06 a.m next day in Germany. <- I think this is the issue because Pimatic and the variable do not recognize that the date changed to the next day.
I would really appreciate your help! After getting this to work there is an other problem upcoming. I want to regulate the temperature based on the weather data from Ha Noi. I will run in issues because of the time again.
Would it be better to work with a database collecting all the weather data with time stamps?
Best regards,
André
@andre3000 said in [Solved] When sunrise then...:
When the sun goes down in Vietnam (~6 p.m) it´s 00:06 a.m next day in Germany. <- I think this is the issue because Pimatic and the variable do not recognize that the date changed to the next day.
Exactly this is the case. Before sunrise only works from 00:00 until sunrise and after sunset only works from sunset until 23:59.
Why don’t you change the locale or the time of your Raspi? Then you don’t need to calculate around.
@saxnpaule said in [Solved] When sunrise then...:
Why don’t you change the locale of your Raspi? Then you don’t need to calculate around.
You mean changing back to Germany? If I would do this, then the sunrise and sunset time would´t be displayed correctly.
It would be easier to calculate but it wont look good enough. I have to mention, that I will use a 5" display above the terrarium to show all the actual informations like sunrise,sunset, temp in vietnam, temp in terrarium usw.
Do you have any idea how to change the timezone in sunrise plugin without having to change raspi location?
BR,
André
I mean configuring the pi like it is located in Vietnam. Locale and timezone. Then you don’t need to calculate anything and sunset/sunrise will always match the Vietnam time.
And thats what I mean why it´s so difficult to explain :D
My raspi is actually set up like its located in Vietnam. But in Vietnam its now 7 p.m -> If I would not calculate the offset then the lights would already be turned off. -> But thats not what I want. It´s 1 p.m German Time… all the lights should be turned on.
@andre3000 said in [Solved] When sunrise then...:
My raspi is actually set up like its located in Vietnam. But in Vietnam its now 7 p.m -> If I would not calculate the offset then the lights would already be turned off. -> But thats not what I want. It´s 1 p.m German Time… all the lights should be turned on.
If I got this right, you want to simulate the hours of daylight in Vietnam, but you want use that at our local daylight time. I think that tricky. My first thoughts on this:
You need to calculate the number of daylight hours, minutes in Vietnam. Then you can switch as follows, for example:
Unfortunately, the device type provided with pimatic-sunrise does not provide for daylight hours and thus you need to calculate it yourself.
"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...:
My raspi is actually set up like its located in Vietnam. But in Vietnam its now 7 p.m -> If I would not calculate the offset then the lights would already be turned off. -> But thats not what I want. It´s 1 p.m German Time… all the lights should be turned on.
If I got this right, you want to simulate the hours of daylight in Vietnam, but you want use that at our local daylight time. I think that tricky. My first thoughts on this:
You need to calculate the number of daylight hours, minutes in Vietnam. Then you can switch as follows, for example:
- Turn on at sunrise (local time)
- Turn off at daylight hours, minutes in Vietnam after sunrise (local time)
Unfortunately, the device type provided with pimatic-sunrise does not provide for daylight hours and thus you need to calculate it yourself.
You go it it mate! That´s exactly what I want to do!
Any suggestions where I have to look for a possible solution? I´m an absolute beginner but always trying my best to figure it out by my own.
Best regards,
André
Is it not enough to set the sunrise plugin to Vietnam and use the local time?