Before I get into the problem I am having, is there a place I should be looking for example flows and documentation? Not just for find-my-iphone, but for useful real world examples to start from. I feel like I am completely reinventing the wheel each time I start to do something. I've had to resort to reading the JS source code to figure out how some of these flows work and I'm still scratching my head and struggling. IN THEORY it's super cool to drag and drop nodes to connect my iphone position to my hue lights, But IN REALITY there seems to be no documentation other than reading the source and I've literally spent hours reading code and haven't gotten anything to work. I can only imagine that a non-programmer's head would explode and fly off into the next solar system.
Are there examples of simple things like 'do some simple thing when your iphone gets within a certain distance of a lat/lon'? Is there some repository of useful flows that people have made? Not just for find-my-iphone, but other useful real world scenarios?
My current problem is I am struggling right now to get find-my-iphone to do anything useful. What I can do is inject an event manually and get it to connect to icloud, which then tells me where all my devices are, but only after I click that it's OK (apple authentication popup). I can see that the code stores a cookie when this happens, so I guess the idea is that it caches the credentials so that I don't get a popup every time. However, that's not what happens. I get a popup every time.
Problem #1. Any interaction I do with the node results in a popup. The caching doesn't seem to work and I have no idea how to debug it. I can't even figure out how to put in my own print statements in the JS to dump stuff to the log so I can trace the execution. I have no idea WHY the caching fails. (I see it makes a cookie so it should work)
Problem #2 How to get a position update either every few minutes or whenever my phone moves. Do I need to schedule a timer to poll the position? And if so, what message payload do I send to it? I tried to make a getDeviceLocation message based on what I read in the source code, but all it did was generate an authentication popup and send me the same thing I got from sending init.
Problem #3. Is there any code for managing the fact that I have numerous devices? I have a total of 6 apple devices. When I ask for position (manually with an authentication popup), I get a big dump of data for all 6 devices. if I was doing this in C++ I'd store the info about all the devices in a ram structure or to a file and then later, I'd probably iterate over all of them and get their position and then run my logic to figure out what to do?
If I can get this to work, I will happily post an example flow and tutorial to wherever such things are normally kept. I'm really excited about using node-red in my home automation adventures, but I seem to be hitting a wall.