Closed Maxakipust closed 2 years ago
Awesome!
It's kinda working!!!!
Wooo! Any ideas why you have a few sensors without any measurements?
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
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.
I am seeing some measurement be discarded. My watch interval is erratic because it's so far away so dining frequently disappears
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.
I made it 15 and it's better
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?
Got my floorplan improved:
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.
Split level houses would cause trouble. But you could have a variable for meters per floor to work around
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.
I did get all my nodes working:
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.
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.
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.