ESPresense / ad-espresense-ips

DEAD: See https://github.com/ESPresense/ESPresense-companion
64 stars 9 forks source link

Made a bunch of changes #21

Closed Maxakipust closed 2 years ago

Maxakipust commented 2 years ago

I rewrote a bunch of stuff to use classes (though it can probably be better). I made rooms polygons instead of squares. I find the closest polygon for the room instead of just finding a polygon that the device is in. I add history for measurements and locations. The measurements used to calculate the position is a weighted average of the measurements based on time.

I have no idea if this is correct, but it seems to be working better. I changed the error function to be inversely proportional to the distance squared.

DTTerastar commented 2 years ago

Awesome!

DTTerastar commented 2 years ago

image

It's kinda working!!!!

Maxakipust commented 2 years ago

Wooo! Any ideas why you have a few sensors without any measurements?

DTTerastar commented 2 years ago

the top right is broken in the basement, need to reflash the bottom right is probably > max_distance I've been using good earth to re-measure my house and I was WAY off

Maxakipust commented 2 years ago

I'll be curious to see how well it works with sensors of different heights and multiple floors. I'm not able to really test it myself. Adding support for polyhedron rooms will probably be difficult. I don't believe that shapely supports them. Though implementing it ourselves could be fun. Rendering may also be a challenge. I used fusion 360 and a tape measure to get my coordinates. My apartment has a few odd angles that I didn't want to measure to letting the CAD software calculate them for me was nice.

DTTerastar commented 2 years ago

I am seeing some measurement be discarded. My watch interval is erratic because it's so far away so dining frequently disappears

Maxakipust commented 2 years ago

On line 94/95 It filters out any measurements older than 10 seconds. It may help to tweak that. Either way it should probably be put as a parameter.

DTTerastar commented 2 years ago

I made it 15 and it's better

DTTerastar commented 2 years ago

My plan for floors is make a map per floor. Assign roomsplans to floors. Calc the z, pick the floor from that, then do the selection of which room constrained to floor. No polyhedron rooms needed, right?

DTTerastar commented 2 years ago

Got my floorplan improved: image

Maxakipust commented 2 years ago

Yeah. Doing that should probably work well enough for places that have very distinct floors. Stuff like stairs that lead from one floor to another may get a bit weird. It would also get weird with inaccuracies. I could see a situation where you don't have a room defined for a point on 1 floor, but you do on a second floor. If you end up with a position that is just below that room on the second floor, it wouldn't register you as being in a room even though the point is extremely close.

DTTerastar commented 2 years ago

Split level houses would cause trouble. But you could have a variable for meters per floor to work around

DTTerastar commented 2 years ago

I'm finding the mqtt read performance too low. It's missing data because we're doing too much in the mqtt receive. We really just need to add the measure, and do the position solve on a separate timer.

DTTerastar commented 2 years ago

I did get all my nodes working: image

Maxakipust commented 1 year ago

Yeah. I've been noticing it's using a significant amount of CPU time for me. We could try and switch it to only calculate the position periodically. This would also let us have an "Away" position. Or we can try and switch up the position solve to not use the minimize function. I think that may be a bit of an overkill for what we are trying to do.

DTTerastar commented 1 year ago

I honestly feel like appdaemon is kinda a dead end. It's just not made for more messages than a couple a second... I've been thinking of trying this: https://github.com/hobbyquaker/mqtt-scripts or doing something w/ NetDaemon. If none of those are suitable we can just make our own app soup to nuts.