mirror of
https://github.com/nikdoof/hapz2m.git
synced 2026-01-30 06:58:14 +00:00
Added debug mode for more verbose logging
Also had to rename the existing DEBUG consts to DEVMODE, so as to not confuse the two. DEVMODE is meant for developers and cannot be enabled on-the-fly, whereas debug mode is for users to check that the bridge is working, MQTT messages are received etc. Update logging is throttled to avoid spurious messages for uncoalesced MQTT updates and motion sensors. On my network with 10 devices, an update is logged every 1-2 minutes on average.
This commit is contained in:
7
z2m.go
7
z2m.go
@@ -13,7 +13,8 @@ import (
|
||||
"github.com/brutella/hap/service"
|
||||
)
|
||||
|
||||
const Z2M_DEBUG = false
|
||||
// show more messages for developers
|
||||
const Z2M_DEVMODE = false
|
||||
|
||||
// exposed properties to ignore
|
||||
var IgnoreProperties = map[string]bool{
|
||||
@@ -47,7 +48,7 @@ func createAccessory(dev *Device) (*accessory.A, []*ExposeMapping, error) {
|
||||
return nil, nil, ErrMalfomedDevice
|
||||
}
|
||||
|
||||
if Z2M_DEBUG {
|
||||
if Z2M_DEVMODE {
|
||||
fmt.Printf("%s %s %d\n", dev.Definition.Model, dev.Definition.Vendor, dev.NetworkAddress)
|
||||
for _, exp := range dev.Definition.Exposes {
|
||||
ignored := ""
|
||||
@@ -90,7 +91,7 @@ func createAccessory(dev *Device) (*accessory.A, []*ExposeMapping, error) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if Z2M_DEBUG {
|
||||
if Z2M_DEVMODE {
|
||||
f := runtime.FuncForPC(reflect.ValueOf(createFunc).Pointer())
|
||||
fmt.Printf("----- %s -----\n", f.Name())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user