Re: [weewx-development] Windy website API under definition ?

2019-04-21 Thread Hartmut Schweidler
Hallo

You're right, the API KEY was clearly wrong

Thanks for the tip and a nice Easter

Hartmut


Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread bill . gotcats
I notice when I first got my API key it looked like yours. So I put in in 
the windy config.  I got an error. 

restx: Windy: Failed to publish record 2019-04-20 20:15:00 PDT 
(1555816500): Failed upload after 3 tries

So I used the https URI with that key and got an error 'invalid API key'

It would be very nice if windy.py would return the error detail as well.  
My Python skills are 'slim'.  using curl would perhaps also shown more 
detail of the https transaction using their 'sample' GET URI.  I'm also not 
sure if debug = 1 would have shown more detail of the failure reason.

But on the web page, I found no PWS defined.  When I created my PWS, I got 
a different key.  It is 124 bytes long, replaced the API key on the URI and 
it returned SUCCESS. Updated weewx.conf Windy API key 

weewx[9396]: restx: Windy: Published record 2019-04-20 20:35:00 PDT 
(1555817700)

I've since added.

[[Windy]]
log_success = False
log_failure = True

Noting as well the instructions for the extension say add [[Windy]], but 
it's already installed, just needs the correct API key and it was good to 
go.

TL;DR
Looks like your API key isn't the right one, it's too short. 
Python 2.7.15
Weewx 3.9.1


On Saturday, April 20, 2019 at 9:41:46 PM UTC-7, Hartmut Schweidler wrote:
>
> Hallo Tom
>
> in the weewx.conf 
>
>
> [[Windy]]
> api_key = To5ff9Wi6thg1HvnTdSad16pEjjUhWZg
> station = 0
> #stations_id = f06ea48e
>
> and in
> restful_services = weewx.restx.StdStationRegistry, weewx.restx.
> StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdAWEKAS, user.wcloud.
> WeatherCloud, user.weather365.Weather365, user.windfinder.WindFinder, user
> .windguru.WindGuru, user.windy.Windy
>
>
> the result is 
>
> Apr 21 06:25:26 wetter OWFS[28695]: reportengine: Found configuration 
> file /home/weewx/skins/Standard/skin.conf for report 'StandardReport'
> Apr 21 06:25:26 wetter OWFS[28695]: restx: Ambient: url: http://
> www.pwsweather.com/pwsupdate/pwsupdate.php?action=updateraw=heskrfrr38=XXX=weewx-4.0.0a4=2019-04-21%2004%3A25%3A00=30.270=36.8=082=1.0=045=3.0=31.8=0.00=0.00=12.00=0.00=46.0=46.0=48.0=49.0=049=073=044=037=000
> Apr 21 06:25:26 wetter OWFS[28695]: restx: Windy: url: https://
> stations.windy.com/pws/update/To5ff9Wi6thg1HvnTdSad16pEjjUhWZg
> Apr 21 06:25:26 wetter OWFS[28695]: restx: Windy: JSON: {'observations': 
> [{'station': 0, 'dateutc': '2019-04-21 04:25:00', 'temp': 
> 2.665, 'wind': 0.4470447150566, 'winddir': 45.0, 'gust': 
> 1.3411233344145173, 'rh': 82.0, 'dewpoint': -0.09430987005889414, 
> 'pressure': 102505.9695673762, 'precip': 0.0, 'uv': 0.0}]}
> Apr 21 06:25:26 wetter OWFS[28695]: vantage: Gentle wake up of console 
> successful
> Apr 21 06:25:26 wetter OWFS[28695]: cheetahgenerator: using search list
>
> Apr 21 06:25:26 wetter OWFS[28695]: restx: AWEKAS: Published record 2019-
> 04-21 06:25:00 CEST (1555820700)
> Apr 21 06:25:26 wetter OWFS[28695]: restx: WindGuru: Published record 2019
> -04-21 06:25:00 CEST (1555820700)
> Apr 21 06:25:26 wetter OWFS[28695]: restx: Weather365: Published record 
> 2019-04-21 06:25:00 CEST (1555820700)
> Apr 21 06:25:26 wetter OWFS[28695]: restx: Windy: Failed upload attempt 1: 
> HTTP Error 400: Bad Request
> Apr 21 06:25:26 wetter OWFS[28695]: restx: PWSWeather: Published record 
> 2019-04-21 06:25:00 CEST (1555820700)
>
> Apr 21 06:25:31 wetter OWFS[28695]: restx: Windy: Failed upload attempt 2: 
> HTTP Error 400: Bad Request
>
> Apr 21 06:25:36 wetter OWFS[28695]: restx: Windy: Failed upload attempt 3: 
> HTTP Error 400: Bad Request
> Apr 21 06:25:36 wetter OWFS[28695]: restx: Windy: Failed to publish 
> record 2019-04-21 06:25:00 CEST (1555820700): Failed upload after 3 tries
>
>
> in the log file is missing an entry like
>
> https://stations.windy.com/pws/update/
> To5ff9Wi6thg1HvnTdSad16pEjjUhWZg?{'observations': [{'station': 0, 
> 'dateutc': '2019-04-21 04:25:00', 'temp': 2.665, 'wind': 
> 0.4470447150566, 'winddir': 45.0, 'gust': 1.3411233344145173, 'rh': 
> 82.0, 'dewpoint': -0.09430987005889414, 'pressure': 102505.9695673762, 
> 'precip': 0.0, 'uv': 0.0}]}
>
> by windy --&
>


Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Hartmut Schweidler
Nachtrag

Mein windy-api-key wurde generiert auf "https://api4.windy.com/api-key/;

Die Dateien von weewx  Stand version="4.0.0a4"

Python 3.7.3

es wird der POST Auftrag nicht richtig generiert?

Hartmut
Happy Easter


Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Pat
That worked for me. Thanks!

On Saturday, April 20, 2019 at 10:09:07 PM UTC-4, Tom Keffer wrote:
>
> Hartmut: make sure you use your API key, not your ID. The API key is a 
> very long sequence of letters and numbers (perhaps 80 to 100 characters).
>
> Pat: The station ID is yet another number. Just set it to zero. It's there 
> to distinguish between stations, in case you have more than one.
>
> On Sat, Apr 20, 2019 at 7:35 AM Hartmut Schweidler  > wrote:
>
>> Hallo tk
>>
>> beim Start weewx
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
>> user.windguru.WindGuru
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service 
>> user.windy.Windy
>> Apr 20 16:27:08 wetter OWFS[12110]: restx: Windy: version is 0.31
>> Apr 20 16:27:08 wetter OWFS[12110]: restx: Windy: Data will be uploaded 
>> to https://stations.windy.com/pws/update
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
>> user.windy.Windy
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service 
>> weewx.engine.StdPrint
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
>> weewx.engine.StdPrint
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service 
>> weewx.engine.StdReport
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
>> weewx.engine.StdReport
>> Apr 20 16:27:08 wetter OWFS[12110]: engine: Starting up weewx version 
>> 4.0.0a4
>> Apr 20 16:27:08 wetter OWFS[12110]: vantage: Gentle wake up of console 
>> successful
>> ...
>> Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Running reports for 
>> latest time in the database.
>> Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Running report 
>> 'StandardReport'
>> Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Found configuration 
>> file /home/weewx/skins/Standard/skin.conf for report 'StandardReport'
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: url: 
>> https://stations.windy.com/pws/update/To5ff9Wi sorry API-Key only
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: JSON: {'observations': 
>> [{'station': 0, 'dateutc': '2019-04-20 14:30:00', 'temp': 
>> 18.836, 'wind': 2.6822466688290345, 'winddir': 0.0, 'gust': 
>> 5.364493337658069, 'rh': 40.0, 'dewpoint': 4.939651407650807, 'pressure': 
>> 102851.3811595755, 'precip': 0.0, 'uv': 1.5}]}
>> Apr 20 16:30:25 wetter OWFS[12110]: vantage: Requesting 200 LOOP packets.
>> ...
>> Apr 20 16:30:25 wetter OWFS[12110]: vantage: Gentle wake up of console 
>> successful
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: WeatherCloud: url: 
>> http://api.weathercloud.net/v01/set?ver=4.0.0a4=251=827bf96306b67496=XXX=1430=20190420=188=40=0=27=10285=0=0=15=3660=188=188=49=478=88=158=94=122=117=122=117=106=89=0=47=77=43=37=58=25=22=280=98=1=0=0
>> Apr 20 16:30:25 wetter OWFS[12110]: cheetahgenerator: using search list 
>> ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 
>> 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 
>> 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras', 
>> 'user.xstats.ExtStats', 'user.forecast.ForecastVariables', 
>> 'user.xgreen.xGreenDay', 'user.xlastrain.MyXLastrain', 
>> 'user.xlastrain.MyXLastsnow', 'user.xyear.xMyEaster', 
>> 'user.xcolor.MyDecorator', 'user.xyear.xMyFeier', 'user.xxyear.xxyear', 
>> 'user.earth.getEarthquake', 'user.iss.getdata', 'user.dwdpollen.DWD', 
>> 'user.darkskyfore.getForecast']
>> Apr 20 16:30:25 wetter OWFS[12110]: manager: Daily summary version is 2.0
>> Apr 20 16:30:25 wetter OWFS[12110]: Erdbeben Extension: version 1.0
>> Apr 20 16:30:25 wetter OWFS[12110]: ISS watch Extension: ISS - version 0.3
>> Apr 20 16:30:25 wetter OWFS[12110]: DWD Pollen Vorhersage Extension: 
>> version 3.0.1
>> Apr 20 16:30:25 wetter OWFS[12110]: Forecast DarkSky Extension: version 
>> 1.2.1
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: AWEKAS: Published record 
>> 2019-04-20 16:30:00 CEST (1555770600)
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: WindGuru: Published record 
>> 2019-04-20 16:30:00 CEST (1555770600)
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: Weather365: Published record 
>> 2019-04-20 16:30:00 CEST (1555770600)
>> Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: Failed upload attempt 
>> 1: HTTP Error 400: Bad Request
>> Apr 20 16:30:26 wetter OWFS[12110]: restx: CWOP: Connected to server 
>> cwop.aprs.net:14580
>> Apr 20 16:30:26 wetter OWFS[12110]: restx: WeatherCloud: Published record 
>> 2019-04-20 16:30:00 CEST (1555770600)
>> Apr 20 16:30:26 wetter OWFS[12110]: restx: PWSWeather: Published record 
>> 2019-04-20 16:30:00 CEST (1555770600)
>> Apr 20 16:30:26 wetter weewx-cmon[10869]: manager: Added record 
>> 2019-04-20 16:30:00 CEST (1555770600) to database 'weewxCmon'
>> Apr 20 16:30:26 wetter OWFS[12110]: xGreen: xGreenDay SLE executed in 
>> 0.404 seconds
>> Apr 20 16:30:26 wetter OWFS[12110]: restx: WindFinder: Published record 
>> 2019-04-20 16:30:00 CEST (1555770600)
>> Apr 20 16:30:26 wetter 

Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Thomas Keffer
Hartmut: make sure you use your API key, not your ID. The API key is a very
long sequence of letters and numbers (perhaps 80 to 100 characters).

Pat: The station ID is yet another number. Just set it to zero. It's there
to distinguish between stations, in case you have more than one.

On Sat, Apr 20, 2019 at 7:35 AM Hartmut Schweidler 
wrote:

> Hallo tk
>
> beim Start weewx
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service
> user.windguru.WindGuru
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service
> user.windy.Windy
> Apr 20 16:27:08 wetter OWFS[12110]: restx: Windy: version is 0.31
> Apr 20 16:27:08 wetter OWFS[12110]: restx: Windy: Data will be uploaded to
> https://stations.windy.com/pws/update
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service
> user.windy.Windy
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service
> weewx.engine.StdPrint
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service
> weewx.engine.StdPrint
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service
> weewx.engine.StdReport
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service
> weewx.engine.StdReport
> Apr 20 16:27:08 wetter OWFS[12110]: engine: Starting up weewx version
> 4.0.0a4
> Apr 20 16:27:08 wetter OWFS[12110]: vantage: Gentle wake up of console
> successful
> ...
> Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Running reports for
> latest time in the database.
> Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Running report
> 'StandardReport'
> Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Found configuration file
> /home/weewx/skins/Standard/skin.conf for report 'StandardReport'
> Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: url:
> https://stations.windy.com/pws/update/To5ff9Wi sorry API-Key only
> Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: JSON: {'observations':
> [{'station': 0, 'dateutc': '2019-04-20 14:30:00', 'temp':
> 18.836, 'wind': 2.6822466688290345, 'winddir': 0.0, 'gust':
> 5.364493337658069, 'rh': 40.0, 'dewpoint': 4.939651407650807, 'pressure':
> 102851.3811595755, 'precip': 0.0, 'uv': 1.5}]}
> Apr 20 16:30:25 wetter OWFS[12110]: vantage: Requesting 200 LOOP packets.
> ...
> Apr 20 16:30:25 wetter OWFS[12110]: vantage: Gentle wake up of console
> successful
> Apr 20 16:30:25 wetter OWFS[12110]: restx: WeatherCloud: url:
> http://api.weathercloud.net/v01/set?ver=4.0.0a4=251=827bf96306b67496=XXX=1430=20190420=188=40=0=27=10285=0=0=15=3660=188=188=49=478=88=158=94=122=117=122=117=106=89=0=47=77=43=37=58=25=22=280=98=1=0=0
> Apr 20 16:30:25 wetter OWFS[12110]: cheetahgenerator: using search list
> ['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station',
> 'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats',
> 'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras',
> 'user.xstats.ExtStats', 'user.forecast.ForecastVariables',
> 'user.xgreen.xGreenDay', 'user.xlastrain.MyXLastrain',
> 'user.xlastrain.MyXLastsnow', 'user.xyear.xMyEaster',
> 'user.xcolor.MyDecorator', 'user.xyear.xMyFeier', 'user.xxyear.xxyear',
> 'user.earth.getEarthquake', 'user.iss.getdata', 'user.dwdpollen.DWD',
> 'user.darkskyfore.getForecast']
> Apr 20 16:30:25 wetter OWFS[12110]: manager: Daily summary version is 2.0
> Apr 20 16:30:25 wetter OWFS[12110]: Erdbeben Extension: version 1.0
> Apr 20 16:30:25 wetter OWFS[12110]: ISS watch Extension: ISS - version 0.3
> Apr 20 16:30:25 wetter OWFS[12110]: DWD Pollen Vorhersage Extension:
> version 3.0.1
> Apr 20 16:30:25 wetter OWFS[12110]: Forecast DarkSky Extension: version
> 1.2.1
> Apr 20 16:30:25 wetter OWFS[12110]: restx: AWEKAS: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:25 wetter OWFS[12110]: restx: WindGuru: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:25 wetter OWFS[12110]: restx: Weather365: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: Failed upload attempt 1:
> HTTP Error 400: Bad Request
> Apr 20 16:30:26 wetter OWFS[12110]: restx: CWOP: Connected to server
> cwop.aprs.net:14580
> Apr 20 16:30:26 wetter OWFS[12110]: restx: WeatherCloud: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:26 wetter OWFS[12110]: restx: PWSWeather: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:26 wetter weewx-cmon[10869]: manager: Added record 2019-04-20
> 16:30:00 CEST (1555770600) to database 'weewxCmon'
> Apr 20 16:30:26 wetter OWFS[12110]: xGreen: xGreenDay SLE executed in
> 0.404 seconds
> Apr 20 16:30:26 wetter OWFS[12110]: restx: WindFinder: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:26 wetter weewx-cmon[10869]: Added record 2019-04-20 16:30:00
> CEST (1555770600) to daily summary in 'weewxCmon'
> Apr 20 16:30:26 wetter OWFS[12110]: restx: CWOP: Published record
> 2019-04-20 16:30:00 CEST (1555770600)
> Apr 20 16:30:26 wetter OWFS[12110]: 

Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Pat
I removed the int() around the station ID and re-ran with debug=2. It 
returned the below. Still a POST vs GET issue?

Apr 20 11:15:17 zeus weewx[22541]: restx: Windy: url: 
https://stations.windy.com/pws/update/
Apr 20 11:15:17 zeus weewx[22541]: restx: Windy: JSON: {'observations': [{
'dateutc': '2019-04-20 15:15:00', 'dewpoint': 14.953428002286248, 'temp': 
18.773504273504305, 'precip': 0.508, 'gust': 2.2352, 'uv': 
1.11466658, 'winddir': 176.02341016941148, 'pressure': 
101325.54900876262, 'station': 'f06ee9f5', 'rh': 78.47611940298506, 'wind': 
0.956326075949367}]}
Apr 20 11:15:17 zeus weewx[22541]: restx: Windy: Failed upload attempt 1: 
HTTP Error 400: Bad Request
Apr 20 11:15:22 zeus weewx[22541]: restx: Windy: Failed upload attempt 2: 
HTTP Error 400: Bad Request
Apr 20 11:15:27 zeus weewx[22541]: restx: Windy: Failed upload attempt 3: 
HTTP Error 400: Bad Request
Apr 20 11:15:32 zeus weewx[22541]: restx: Windy: Failed to publish record 
2019-04-20 11:15:00 EDT (1555773300): Failed upload after 3 tries



 

On Saturday, April 20, 2019 at 10:39:28 AM UTC-4, Pat wrote:
>
> I just signed up for this today and am using 0.31 of the extension, and 
> I'm receiving this error. I've placed the ID in quotes and still am 
> receiving the error. Looks like they aren't using integers for station ID 
> anymore?
>
> My windy details:
>
> ID: f06ee9f5
>
> Latitude: 42.223667°
>
> Longitude: -72.374466°
>
> Elevation: 131.06 m
>
> Apr 20 10:37:04 zeus weewx[21868]: restx: Windy: version is 0.31
> Apr 20 10:37:04 zeus weewx[21868]: engine: Caught unrecoverable exception 
> in engine:
> Apr 20 10:37:04 zeus weewx[21868]:   invalid literal for int() 
> with base 10: 'f06ee9f5'
> Apr 20 10:37:04 zeus weewx[21868]:   Traceback (most recent call 
> last):
> Apr 20 10:37:04 zeus weewx[21868]: File 
> "/usr/share/weewx/weewx/engine.py", line 884, in main
> Apr 20 10:37:04 zeus weewx[21868]:   engine = engine_class(
> config_dict)
> Apr 20 10:37:04 zeus weewx[21868]: File 
> "/usr/share/weewx/weewx/engine.py", line 78, in __init__
> Apr 20 10:37:04 zeus weewx[21868]:   self.loadServices(
> config_dict)
> Apr 20 10:37:04 zeus weewx[21868]: File 
> "/usr/share/weewx/weewx/engine.py", line 142, in loadServices
> Apr 20 10:37:04 zeus weewx[21868]:   self.service_obj.append(
> weeutil.weeutil._get_object(svc)(self, config_dict))
> Apr 20 10:37:04 zeus weewx[21868]: File 
> "/usr/share/weewx/user/windy.py", line 82, in __init__
> Apr 20 10:37:04 zeus weewx[21868]:   **site_dict)
> Apr 20 10:37:04 zeus weewx[21868]: File 
> "/usr/share/weewx/user/windy.py", line 111, in __init__
> Apr 20 10:37:04 zeus weewx[21868]:   self.station = int(
> station)
> Apr 20 10:37:04 zeus weewx[21868]:   ValueError: invalid literal 
> for int() with base 10: 'f06ee9f5'
> Apr 20 10:37:04 zeus weewx[21868]:   Exiting.
>
>
>
>
> On Saturday, April 20, 2019 at 10:16:11 AM UTC-4, Tom Keffer wrote:
>>
>> Are you sure you are using the current version of windy.py? Version 0.3 
>> does not post the url to the log. 
>>
>> In any case, use the attached version. Set debug=2, then restart weewx. 
>> This version (v0.31) will not only post the url to the log, but also the 
>> JSON body.
>>
>> -tk
>>
>>
>> On Sat, Apr 20, 2019 at 6:57 AM Hartmut Schweidler  
>> wrote:
>>
>>> Hallo
>>>
>>> ich habe die neue Version von windy.py 
>>> VERSION = "0.3" 
>>> geladen 
>>> im log taucht nur auf
>>> Apr 20 15:50:25 wetter OWFS[8025]: restx: Windy: url: 
>>> https://stations.windy.com/pws/update/To5ff ... api_key ohne DATEN
>>> Apr 20 15:50:25 wetter OWFS[8025]: restx: AWEKAS: url: 
>>> http://data.awekas.at/eingabe_pruefung.php?val=hes_4.0.0a4;11.341407;53.6059563
>>> Apr 20 15:50:25 wetter OWFS[8025]: vantage: Gentle wake up of console 
>>> successful
>>>
>>> Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
>>> Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
>>> Apr 20 15:50:30 wetter OWFS[8025]: restx: Windy: Failed upload attempt 
>>> 2: HTTP Error 400: Bad Request
>>> Apr 20 15:50:31 wetter OWFS[8025]: manager: Daily summary version is 2.0
>>>
>>> Hartmut (wetter.hes61.de)
>>>
>>> Am Donnerstag, 18. April 2019 22:01:48 UTC+2 schrieb mwall:

 On Thursday, April 18, 2019 at 12:23:32 PM UTC-4, Wysiwyg wrote:
>
> api_key is filled by the key I get from 
> https://stations.windy.com/stations
> it's a very long key ( ~124 characters)
>

 yes, the api_key is ridiculously long.  they must be expecting data 
 from every atom in the universe.
  

>>>

Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Hartmut Schweidler
Nachtrag

url and JSON

werden nicht zusammengesetzt


Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Pat
I just signed up for this today and am using 0.31 of the extension, and I'm 
receiving this error. I've placed the ID in quotes and still am receiving 
the error. Looks like they aren't using integers for station ID anymore?

My windy details:

ID: f06ee9f5

Latitude: 42.223667°

Longitude: -72.374466°

Elevation: 131.06 m

Apr 20 10:37:04 zeus weewx[21868]: restx: Windy: version is 0.31
Apr 20 10:37:04 zeus weewx[21868]: engine: Caught unrecoverable exception in 
engine:
Apr 20 10:37:04 zeus weewx[21868]:   invalid literal for int() with 
base 10: 'f06ee9f5'
Apr 20 10:37:04 zeus weewx[21868]:   Traceback (most recent call 
last):
Apr 20 10:37:04 zeus weewx[21868]: File 
"/usr/share/weewx/weewx/engine.py", line 884, in main
Apr 20 10:37:04 zeus weewx[21868]:   engine = engine_class(
config_dict)
Apr 20 10:37:04 zeus weewx[21868]: File 
"/usr/share/weewx/weewx/engine.py", line 78, in __init__
Apr 20 10:37:04 zeus weewx[21868]:   self.loadServices(
config_dict)
Apr 20 10:37:04 zeus weewx[21868]: File 
"/usr/share/weewx/weewx/engine.py", line 142, in loadServices
Apr 20 10:37:04 zeus weewx[21868]:   self.service_obj.append(
weeutil.weeutil._get_object(svc)(self, config_dict))
Apr 20 10:37:04 zeus weewx[21868]: File 
"/usr/share/weewx/user/windy.py", line 82, in __init__
Apr 20 10:37:04 zeus weewx[21868]:   **site_dict)
Apr 20 10:37:04 zeus weewx[21868]: File 
"/usr/share/weewx/user/windy.py", line 111, in __init__
Apr 20 10:37:04 zeus weewx[21868]:   self.station = int(station)
Apr 20 10:37:04 zeus weewx[21868]:   ValueError: invalid literal for 
int() with base 10: 'f06ee9f5'
Apr 20 10:37:04 zeus weewx[21868]:   Exiting.




On Saturday, April 20, 2019 at 10:16:11 AM UTC-4, Tom Keffer wrote:
>
> Are you sure you are using the current version of windy.py? Version 0.3 
> does not post the url to the log. 
>
> In any case, use the attached version. Set debug=2, then restart weewx. 
> This version (v0.31) will not only post the url to the log, but also the 
> JSON body.
>
> -tk
>
>
> On Sat, Apr 20, 2019 at 6:57 AM Hartmut Schweidler  > wrote:
>
>> Hallo
>>
>> ich habe die neue Version von windy.py 
>> VERSION = "0.3" 
>> geladen 
>> im log taucht nur auf
>> Apr 20 15:50:25 wetter OWFS[8025]: restx: Windy: url: 
>> https://stations.windy.com/pws/update/To5ff ... api_key ohne DATEN
>> Apr 20 15:50:25 wetter OWFS[8025]: restx: AWEKAS: url: 
>> http://data.awekas.at/eingabe_pruefung.php?val=hes_4.0.0a4;11.341407;53.6059563
>> Apr 20 15:50:25 wetter OWFS[8025]: vantage: Gentle wake up of console 
>> successful
>>
>> Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
>> Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
>> Apr 20 15:50:30 wetter OWFS[8025]: restx: Windy: Failed upload attempt 2: 
>> HTTP Error 400: Bad Request
>> Apr 20 15:50:31 wetter OWFS[8025]: manager: Daily summary version is 2.0
>>
>> Hartmut (wetter.hes61.de)
>>
>> Am Donnerstag, 18. April 2019 22:01:48 UTC+2 schrieb mwall:
>>>
>>> On Thursday, April 18, 2019 at 12:23:32 PM UTC-4, Wysiwyg wrote:

 api_key is filled by the key I get from 
 https://stations.windy.com/stations
 it's a very long key ( ~124 characters)

>>>
>>> yes, the api_key is ridiculously long.  they must be expecting data from 
>>> every atom in the universe.
>>>  
>>>
>>

Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Hartmut Schweidler
Hallo tk

