Skip to content

Commit

Permalink
chore: Re-run helper and format text.
Browse files Browse the repository at this point in the history
  • Loading branch information
W-Floyd committed Feb 20, 2023
1 parent 02b10cc commit 355a9a5
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 42 deletions.
2 changes: 1 addition & 1 deletion devices/externaldevice/alarm_control_panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/binary_sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/button.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/camera.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/climate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/cover.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/device_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/fan.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/humidifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/number.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/siren.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "github.com/eclipse/paho.mqtt.golang"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion devices/externaldevice/vacuum.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"encoding/json"
common "github.com/W-Floyd/ha-mqtt-iot/common"
store "github.com/W-Floyd/ha-mqtt-iot/store"
mqtt "tinygo.org/x/drivers/net/mqtt"
strcase "github.com/iancoleman/strcase"
"log"
"time"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

// //////////////////////////////////////////////////////////////////////////////
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ require (
github.com/Jeffail/gabs/v2 v2.6.1
github.com/dave/jennifer v1.5.0
github.com/denisbrodbeck/machineid v1.0.1
github.com/eclipse/paho.mqtt.golang v1.4.2
github.com/ghodss/yaml v1.0.0
github.com/iancoleman/strcase v0.2.0
github.com/imdario/mergo v0.3.13
tinygo.org/x/drivers v0.24.0
)

require (
github.com/eclipse/paho.mqtt.golang v1.4.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hajimehoshi/go-jisx0208 v1.0.0/go.mod h1:yYxEStHL7lt9uL+AbdWgW9gBumwieDoZCiB1f/0X0as=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
Expand All @@ -45,8 +47,12 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
42 changes: 21 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"github.com/W-Floyd/ha-mqtt-iot/config"
ExternalDevice "github.com/W-Floyd/ha-mqtt-iot/devices/externaldevice"
"github.com/denisbrodbeck/machineid"
mqtt "tinygo.org/x/drivers/net/mqtt"
"github.com/imdario/mergo"
mqtt "tinygo.org/x/drivers/net/mqtt"
)

//go:generate go run ./helpers/
Expand Down Expand Up @@ -68,32 +68,32 @@ func main() {

devices, opts := sconfig.Convert()

// if sconfig.Logging.Debug && sconfig.Logging.Mqtt {
// mqtt.DEBUG = common.DebugLog
// }
// if sconfig.Logging.Warn {
// mqtt.WARN = common.WarnLog
// }
// if sconfig.Logging.Error {
// mqtt.ERROR = common.ErrorLog
// }
// if sconfig.Logging.Critical {
// mqtt.CRITICAL = common.CriticalLog
// }
// if sconfig.Logging.Debug && sconfig.Logging.Mqtt {
// mqtt.DEBUG = common.DebugLog
// }
// if sconfig.Logging.Warn {
// mqtt.WARN = common.WarnLog
// }
// if sconfig.Logging.Error {
// mqtt.ERROR = common.ErrorLog
// }
// if sconfig.Logging.Critical {
// mqtt.CRITICAL = common.CriticalLog
// }

common.LogState.Debug = sconfig.Logging.Debug
common.LogState.Warn = sconfig.Logging.Warn
common.LogState.Error = sconfig.Logging.Error
common.LogState.Critical = sconfig.Logging.Critical

// opts.SetOnConnectHandler(
// func(c mqtt.Client) {
// for _, d := range devices {
// common.LogDebug("Connecting " + d.GetRawId() + "." + d.GetUniqueId())
// go d.Subscribe()
// }
// },
// )
// opts.SetOnConnectHandler(
// func(c mqtt.Client) {
// for _, d := range devices {
// common.LogDebug("Connecting " + d.GetRawId() + "." + d.GetUniqueId())
// go d.Subscribe()
// }
// },
// )

client := mqtt.NewClient(opts)

Expand Down

0 comments on commit 355a9a5

Please sign in to comment.