Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected temperatures in openweathermap.org backend #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions backends/openweathermap.org.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"encoding/json"
"flag"
"fmt"
"github.com/schachmat/wego/iface"
"io/ioutil"
"log"
"net/http"
"regexp"
"strings"
"time"

"github.com/schachmat/wego/iface"
)

type openWeatherConfig struct {
Expand All @@ -31,9 +32,9 @@ type openWeatherResponse struct {
type dataBlock struct {
Dt int64 `json:"dt"`
Main struct {
TempMin float32 `json:"temp_min"`
TempMax float32 `json:"temp_max"`
Humidity int `json:"humidity"`
TempC float32 `json:"temp"`
FeelsLikeC float32 `json:"feels_like"`
Humidity int `json:"humidity"`
} `json:"main"`

Weather []struct {
Expand Down Expand Up @@ -201,8 +202,8 @@ func (c *openWeatherConfig) parseCond(dataInfo dataBlock) (iface.Cond, error) {
ret.Code = iface.CodeUnknown
ret.Desc = dataInfo.Weather[0].Description
ret.Humidity = &(dataInfo.Main.Humidity)
ret.TempC = &(dataInfo.Main.TempMin)
ret.FeelsLikeC = &(dataInfo.Main.TempMax)
ret.TempC = &(dataInfo.Main.TempC)
ret.FeelsLikeC = &(dataInfo.Main.FeelsLikeC)
if &dataInfo.Wind.Deg != nil {
p := int(dataInfo.Wind.Deg)
ret.WinddirDegree = &p
Expand Down