beim Start weewx
Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
user.windguru.WindGuru
Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service user.windy.Windy
Apr 20 16:27:08 wetter OWFS[12110]: restx: Windy: version is 0.31
Apr 20 16:27:08 wetter OWFS[12110]: restx: Windy: Data will be uploaded to 
https://stations.windy.com/pws/update
Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
user.windy.Windy
Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service 
weewx.engine.StdPrint
Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
weewx.engine.StdPrint
Apr 20 16:27:08 wetter OWFS[12110]: engine: Loading service 
weewx.engine.StdReport
Apr 20 16:27:08 wetter OWFS[12110]: engine: Finished loading service 
weewx.engine.StdReport
Apr 20 16:27:08 wetter OWFS[12110]: engine: Starting up weewx version 
4.0.0a4
Apr 20 16:27:08 wetter OWFS[12110]: vantage: Gentle wake up of console 
successful
...
Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Running reports for 
latest time in the database.
Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Running report 
'StandardReport'
Apr 20 16:30:25 wetter OWFS[12110]: reportengine: Found configuration file 
/home/weewx/skins/Standard/skin.conf for report 'StandardReport'
Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: url: 
https://stations.windy.com/pws/update/To5ff9Wi sorry API-Key only
Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: JSON: {'observations': 
[{'station': 0, 'dateutc': '2019-04-20 14:30:00', 'temp': 
18.836, 'wind': 2.6822466688290345, 'winddir': 0.0, 'gust': 
5.364493337658069, 'rh': 40.0, 'dewpoint': 4.939651407650807, 'pressure': 
102851.3811595755, 'precip': 0.0, 'uv': 1.5}]}
Apr 20 16:30:25 wetter OWFS[12110]: vantage: Requesting 200 LOOP packets.
...
Apr 20 16:30:25 wetter OWFS[12110]: vantage: Gentle wake up of console 
successful
Apr 20 16:30:25 wetter OWFS[12110]: restx: WeatherCloud: url: 
http://api.weathercloud.net/v01/set?ver=4.0.0a4=251=827bf96306b67496=XXX=1430=20190420=188=40=0=27=10285=0=0=15=3660=188=188=49=478=88=158=94=122=117=122=117=106=89=0=47=77=43=37=58=25=22=280=98=1=0=0
Apr 20 16:30:25 wetter OWFS[12110]: cheetahgenerator: using search list 
['weewx.cheetahgenerator.Almanac', 'weewx.cheetahgenerator.Station', 
'weewx.cheetahgenerator.Current', 'weewx.cheetahgenerator.Stats', 
'weewx.cheetahgenerator.UnitInfo', 'weewx.cheetahgenerator.Extras', 
'user.xstats.ExtStats', 'user.forecast.ForecastVariables', 
'user.xgreen.xGreenDay', 'user.xlastrain.MyXLastrain', 
'user.xlastrain.MyXLastsnow', 'user.xyear.xMyEaster', 
'user.xcolor.MyDecorator', 'user.xyear.xMyFeier', 'user.xxyear.xxyear', 
'user.earth.getEarthquake', 'user.iss.getdata', 'user.dwdpollen.DWD', 
'user.darkskyfore.getForecast']
Apr 20 16:30:25 wetter OWFS[12110]: manager: Daily summary version is 2.0
Apr 20 16:30:25 wetter OWFS[12110]: Erdbeben Extension: version 1.0
Apr 20 16:30:25 wetter OWFS[12110]: ISS watch Extension: ISS - version 0.3
Apr 20 16:30:25 wetter OWFS[12110]: DWD Pollen Vorhersage Extension: 
version 3.0.1
Apr 20 16:30:25 wetter OWFS[12110]: Forecast DarkSky Extension: version 
1.2.1
Apr 20 16:30:25 wetter OWFS[12110]: restx: AWEKAS: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:25 wetter OWFS[12110]: restx: WindGuru: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:25 wetter OWFS[12110]: restx: Weather365: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:25 wetter OWFS[12110]: restx: Windy: Failed upload attempt 1: 
HTTP Error 400: Bad Request
Apr 20 16:30:26 wetter OWFS[12110]: restx: CWOP: Connected to server 
cwop.aprs.net:14580
Apr 20 16:30:26 wetter OWFS[12110]: restx: WeatherCloud: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:26 wetter OWFS[12110]: restx: PWSWeather: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:26 wetter weewx-cmon[10869]: manager: Added record 2019-04-20 
16:30:00 CEST (1555770600) to database 'weewxCmon'
Apr 20 16:30:26 wetter OWFS[12110]: xGreen: xGreenDay SLE executed in 0.404 
seconds
Apr 20 16:30:26 wetter OWFS[12110]: restx: WindFinder: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:26 wetter weewx-cmon[10869]: Added record 2019-04-20 16:30:00 
CEST (1555770600) to daily summary in 'weewxCmon'
Apr 20 16:30:26 wetter OWFS[12110]: restx: CWOP: Published record 
2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:26 wetter OWFS[12110]: restx: StationRegistry: Published 
record 2019-04-20 16:30:00 CEST (1555770600)
Apr 20 16:30:26 wetter OWFS[12110]: Forecast DarkSky Extension: New DarkSky 
Forecast data downloaded to /home/weewx/archive/darksky_forecast.json
Apr 20 16:30:27 wetter weewx-cmon[10869]: cheetahgenerator: Generated 1 
files for report ServerReport in 1.03 seconds
Apr 20 16:30:27 wetter weewx-cmon[10869]: imagegenerator: Generated 11 
images for ServerReport in 0.47 seconds
Apr 20 16:30:27 

Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Thomas Keffer
Are you sure you are using the current version of windy.py? Version 0.3
does not post the url to the log.

In any case, use the attached version. Set debug=2, then restart weewx.
This version (v0.31) will not only post the url to the log, but also the
JSON body.

-tk


On Sat, Apr 20, 2019 at 6:57 AM Hartmut Schweidler 
wrote:

> Hallo
>
> ich habe die neue Version von windy.py
> VERSION = "0.3"
> geladen
> im log taucht nur auf
> Apr 20 15:50:25 wetter OWFS[8025]: restx: Windy: url:
> https://stations.windy.com/pws/update/To5ff ... api_key ohne DATEN
> Apr 20 15:50:25 wetter OWFS[8025]: restx: AWEKAS: url:
> http://data.awekas.at/eingabe_pruefung.php?val=hes_4.0.0a4;11.341407;53.6059563
> Apr 20 15:50:25 wetter OWFS[8025]: vantage: Gentle wake up of console
> successful
>
> Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
> Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
> Apr 20 15:50:30 wetter OWFS[8025]: restx: Windy: Failed upload attempt 2:
> HTTP Error 400: Bad Request
> Apr 20 15:50:31 wetter OWFS[8025]: manager: Daily summary version is 2.0
>
> Hartmut (wetter.hes61.de)
>
> Am Donnerstag, 18. April 2019 22:01:48 UTC+2 schrieb mwall:
>>
>> On Thursday, April 18, 2019 at 12:23:32 PM UTC-4, Wysiwyg wrote:
>>>
>>> api_key is filled by the key I get from
>>> https://stations.windy.com/stations
>>> it's a very long key ( ~124 characters)
>>>
>>
>> yes, the api_key is ridiculously long.  they must be expecting data from
>> every atom in the universe.
>>
>>
>
# Copyright 2019 Matthew Wall

"""
This is a weewx extension that uploads data to a windy.com

http://windy.com

The protocol is desribed at the windy community forum:

https://community.windy.com/topic/8168/report-you-weather-station-data-to-windy

Minimal configuration

[StdRESTful]
[[Windy]]
api_key = API_KEY
station = STATION_IDENTIFIER
"""

# deal with differences between python 2 and python 3
try:
from Queue import Queue
except ImportError:
from queue import Queue

try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode

from distutils.version import StrictVersion
import json
import sys
import syslog
import time

import weewx
import weewx.restx
import weewx.units
from weeutil.weeutil import to_bool

VERSION = "0.31"

REQUIRED_WEEWX = "3.8.0"
if StrictVersion(weewx.__version__) < StrictVersion(REQUIRED_WEEWX):
raise weewx.UnsupportedFeature("weewx %s or greater is required, found %s"
   % (REQUIRED_WEEWX, weewx.__version__))

def logmsg(level, msg):
syslog.syslog(level, 'restx: Windy: %s' % msg)

def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)

def loginf(msg):
logmsg(syslog.LOG_INFO, msg)

def logerr(msg):
logmsg(syslog.LOG_ERR, msg)


class Windy(weewx.restx.StdRESTbase):
_DEFAULT_URL = 'https://stations.windy.com/pws/update'

def __init__(self, engine, cfg_dict):
super(Windy, self).__init__(engine, cfg_dict)
loginf("version is %s" % VERSION)
site_dict = weewx.restx.get_site_dict(cfg_dict, 'Windy',
  'api_key', 'station')
if site_dict is None:
return
site_dict.setdefault('server_url', Windy._DEFAULT_URL)

# FIXME: we should not have to do this here!
binding = site_dict.pop('binding', 'wx_binding')
mgr_dict = weewx.manager.get_manager_dict_from_config(
cfg_dict, binding)

self.archive_queue = Queue()
self.archive_thread = WindyThread(self.archive_queue,
  manager_dict=mgr_dict,
  **site_dict)

self.archive_thread.start()
self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
loginf("Data will be uploaded to %s" % site_dict['server_url'])

def new_archive_record(self, event):
self.archive_queue.put(event.record)


class WindyThread(weewx.restx.RESTThread):

