Using OpenWeather One Call API

85 views
Skip to first unread message

Harry

unread,
Feb 27, 2023, 12:43:17 PM2/27/23
to Tasker
Trying to us AutoTools Json Read to get weather data from OpenWeather using their API. My   AutoTools Json Read settings are :
 Simple Mode


Json Root Variable: Json

All other entries are not set.

When I run the task I get an error:
12.39.30/ActionArgBundle key: SortArrayKey: replace <null> String value with null
12.39.30/ActionArgBundle key: JsonRootVariable: replace <null> String value with null
12.39.30/ActionArgBundle key: SortArrayObjectKey: replace <null> String value with null
12.39.30/ActionArgBundle key: MatchField: replace <null> String value with null
12.39.30/ActionArgBundle key: MatchValue: replace <null> String value with null
12.39.30/ActionArgBundle key: VariableName: replace <null> String value with null
12.39.30/ActionArgBundle key: MaxResults: replace <null> String value with null
12.39.30/ActionArgBundle key: Max: replace <null> String value with null
12.39.30/ActionArgBundle key: Min: replace <null> String value with null
12.39.30/ActionArgBundle key: Sum: replace <null> String value with null
12.39.30/ActionArgBundle key: Query: replace <null> String value with null
12.39.30/ActionArgBundle key: InputFormat: replace <null> String value with null
12.39.30/ActionArgBundle key: JoinOutputArray: replace <null> String value with null
12.39.30/ActionArgBundle key: Average: replace <null> String value with null
12.39.30/Variables doreplresult: |%JsonData| -> |%JsonData|
12.39.30/E FIRE PLUGIN: AutoTools Json Read / com.twofortyfouram.locale.intent.action.FIRE_SETTING: 29 bundle keys
12.39.30/E AutoTools Json Read: plugin comp: com.joaomgcd.autotools/com.joaomgcd.autotools.broadcastreceiver.IntentServiceFire
12.39.30/E add wait type Plugin1 time 60
12.39.30/E add wait type Plugin1 done
12.39.30/E handlePluginFinish: taskExeID: 1 result 3
12.39.30/E pending result code
12.39.30/E add wait task
12.39.30/E Error: 1732149406
12.39.30/E Input is not valid JSON data: A JSONArray text must start with '[' at 1 [character 2 line 1]

Any help appreciated.

João Dias

unread,
Feb 28, 2023, 4:07:22 AM2/28/23
to tas...@googlegroups.com
Could you try using the HTTP Request action in Tasker instead and then use native JSON reading? :)

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias

Harry

unread,
Feb 28, 2023, 7:56:35 AM2/28/23
to Tasker
I can get values using the native JSON reading. Why wouldn't it work with Auto Tools Json Read?

João Dias

unread,
Feb 28, 2023, 8:13:52 AM2/28/23
to tas...@googlegroups.com
It should work with both... 😅 I was just suggesting that you should prefer the native method... Can you please post a sample JSON from the API so I can check it out?

Harry

unread,
Feb 28, 2023, 8:35:32 AM2/28/23
to Tasker
Also, when I use your example of 
  • %json.some.very.deep.path it doesn't return what I expect.

If I Flash %JsonData.temp(2) returns:
{"day":41.74,"min":27.05,"max":50.22,"night":41.07,"eve":44.44,"morn":27.05}
As expected.

If I Flash %JsonData.temp(2).min it returns:
{"day":41.74,"min":27.05,"max":50.22,"night":41.07,"eve":44.44,"morn":27.05}.min



Harry

