Weatherbit.io

Is there a way to use weatherbit.io in OH3? In OH2 I used for it the Weather-Binding-V1.

Hi,
I just had a glance on the API definition on their site and it should be doable with the HTTP binding.
Just send an HTTP request with your API and assign the JSON content reply to your Items via JSONPATH.
Joerg
BTW. Most Weather bindings (and others) are more or less doing the same and just doing the assignment to channels upfront to ease the work for you/us)

Thanks, that works fine. So here a short summery how to set it up:

  • Install HTTP Binding and JSONPATH Transformation

  • Create a manual HTTP Binding thing with Base URL https://api.weatherbit.io/v2.0/current?lat=<lat>&lon=<lon>&key=<api-key> with id “weatherbit_current” and Refresh Time “600

  • Add a String Channel with id “data

  • Define Items:

    String Weatherbit_Description "Description [%s]" { channel="http:url:weatherbit_current:data"[profile="transform:JSONPATH", function="$.data[*].weather.description"]}
    String Weatherbit_Temp "Temperature [%s]" { channel="http:url:weatherbit_current:data"[profile="transform:JSONPATH", function="$.data[*].temp"]}
    String Weatherbit_WindSpeed "Wind Speed [%s]" { channel="http:url:weatherbit_current:data"[profile="transform:JSONPATH", function="$.data[*].wind_spd"]}
    String Weatherbit_Clouds "Clouds [%s]" { channel="http:url:weatherbit_current:data"[profile="transform:JSONPATH", function="$.data[*].clouds"]}
    

For forcast you can define it like this:

  • Create a manual HTTP Binding thing with Base URL https://api.weatherbit.io/v2.0/forecast/daily?lat=<lat>&lon=<lon>&key=<api-key> with id “weatherbit_forecast” and Refresh Time “600

  • Add a String Channel with id “data

  • Define Items:

    String Weatherbit_Tomorrow_Clouds "Clouds [%s]" { channel="http:url:weatherbit_forecast:data"[profile="transform:JSONPATH", function="$.data[1].clouds"]}
    String Weatherbit_Tomorrow_Description "Description [%s]" { channel="http:url:weatherbit_forecast:data"[profile="transform:JSONPATH", function="$.data[1].weather.description"]}
    String Weatherbit_Tomorrow_Temp "Temperature [%s]" { channel="http:url:weatherbit_forecast:data"[profile="transform:JSONPATH", function="$.data[1].temp"]}
    String Weatherbit_Tomorrow_WindSpeed "Wind Speed [%s]" { channel="http:url:weatherbit_forecast:data"[profile="transform:JSONPATH", function="$.data[1].wind_spd"]}

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.