def __init__(self, queue, api_key, station, server_url=Windy._DEFAULT_URL,
 skip_upload=False, manager_dict=None,
 post_interval=None, max_backlog=sys.maxsize, stale=None,
 log_success=True, log_failure=True,
 timeout=60, max_tries=3, retry_wait=5):
super(WindyThread, self).__init__(queue,
  protocol_name='Windy',
  manager_dict=manager_dict,
  post_interval=post_interval,
  max_backlog=max_backlog,
  stale=stale,
  log_success=log_success,
  log_failure=log_failure,
  max_tries=max_tries,
  timeout=timeout,
  

Re: [weewx-development] Windy website API under definition ?

2019-04-20 Thread Hartmut Schweidler
Hallo

ich habe die neue Version von windy.py 
VERSION = "0.3" 
geladen 
im log taucht nur auf
Apr 20 15:50:25 wetter OWFS[8025]: restx: Windy: url: 
https://stations.windy.com/pws/update/To5ff ... api_key ohne DATEN
Apr 20 15:50:25 wetter OWFS[8025]: restx: AWEKAS: url: 
http://data.awekas.at/eingabe_pruefung.php?val=hes_4.0.0a4;11.341407;53.6059563
Apr 20 15:50:25 wetter OWFS[8025]: vantage: Gentle wake up of console 
successful

Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
Apr 20 15:50:30 wetter OWFS[8025]: manager: Daily summary version is 2.0
Apr 20 15:50:30 wetter OWFS[8025]: restx: Windy: Failed upload attempt 2: 
HTTP Error 400: Bad Request
Apr 20 15:50:31 wetter OWFS[8025]: manager: Daily summary version is 2.0

Hartmut (wetter.hes61.de)

Am Donnerstag, 18. April 2019 22:01:48 UTC+2 schrieb mwall:
>
> On Thursday, April 18, 2019 at 12:23:32 PM UTC-4, Wysiwyg wrote:
>>
>> api_key is filled by the key I get from 
>> https://stations.windy.com/stations
>> it's a very long key ( ~124 characters)
>>
>
> yes, the api_key is ridiculously long.  they must be expecting data from 
> every atom in the universe.
>  
>


Re: [weewx-development] Windy website API under definition ?

2019-04-18 Thread Wysiwyg
yes, we are lucky to have a copy-paste function ;-)


I set back station to "0" and it works !!  \(ᵔᵕᵔ)/
My very 1st sample of data is uploaded.

thank you !

I will report if I see anything curious coming.




Le jeudi 18 avril 2019 22:01:48 UTC+2, mwall a écrit :
>
> On Thursday, April 18, 2019 at 12:23:32 PM UTC-4, Wysiwyg wrote:
>>
>> api_key is filled by the key I get from 
>> https://stations.windy.com/stations
>> it's a very long key ( ~124 characters)
>>
>
> yes, the api_key is ridiculously long.  they must be expecting data from 
> every atom in the universe.
>  
>


Re: [weewx-development] Windy website API under definition ?

2019-04-18 Thread mwall
On Thursday, April 18, 2019 at 12:23:32 PM UTC-4, Wysiwyg wrote:
>
> api_key is filled by the key I get from 
> https://stations.windy.com/stations
> it's a very long key ( ~124 characters)
>

yes, the api_key is ridiculously long.  they must be expecting data from 
every atom in the universe.
 


Re: [weewx-development] Windy website API under definition ?

2019-04-18 Thread mwall
weewx-windy 0.2 only supports http GET, and station identifier is not 
necessary for that.  set station=0 and everything should work.

apparently the station identifier is only necessary for the POST protocol.  
the spec indicates that a station identifier is an integer.



Re: [weewx-development] Windy website API under definition ?

2019-04-18 Thread Wysiwyg
Hi there,
I'm a bit confused.

I downloaded the last files here: 
https://github.com/matthewwall/weewx-windy  10 minutes ago.
I installed with "wee_extension" (as in readme file)

I notice there is now a "station" field in weewx.conf in addition to 
api_key (windy section)

api_key is filled by the key I get from https://stations.windy.com/stations
it's a very long key ( ~124 characters)

For the station field, I though it was the station id from windy 
(f06ea883)...but this raise en error 


Apr 18 18:09:02 localhost weewx[27255]: engine: Caught unrecoverable 
exception in engine:
Apr 18 18:09:02 localhost weewx[27255]:   invalid literal for int() 
with base 10: 'f06ea883'
Apr 18 18:09:02 localhost weewx[27255]:   Traceback (most recent 
call last):
Apr 18 18:09:02 localhost weewx[27255]: File 
"/usr/share/weewx/weewx/engine.py", line 884, in main
Apr 18 18:09:02 localhost weewx[27255]:   engine = engine_class(
config_dict)
Apr 18 18:09:02 localhost weewx[27255]: File 
"/usr/share/weewx/weewx/engine.py", line 78, in __init__
Apr 18 18:09:02 localhost weewx[27255]:   self.loadServices(
config_dict)
Apr 18 18:09:02 localhost weewx[27255]: File 
"/usr/share/weewx/weewx/engine.py", line 142, in loadServices
Apr 18 18:09:02 localhost weewx[27255]:   self.service_obj.
append(weeutil.weeutil._get_object(svc)(self, config_dict))
Apr 18 18:09:02 localhost weewx[27255]: File 
"/usr/share/weewx/user/windy.py", line 84, in __init__
Apr 18 18:09:02 localhost weewx[27255]:   **site_dict)
Apr 18 18:09:02 localhost weewx[27255]: File 
"/usr/share/weewx/user/windy.py", line 116, in __init__
Apr 18 18:09:02 localhost weewx[27255]:   self.station = int(
station)
Apr 18 18:09:02 localhost weewx[27255]:   ValueError: invalid 
literal for int() with base 10: 'f06ea883'
Apr 18 18:09:02 localhost weewx[27255]:   Exiting.


[StdRESTful]

[[Windy]]
api_key = 
station = f06ea883


Is it an other ID I should fill here ?




Le jeudi 18 avril 2019 15:42:53 UTC+2, Tom Keffer a écrit :
>
> Here's a better link: 
> https://www.windy.com/station/pws-f0776a1a?45.671,-121.539,5
>
>
> On Thu, Apr 18, 2019 at 6:40 AM Thomas Keffer  > wrote:
>
>> It's working for me: https://www.windy.com/station?45.687,-121.570,8
>>
>> -tk
>>
>> On Wed, Apr 17, 2019 at 5:25 AM Hartmut Schweidler > > wrote:
>>
>>> Hallo 
>>>
>>> windy.py
>>>
>>> Apr 17 14:15:37 wetter OWFS[22140]: restx: Windy: Failed to publish 
>>> record 2019-04-17 14:15:00 CEST (103300): Failed upload after 3 tries
>>>
>>> api-key  was generated by windy "D4rKBpgJE0" 32  letter and numbers
>>>
>>> Hartmut
>>>
>>

Re: [weewx-development] Windy website API under definition ?

2019-04-18 Thread Thomas Keffer
Here's a better link:
https://www.windy.com/station/pws-f0776a1a?45.671,-121.539,5


On Thu, Apr 18, 2019 at 6:40 AM Thomas Keffer  wrote:

> It's working for me: https://www.windy.com/station?45.687,-121.570,8
>
> -tk
>
> On Wed, Apr 17, 2019 at 5:25 AM Hartmut Schweidler 
> wrote:
>
>> Hallo
>>
>> windy.py
>>
>> Apr 17 14:15:37 wetter OWFS[22140]: restx: Windy: Failed to publish
>> record 2019-04-17 14:15:00 CEST (103300): Failed upload after 3 tries
>>
>> api-key  was generated by windy "D4rKBpgJE0" 32  letter and numbers
>>
>> Hartmut
>>
>


Re: [weewx-development] Windy website API under definition ?

2019-04-18 Thread Thomas Keffer
It's working for me: https://www.windy.com/station?45.687,-121.570,8

-tk

On Wed, Apr 17, 2019 at 5:25 AM Hartmut Schweidler 
wrote:

> Hallo
>
> windy.py
>
> Apr 17 14:15:37 wetter OWFS[22140]: restx: Windy: Failed to publish record
> 2019-04-17 14:15:00 CEST (103300): Failed upload after 3 tries
>
> api-key  was generated by windy "D4rKBpgJE0" 32  letter and numbers
>
> Hartmut
>


Re: [weewx-development] Windy website API under definition ?

2019-04-17 Thread Hartmut Schweidler
Hallo 

windy.py

Apr 17 14:15:37 wetter OWFS[22140]: restx: Windy: Failed to publish record 
2019-04-17 14:15:00 CEST (103300): Failed upload after 3 tries

api-key  was generated by windy "D4rKBpgJE0" 32  letter and numbers

Hartmut
# Copyright 2019 Matthew Wall

"""
This is a weewx extension that uploads data to a windy.com

http://windy.com

The protocol is desribed at the windy community forum:

https://community.windy.com/topic/8168/report-you-weather-station-data-to-windy

Minimal configuration

[StdRESTful]
[[Windy]]
api_key = API_KEY
station = STATION_IDENTIFIER
"""

# Python 2/3 compatiblity
try:
import Queue as queue   # python 2
from urllib import urlencode# python 2
from urllib2 import Request # python 2
except ImportError:
from queue import Queue  # python 3
from urllib.parse import urlencode  # python 3
from urllib.request import Request  # python 3

from distutils.version import StrictVersion
import json
import re
import sys
import syslog
import time
#import urllib

import weewx
import weewx.restx
import weewx.units
from weeutil.weeutil import to_bool

VERSION = "0.1"

REQUIRED_WEEWX = "3.8.0"
if StrictVersion(weewx.__version__) < StrictVersion(REQUIRED_WEEWX):
raise weewx.UnsupportedFeature("weewx %s or greater is required, found %s"
   % (REQUIRED_WEEWX, weewx.__version__))

def logmsg(level, msg):
syslog.syslog(level, 'restx: Windy: %s' % msg)

def logdbg(msg):
logmsg(syslog.LOG_DEBUG, msg)

def loginf(msg):
logmsg(syslog.LOG_INFO, msg)

def logerr(msg):
logmsg(syslog.LOG_ERR, msg)


class Windy(weewx.restx.StdRESTbase):
_DEFAULT_URL = 'https://stations.windy.com/pws/update'

def __init__(self, engine, cfg_dict):
super(Windy, self).__init__(engine, cfg_dict)
loginf("version is %s" % VERSION)
site_dict = weewx.restx.get_site_dict(cfg_dict, 'Windy',
  'api_key', 'station')
if site_dict is None:
return
site_dict.setdefault('server_url', Windy._DEFAULT_URL)

# FIXME: we should not have to do this here!
binding = site_dict.pop('binding', 'wx_binding')
mgr_dict = weewx.manager.get_manager_dict_from_config(
cfg_dict, binding)

self.archive_queue = Queue()
try:
self.archive_thread = WindyThread(self.archive_queue,
  manager_dict=mgr_dict,
  **site_dict)
except weewx.ViolatedPrecondition as e:
loginf("Data will not be posted: %s" % e)
return

self.archive_thread.start()
self.bind(weewx.NEW_ARCHIVE_RECORD, self.new_archive_record)
loginf("Data will be uploaded to %s" % site_dict['server_url'])

def new_archive_record(self, event):
self.archive_queue.put(event.record)


class WindyThread(weewx.restx.RESTThread):

def __init__(self, queue, api_key, station, server_url=Windy._DEFAULT_URL,
 skip_upload=False, manager_dict=None,
 post_interval=None, max_backlog=sys.maxsize, stale=None,
 log_success=True, log_failure=True,
 timeout=60, max_tries=3, retry_wait=5):
super(WindyThread, self).__init__(queue,
  protocol_name='Windy',
  manager_dict=manager_dict,
  post_interval=post_interval,
  max_backlog=max_backlog,
  stale=stale,
  log_success=log_success,
  log_failure=log_failure,
  max_tries=max_tries,
  timeout=timeout,
  retry_wait=retry_wait)
self.api_key = api_key
self.station = int(station)
self.server_url = server_url
self.skip_upload = to_bool(skip_upload)

def format_url(self, record):
data = self.convert_data(record)
url_data = urlencode(data)
url = '%s/%s?%s' % (self.server_url, self.api_key, url_data)
if weewx.debug >= 2:
logdbg('url: %s' % re.sub(r"api_key=.*", "api_key=XXX", url))
return url

# we would like to use POST, but the windy.com servers do not seem to like
# it when we do that.
#def get_post_body(self, record):
#data = self.convert_data(record)
#obs = {"observations":[data]}
#return json.dumps(obs), 'application/json'

def convert_data(self, record):
rec = weewx.units.to_METRICWX(record)
data = dict()
data['station'] = self.station # integer identifier

Re: [weewx-development] Windy website API under definition ?

2019-04-17 Thread Hartmut Schweidler
Hallo 

i have  from weather365
try:
   import Queue as queue   # python 2
   from urllib import urlencode# python 2
   from urllib2 import Request # python 2
except ImportError:
   import queue# python 3
   from urllib.parse import urlencode  # python 3
   from urllib.request import Request  # python 3


import and in def Format_url

def format_url(self, record):
data = self.convert_data(record)
url_data = urlencode(data).encode('utf-8')
url = '%s/%s?%s' % (self.server_url, self.api_key, url_data)
if weewx.debug >= 2:
logdbg('url: %s' % re.sub(r"api_key=.*", "api_key=XXX", url))
return url
the result
Apr 17 08:45:27 wetter OWFS[29611]: vantage: Catch up complete.
Apr 17 08:45:27 wetter OWFS[29611]: restx: Windy: url: 
https://stations.windy.com/pws/update/F.KEY..SXotj0vR2l
?b'station=0=2019-04-17+06%3A45%3A00=7.445=2.2352055573575282=67.5=4.023370003243551=63.0=0.8621488467080043=1019.9349670983149=1026.481978700465=0.0=0.5'
Apr 17 08:45:27 wetter OWFS[29611]: restx: WindFinder .