unread,
Feb 28, 2023, 8:40:06 AM2/28/23
to Tasker
Sorry was typing reply when your reply arrived. Here is the JSON:
{"lat":40.3453,"lon":-74.9851,"timezone":"America/New_York","timezone_offset":-18000,"daily":[{"dt":1677603600,"sunrise":1677584142,"sunset":1677624581,"moonrise":1677601260,"moonset":1677569100,"moon_phase":0.29,"temp":{"day":34.65,"min":31.59,"max":36.75,"night":31.59,"eve":35.96,"morn":33.89},"feels_like":{"day":31.14,"night":26.64,"eve":30.2,"morn":25.57},"pressure":1007,"humidity":96,"dew_point":33.62,"wind_speed":12.71,"wind_deg":91,"wind_gust":31.92,"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"clouds":100,"pop":1,"rain":7.56,"uvi":0.43},{"dt":1677690000,"sunrise":1677670451,"sunset":1677711049,"moonrise":1677690600,"moonset":1677658920,"moon_phase":0.32,"temp":{"day":41.74,"min":27.05,"max":50.22,"night":41.07,"eve":44.44,"morn":27.05},"feels_like":{"day":39.52,"night":38.66,"eve":40.3,"morn":22.5},"pressure":1020,"humidity":61,"dew_point":27.14,"wind_speed":8.68,"wind_deg":196,"wind_gust":17.2,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":27,"pop":0,"uvi":3.85},{"dt":1677776400,"sunrise":1677756760,"sunset":1677797516,"moonrise":1677780300,"moonset":1677748260,"moon_phase":0.35,"temp":{"day":54.73,"min":37.81,"max":55.49,"night":37.81,"eve":46.58,"morn":42.96},"feels_like":{"day":53.82,"night":32.81,"eve":42.08,"morn":42.96},"pressure":1006,"humidity":83,"dew_point":49.33,"wind_speed":10.76,"wind_deg":318,"wind_gust":24.29,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":100,"pop":0.38,"rain":0.34,"uvi":2.29},{"dt":1677862800,"sunrise":1677843068,"sunset":1677883982,"moonrise":1677870300,"moonset":1677837180,"moon_phase":0.38,"temp":{"day":33.24,"min":32.9,"max":41.34,"night":41.29,"eve":37.06,"morn":35.82},"feels_like":{"day":24.03,"night":32.31,"eve":27.03,"morn":31.95},"pressure":1011,"humidity":99,"dew_point":32.49,"wind_speed":20.89,"wind_deg":95,"wind_gust":44.63,"weather":[{"id":616,"main":"Snow","description":"rain and snow","icon":"13d"}],"clouds":100,"pop":1,"rain":38.76,"snow":5.52,"uvi":0.47},{"dt":1677949200,"sunrise":1677929376,"sunset":1677970448,"moonrise":1677960420,"moonset":1677925740,"moon_phase":0.41,"temp":{"day":37.98,"min":36.25,"max":41.18,"night":36.81,"eve":37.51,"morn":36.55},"feels_like":{"day":37.98,"night":31.5,"eve":33.53,"morn":31.35},"pressure":1006,"humidity":90,"dew_point":34.99,"wind_speed":16.2,"wind_deg":72,"wind_gust":27.29,"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10d"}],"clouds":100,"pop":1,"rain":2.1,"uvi":0.06},{"dt":1678035600,"sunrise":1678015683,"sunset":1678056914,"moonrise":1678050540,"moonset":1678013880,"moon_phase":0.44,"temp":{"day":35.4,"min":34.93,"max":36.7,"night":34.93,"eve":36.25,"morn":36},"feels_like":{"day":31.62,"night":28.81,"eve":34.09,"morn":36},"pressure":1018,"humidity":98,"dew_point":34.57,"wind_speed":7.34,"wind_deg":307,"wind_gust":18.43,"weather":[{"id":616,"main":"Snow","description":"rain and snow","icon":"13d"}],"clouds":100,"pop":0.97,"rain":3.61,"snow":2.06,"uvi":1},{"dt":1678122000,"sunrise":1678101989,"sunset":1678143380,"moonrise":1678140720,"moonset":1678101780,"moon_phase":0.47,"temp":{"day":41.07,"min":30.09,"max":41.07,"night":31.75,"eve":35.31,"morn":30.47},"feels_like":{"day":33.44,"night":23.11,"eve":26.96,"morn":21.13},"pressure":1025,"humidity":58,"dew_point":27.05,"wind_speed":14.25,"wind_deg":325,"wind_gust":29.71,"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"clouds":7,"pop":0,"uvi":1},{"dt":1678208400,"sunrise":1678188294,"sunset":1678229845,"moonrise":1678230780,"moonset":1678189500,"moon_phase":0.5,"temp":{"day":43.29,"min":29.79,"max":43.29,"night":31.48,"eve":35.44,"morn":31.03},"feels_like":{"day":36.63,"night":24.84,"eve":28.29,"morn":22.12},"pressure":1024,"humidity":49,"dew_point":25.09,"wind_speed":13.11,"wind_deg":324,"wind_gust":29.91,"weather":[{"id":802,"main":"Clouds","description":"scattered clouds","icon":"03d"}],"clouds":33,"pop":0,"uvi":1}]}

João Dias

unread,
Feb 28, 2023, 8:48:34 AM2/28/23
to tas...@googlegroups.com
Oh I see. For now Tasker doesn't support reading from an array and then from a sub part of that array right away in the same action. If you do it in 2 separate actions it'll work :) Sorry for the trouble.

Harry

unread,
Feb 28, 2023, 9:25:28 AM2/28/23
to Tasker
Thanks, that did it.
Reply all
Reply to author
Forward
0 new messages