dariopb / ha-gosenseapp

Application that uses the gosense library to discover and publish sensor information to HA via MQTT
39 stars 12 forks source link

Sensor with no MAC #5

Open shauder opened 4 years ago

shauder commented 4 years ago

I have this phantom sensors that has no MAC or attributes. I cannot remove it since it does not have a MAC. Any ideas on how to get rid of it? This bridge has only been used with this app.

Capture

shauder commented 4 years ago

Also sometimes after a restart one of my motion sensors seems to trigger a panic then the app restarts

time="2019-11-29T21:22:06Z" level=info msg="Starting echo REST API on port 8080"
time="2019-11-29T21:22:06Z" level=info msg="Starting HA MQTT publisher to [tcp://localhost:1883]"
time="2019-11-29T21:22:06Z" level=info msg="    -> using username: [hass]"
time="2019-11-29T21:22:06Z" level=info msg="   MQTT trying to connect to: [tcp://localhost:1883]"
time="2019-11-29T21:22:06Z" level=warning msg="   MQTT sucessfully connected to: [tcp://localhost:1883]"
time="2019-11-29T21:22:06Z" level=error msg="Invalid packet lenght: 3"
time="2019-11-29T21:22:06Z" level=error msg="Error parsing buffer as packet"
time="2019-11-29T21:22:06Z" level=error msg="Invalid packet len for regular response"
time="2019-11-29T21:22:06Z" level=error msg="Error parsing buffer as packet"
time="2019-11-29T21:22:06Z" level=error msg="Invalid packet len for regular response"
time="2019-11-29T21:22:06Z" level=error msg="Error parsing buffer as packet"
time="2019-11-29T21:22:06Z" level=error msg="Invalid packet len for regular response"
time="2019-11-29T21:22:06Z" level=error msg="Error parsing buffer as packet"
time="2019-11-29T21:22:06Z" level=info msg="EVENT: time=29 Nov 19 21:22 +0000, mac: 777E0848, flags: ab, type: 2, data=0300000004000000040000003300 ==> UNKNOWN"
time="2019-11-29T21:22:09Z" level=info msg="EVENT: time=29 Nov 19 21:22 +0000, mac: 777E2715, flags: ab, type: 2, data=0100000100000100000100003b00 ==> UNKNOWN"
time="2019-11-29T21:22:11Z" level=info msg="ALARM: 777E0848, state: 0"
time="2019-11-29T21:22:11Z" level=info msg="ALARM: 777E06EE, state: 0"
time="2019-11-29T21:24:48Z" level=info msg="LOG: time=29 Nov 19 21:24 +0000, data=\xa2777D5B67\x02\x01\x00\r"
time="2019-11-29T21:24:48Z" level=info msg="ALARM: time=29 Nov 19 21:24 +0000, mac: 777D5B67, flags: a2, type: 2, battery: 99, signal: 67, state: 1, data="
time="2019-11-29T21:24:48Z" level=info msg="ALARM: 777D5B67, state: 1"
time="2019-11-29T21:25:23Z" level=info msg="LOG: time=29 Nov 19 21:25 +0000, data=\xa2777E06EE\x02\x01\x00\x13"
time="2019-11-29T21:25:23Z" level=info msg="ALARM: time=29 Nov 19 21:25 +0000, mac: 777E06EE, flags: a2, type: 2, battery: 98, signal: 50, state: 1, data="
time="2019-11-29T21:25:23Z" level=info msg="ALARM: 777E06EE, state: 1"
time="2019-11-29T21:25:24Z" level=info msg="LOG: time=29 Nov 19 21:25 +0000, data=\xa2777E0848\x02\x01\x00\x13"
time="2019-11-29T21:25:24Z" level=info msg="ALARM: time=29 Nov 19 21:25 +0000, mac: 777E0848, flags: a2, type: 2, battery: 98, signal: 52, state: 1, data="
time="2019-11-29T21:25:24Z" level=info msg="ALARM: 777E0848, state: 1"
time="2019-11-29T21:25:26Z" level=info msg="LOG: time=29 Nov 19 21:25 +0000, data=\xa2777E2715\x02\x01\x00\r"
time="2019-11-29T21:25:26Z" level=info msg="ALARM: time=29 Nov 19 21:25 +0000, mac: 777E2715, flags: a2, type: 2, battery: 98, signal: 54, state: 1, data="
time="2019-11-29T21:25:26Z" level=info msg="ALARM: 777E2715, state: 1"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x74c978]

goroutine 1 [running]:
github.com/dariopb/gosenseapp.Run()
        /home/shauder/ha-gosenseapp/gosenseapp.go:231 +0xc08
main.main()
        /home/shauder/ha-gosenseapp/cmd/gosenseapp.go:18 +0xb6
ha-gosenseapp starting...

I can usually get it working again with restarts. I am using the latest commits with my own docker hub image since yours is outdated.

raetha commented 4 years ago

@shauder I can't help with how exactly to do it with this project. But I've seen a number of sensors exhibit similar behavior in my environment. One of two things seems to cause it, the sensor goes bad, or the battery gets low and you try to pair it. When that happens, the bridge sees an invalid MAC for the sensor, but pairs with it anyway. You can unpair the sensor, but have to override most error checking in code to validate a real MAC (aka length of 8, alphanumeric). In my project (https://github.com/raetha/wyzesense2mqtt) I have a command line python tool called bridge_tool_cli.py that has a Fix function to remove the invalid paired MAC. If you have Python 3 available, snag that tool and run the fix function and see if you can remove the errant config and keep it from coming back.

Good luck!

shauder commented 4 years ago

@raetha thanks for making me aware of this. I finally got around to trying to run it against my bridge. The tools runs but it looks like I may still have the bad sensor paired. I may look into switching to your project and see if I get any better results. I did find two sensors that seemed to have issues and replaced them since. I'll let you know on your repo if I run into any issues after switching.