Apr 17 08:45:36 wetter OWFS[29611]: manager: Daily summary version is 2.0
Apr 17 08:45:37 wetter OWFS[29611]: restx: Windy: Failed upload attempt 3: 
HTTP Error 400: Bad Request
Apr 17 08:45:37 wetter OWFS[29611]: restx: Windy: Failed to publish record 
2019-04-17 08:45:00 CEST (1555483500): Failed upload after 3 tries
Apr 17 08:45:38 wetter OWFS[29611]: imagegenerator: Generated 54 images for 
StandardReport in 2.30 seconds

I will continue testing
Hartmut



Re: [weewx-development] Windy website API under definition ?

2019-04-17 Thread Hartmut Schweidler
i have test

Matthew Wall comment the changes 

 
c22de85 

 
28 minutes agoby git

in line 179 and 180 PRINT ( t.format_url(r) )

sorry 
Hartmut


Re: [weewx-development] Windy website API under definition ?

2019-04-17 Thread Hartmut Schweidler
Hallo 

log says
Apr 17 08:00:26 wetter OWFS[24470]: restx: CWOP: packet: EW3693>APRS,TCPIP
*:@170600z5336.36N/01120.48E_067/004g010t042r000p000P000b10258h68L178.weewx-
4.0.0a4-Vantage#015
Apr 17 08:00:26 wetter OWFS[24470]: *** Traceback (most recent call last):
Apr 17 08:00:26 wetter OWFS[24470]: ***   File 
"/home/weewx/bin/weewx/restx.py", line 368, in run_loop
Apr 17 08:00:26 wetter OWFS[24470]: *** self.process_record(_record, 
dbmanager)
Apr 17 08:00:26 wetter OWFS[24470]: ***   File 
"/home/weewx/bin/weewx/restx.py", line 409, in process_record
Apr 17 08:00:26 wetter OWFS[24470]: *** _url = self.format_url(
_full_record)
Apr 17 08:00:26 wetter OWFS[24470]: ***   File 
"/home/weewx/bin/user/windy.py", line 119, in format_url
Apr 17 08:00:26 wetter OWFS[24470]: *** data = self.get_data(record)
Apr 17 08:00:26 wetter OWFS[24470]: *** AttributeError: 'WindyThread' object 
has no attribute 'get_data'
Apr 17 08:00:26 wetter OWFS[24470]: restx: Windy: Thread terminating. Reason
: 'WindyThread' object has no attribute 'get_data'



Am Mittwoch, 17. April 2019 07:48:35 UTC+2 schrieb mwall:
>
> please try the latest (at least commit 71d72da 
> 
>  
>
> i had to revert to using http GET instead of POST because the windy.com 
> server won't accept what looks like a properly encoded JSON request (and 
> they provide no feedback about why)
>
>

Re: [weewx-development] Windy website API under definition ?

2019-04-16 Thread mwall
please try the latest (at least commit 71d72da 

 

i had to revert to using http GET instead of POST because the windy.com 
server won't accept what looks like a properly encoded JSON request (and 
they provide no feedback about why)



Re: [weewx-development] Windy website API under definition ?

2019-04-16 Thread Hartmut Schweidler
good Morning

log says windy.py 
Apr 17 07:05:26 wetter OWFS[18427]: *** Traceback (most recent call last):
Apr 17 07:05:26 wetter OWFS[18427]: ***   File 
"/home/weewx/bin/weewx/restx.py", line 368, in run_loop
Apr 17 07:05:26 wetter OWFS[18427]: *** self.process_record(_record, 
dbmanager)
Apr 17 07:05:26 wetter OWFS[18427]: ***   File 
"/home/weewx/bin/weewx/restx.py", line 413, in process_record
Apr 17 07:05:26 wetter OWFS[18427]: *** _payload = self.get_post_body(
_full_record)
Apr 17 07:05:26 wetter OWFS[18427]: ***   File 
"/home/weewx/bin/user/windy.py", line 126, in get_post_body
Apr 17 07:05:26 wetter OWFS[18427]: *** data['dateutc'] = 
time.strftime("%Y-%m-%d 
%H:%M:%S",
Apr 17 07:05:26 wetter OWFS[18427]: *** NameError: name 'time' is not 
defined
Apr 17 07:05:26 wetter OWFS[18427]: restx: Windy: Thread terminating. Reason
: name 'time' is not defined
Apr 17 07:05:26 wetter OWFS[18427]: cheetahgenerator: using search list 


Hartmut


Am Mittwoch, 17. April 2019 04:45:41 UTC+2 schrieb mwall:
>
> the weewx-windy uploader should work with python3 now
>
> please try it and let me know how it works for you
>
> sorry i cannot test it fully - windy.com is refusing my attempts to 
> create test stations
>


Re: [weewx-development] Windy website API under definition ?

2019-04-16 Thread mwall
the weewx-windy uploader should work with python3 now

please try it and let me know how it works for you

sorry i cannot test it fully - windy.com is refusing my attempts to create 
test stations


Re: [weewx-development] Windy website API under definition ?

2019-04-16 Thread Hartmut Schweidler
Hallo

how can i use windy.py for python3

Hartmut


Re: [weewx-development] Windy website API under definition ?

2019-04-15 Thread Wysiwyg
Hello !

Oh my god guys, Internet is going too fast for me now :-)
yesterday I discover a discussion about an API project, I share a message 
about before going to sleep.
When I wake upTom discovered it's already available, Matthew already 
developed a driver. :-O
Are we living in the same spacetime universe?
(Sorry for my poor jokes, it's early here).

Glad to see some interest !! I look forward to try it !! :-)






Le mardi 16 avril 2019 06:27:14 UTC+2, mwall a écrit :
>
> here is an uploader for windy:
>
> https://github.com/matthewwall/weewx-windy
>
> unfortunately it is not yet working - when i hit node.windy.com i get:
>
> Cannot GET /pws/update
>
>
> i'm guessing its an https thing...
>
>
> m
>
>

Re: [weewx-development] Windy website API under definition ?

2019-04-15 Thread mwall
here is an uploader for windy:

https://github.com/matthewwall/weewx-windy

unfortunately it is not yet working - when i hit node.windy.com i get:

Cannot GET /pws/update


i'm guessing its an https thing...


m



Re: [weewx-development] Windy website API under definition ?

2019-04-15 Thread Thomas Keffer
Looks like they just published their API, all of 10 hours ago!

https://community.windy.com/topic/8168/report-you-weather-station-data-to-windy/2

On Mon, Apr 15, 2019 at 4:18 PM Wysiwyg  wrote:

>
> Dear weewx developer community,
>
> I'm a playing a bit currently with "Belchertown" very nice weewx skin (
> https://github.com/poblabs/weewx-belchertown).
>
> This skins uses "windy" (https://www.windy.com/) to display rain radar +
> thunder map.
> Windy seems to provide several maps layers, android app and I must say
> their wind map look very cool :-)
>
> While checking in their forum if they deal with PWS, I discovered this
> page:
> https://community.windy.com/topic/7551/would-you-like-to-report-your-weather-station-data-to-windy
> I don't know windy very much (I discovered them recently), I don't have
> any personal interest in this except I find their maps "cool" :-)
> but the last link I share above looks very open-minded & friendly so I
> wanted to share with you guys
> Maybe some of you may like to give them some hints for their question #4
> on how they could interface with the great WeeWX, or what could be best
> practice in such API ...
>
>
>
>