Skip to content

Go project to consume, persist and serve Phoscon ZigBee API's

License

Notifications You must be signed in to change notification settings

Tetragramato/go-conz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go workflow GitHub release

Go-Conz

Consume Phoscon ZigBee API to:

  • retrieve sensors information,
  • store data in a DB (Badger),
  • then serve via a HTTP Server.

For now, go-conz collect only Xiaomi aqara sensors data ( temperature, humidity and pressure), because i only own those !

Installation and Run

You should download the right release for your system, and unzip the archive :

  • Linux (arm, amd64, 386)
  • Windows (386, amd64)
  • Mac darwin (amd64)

Configuration

You can add a config file in go-conz-config.yaml, at the same level as go-conz app :

# Keys with default values
phosconUrl: "https://phoscon.de/discover"
databasePath: "./goconz-sensors"
delayInSecond: 30
traceHttp: true
httpPort: ":9000"
readOnly: false

Or your can pass configuration values to the command line if you wish :

./go-conz --databasePath=./exemple_db

Or put environment variable (the GOCONZ prefix is mandatory) :

GOCONZ_PHOSCONURL=https://phoscon.de/discover

Run

Just run with :

./go-conz

You can then open a browser and go to http://localhost:9000/sensors (if you have not changed the httpPort)

JSON structure example :

[
  {
    "uniqueId": "00:15:8d:00:09:69:6c:da-01-0492",
    "name": "kitchen sensor",
    "type": "ZHATemperature",
    "events": [
      {
        "etag": "9963da7eaf696b7020095e5227a09335",
        "lastUpdated": "2021-06-21T09:36:07.058",
        "temperature": 2568,
        "humidity": 0,
        "pressure": 0
      },
      {
        "etag": "0049fe00bff6f9dc89b24020adf3f755",
        "lastUpdated": "2021-06-21T14:56:19.732",
        "temperature": 2637,
        "humidity": 0,
        "pressure": 0
      },
      {
        "etag": "5a11d1a8355846a36e75757ae9404fbb",
        "lastUpdated": "2021-06-21T15:03:51.792",
        "temperature": 2643,
        "humidity": 0,
        "pressure": 0
      }
    ]
  }
]

events are sorted by insertion order in database.

Dependencies

  • Viper for configuration
  • Badger for database
  • Resty for REST http client & retry

About

Go project to consume, persist and serve Phoscon ZigBee API's

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages