@sweebee Sorry i can’t get the 24 hour format to work. I also don’t know why the pimatic-sunset-plugin can’t be used for the GUI interface? https://github.com/pimatic/pimatic/issues/479
-
Sunrise and Sunset device via shellsensor plugin
-
Hey folks,
the script doesnt work anymore.This XML file does not appear to have any style information associated with it. The document tree is shown below. <yahoo:error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xml:lang="en-US" yahoo:uri="http://yahoo.com"> <yahoo:description> Please provide valid credentials. OAuth oauth_problem="OST_OAUTH_PARAMETER_ABSENT_ERROR", realm="yahooapis.com" </yahoo:description> <yahoo:detail> Please provide valid credentials. OAuth oauth_problem="OST_OAUTH_PARAMETER_ABSENT_ERROR", realm="yahooapis.com" </yahoo:detail> </yahoo:error> '''
pimatic + MySensors + Homeduino + z-way
https://github.com/n3roGit/MySensors_n3ro -
yes, this is not working since yahoo changed api and other codework.
there’s no “global” solution available yet.our devs are still on checking v0.9.
this issue here is on the improvement list but guess this will be arranged after v0.9 is out.pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
Unfortunately Yahoo disabled the API access, requiring OAuth authorization now.
There is another link returning an XML file with the data. Maybe someone could adapt the awk command (I’m not that experienced in that).
This is the URI: https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=[ID]
(courtesy of https://forum.rainmeter.net/viewtopic.php?f=13&t=23010) -
doesn’t make any sense to set on yahoo anymore if you ask me.
even if there are some loopholes in their api, they will surely fix them soon.pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
I guess you’re right. Well, I made the switch to Sunwait (https://www.risacher.org/sunwait) which makes it independent from Yahoo.
-
@sebster6 said:
https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=[ID]
´´´
sunrise=$(curl -s https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=[ID]| grep astronomy | awk -F" ‘{print $2 “\n” $48;}’ |{ date -f - +%R; })
sunset=$(curl -s https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid=[ID]| grep astronomy | awk -F" ‘{print $2 “\n” $50;}’ |{ date -f - +%R; })
´´´This is wirking but not very well
pimatic + MySensors + Homeduino + z-way
https://github.com/n3roGit/MySensors_n3ro -
Just to bridging the gaps until the extended version of pimatic-sunrise is ready, I have implemented a simple command line tool based on suncalc. Actually the tool is a fork from another project. Thus, my code is not availble as a npmjs package, but it can be installed via the npm tool if you have git installed. See README
suncalc-cli -v sunset -l 52.5072111,13.1449592,10 -d tomorrow Sat Apr 16 2016 20:08:35 GMT+0200 (Mitteleuropäische Sommerzeit)
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
Hi, a new version of pimatic-sunrise is available which contains a
SunriseDevice
. See README for details."It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
Great work. It works fine.
How often does it refresh? Once a day? -
thx @mwittig for that very very nice extension of the sunrise plugin!
it’s working fine for me!pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
@leader21 Welcome. It’s great, it is working fine for you! As we already discussed on chat you may experience a derivation of suntimes by a few minutes (3 minutes in my case) when compared to data from weather sites. This is due to the following reasons:
- The weather site may use data from another location than the one you have set
- Suncalc is less accurate than it could be (rounding errors may occur) - see also https://github.com/mourner/suncalc/issues/57
"It always takes longer than you expect, even when you take into account Hofstadter's Law.", Hofstadter's Law
-
yes i experienced appr. 5 minutes differences. but that does not matter anyways.
allright guys - go ahead and use this new device for your needs
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
That’s the way I like, perfekt work for me!
A few minutes difference don’t matter for me, more difference in light is from the weather itself -
OK why parse an xml and make your system dependend from another source?
Try this. Create an php make it executable and then you are on your own system without external sources.
#!/usr/bin/php
<?php
$zenith=90+50/60;
$lat = 52.19;
$long = 10.33;function calcSunPos( $iYear, $iMonth, $iDay, $dHours, $dMinutes, $dSeconds, $dLongitude, $dLatitude){
$sunpos; $pi = 3.14159265358979323846; $twopi = (2*$pi); $rad = ($pi/180); $dEarthMeanRadius = 6371.01; // In km $dAstronomicalUnit = 149597890; // In km // Calculate difference in days between the current Julian Day // and JD 2451545.0, which is noon 1 January 2000 Universal Time // Calculate time of the day in UT decimal hours $dDecimalHours = floatval($dHours) + (floatval($dMinutes) + floatval($dSeconds) / 60.0 ) / 60.0; // Calculate current Julian Day $iYfrom2000 = $iYear;//expects now as YY ; $iA= (14 - ($iMonth)) / 12; $iM= ($iMonth) + 12 * $iA -3; $liAux3=(153 * $iM + 2)/5; $liAux4= 365 * ($iYfrom2000 - $iA); $liAux5= ( $iYfrom2000 - $iA)/4; $dElapsedJulianDays= floatval(($iDay + $liAux3 + $liAux4 + $liAux5 + 59)+ -0.5 + $dDecimalHours/24.0); // Calculate ecliptic coordinates (ecliptic longitude and obliquity of the // ecliptic in radians but without limiting the angle to be less than 2*Pi // (i.e., the result may be greater than 2*Pi) $dOmega= 2.1429 - 0.0010394594 * $dElapsedJulianDays; $dMeanLongitude = 4.8950630 + 0.017202791698 * $dElapsedJulianDays; // Radians $dMeanAnomaly = 6.2400600 + 0.0172019699 * $dElapsedJulianDays; $dEclipticLongitude = $dMeanLongitude + 0.03341607 * sin( $dMeanAnomaly ) + 0.00034894 * sin( 2 * $dMeanAnomaly ) -0.0001134 -0.0000203 * sin($dOmega); $dEclipticObliquity = 0.4090928 - 6.2140e-9 * $dElapsedJulianDays +0.0000396 * cos($dOmega); // Calculate celestial coordinates ( right ascension and declination ) in radians // but without limiting the angle to be less than 2*Pi (i.e., the result may be // greater than 2*Pi) $dSin_EclipticLongitude = sin( $dEclipticLongitude ); $dY1 = cos( $dEclipticObliquity ) * $dSin_EclipticLongitude; $dX1 = cos( $dEclipticLongitude ); $dRightAscension = atan2( $dY1,$dX1 ); if( $dRightAscension < 0.0 ) $dRightAscension = $dRightAscension + $twopi; $dDeclination = asin( sin( $dEclipticObliquity )* $dSin_EclipticLongitude ); // Calculate local coordinates ( azimuth and zenith angle ) in degrees $dGreenwichMeanSiderealTime = 6.6974243242 + 0.0657098283 * $dElapsedJulianDays + $dDecimalHours; $dLocalMeanSiderealTime = ($dGreenwichMeanSiderealTime*15 + $dLongitude)* $rad; $dHourAngle = $dLocalMeanSiderealTime - $dRightAscension; $dLatitudeInRadians = $dLatitude * $rad; $dCos_Latitude = cos( $dLatitudeInRadians ); $dSin_Latitude = sin( $dLatitudeInRadians ); $dCos_HourAngle= cos( $dHourAngle ); $dZenithAngle = (acos( $dCos_Latitude * $dCos_HourAngle * cos($dDeclination) + sin( $dDeclination )* $dSin_Latitude)); $dY = -sin( $dHourAngle ); $dX = tan( $dDeclination )* $dCos_Latitude - $dSin_Latitude * $dCos_HourAngle; $dAzimuth = atan2( $dY, $dX ); if ( $dAzimuth < 0.0 ) $dAzimuth = $dAzimuth + $twopi; $dAzimuth = $dAzimuth / $rad; // Parallax Correction $dParallax = ($dEarthMeanRadius / $dAstronomicalUnit) * sin( $dZenithAngle); $dZenithAngle = ($dZenithAngle + $dParallax) / $rad; $dElevation = 90 - $dZenithAngle; // Save Azimuth and Elevation as Float values //echo $dAzimuth."<br />"; //echo $dElevation."<br />"; // Save Azimuth and Elevation as Integer values $sunpos[] = intval($dAzimuth); $sunpos[] = intval($dElevation); return $sunpos;
}
$sunpos = calcSunPos( gmdate(“y”), gmdate(“m”), gmdate(“d”), gmdate(“H”), gmdate(“i”), 0, $long, $lat);
$sunrise = date_sunrise(time(), SUNFUNCS_RET_STRING, $lat, $long, $zenith, date(“O”)/100);
$sunset = date_sunset(time(), SUNFUNCS_RET_STRING, $lat, $long, $zenith, date(“O”)/100);if(isset($argv[1])){
if($argv[1] == “riseset”){
echo "Sunrise: “.$sunrise.”, Sunset: ".$sunset;
}
if($argv[1] == “pos”){
echo "Azimuth: ".$sunpos[0]."°, Elevation: ".$sunpos[1].“°”;
}
}else{
echo “Please use riseset or pos”;
}?>
You can get sunset and sunrise via sun.php riseset or the position of sun with sun.php pos.
-
thx for your workaround!
as part of the recently upgraded sunrise plugin, the new suntime device is working very well, even without any external source parsing.
pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
OK, but how does it work? Are this inside of sunrise plugin?
-
it’s using suncalc.
have a look at the code from @mwittig
https://github.com/pimatic/pimatic-sunrise/commit/35b26092b2885357477a43e675ba8887f2634c91pimatic v0.9 has been released!
Support Pimatic and get some free stickers
Like us on Facebookmake it so !
-
Yes, i know this plugin. But i dont understand how to create a device to see this in my GUI.
I don’t find any documentations about this.
We are talking about this plugin???