Skip to content

Commit

Permalink
#5 and #6 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ronhks committed Aug 20, 2022
1 parent 1134ae9 commit 2aa1f0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ require (
require (
github.com/gorilla/websocket v1.4.2 // indirect
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 // indirect
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect
)

//replace github.com/ronhks/panasonic-aquarea-smart-cloud-mqtt => ./src

2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 h1:Sx/u41w+OwrInGdEckYmEuU5gHoGSL4QbDz3S9s6j4U=
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ func startQueryStatusData() {
func initializeTheEnvironment() {
httputils.InitHttpClient()
mqtt.InitMqttConnection()
setLogSetup()

}

func setLogSetup() {
log.SetFormatter(&log.TextFormatter{
FullTimestamp: true,
})
log.SetReportCaller(true)
}

func loginAndGetContract() error {
Expand Down
2 changes: 1 addition & 1 deletion src/data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func GetDeviceData() (StatusData, error) {

const referer = "https://aquarea-smart.panasonic.com/remote/a2wEnergyConsumption?keepState=true"
response, err := httputils.GetREQ(deviceDataURLWithDeviceID, referer)
if response != nil {
if response == nil {
err = errors.New("Empty response from Energy Conspumption API")
}

Expand Down

0 comments on commit 2aa1f0a

Please sign in to comment.