I would like to integrate my tile PRO into openhab 3, but I am not familiar enough with python to use this:
So, just in case someone here made use of pytile (or could provide information to integrate tiles into OH another way), I would greatly appreciate some help.
Thanks in advance.
If you don’t know python at all, it’ll be hard!
I don’t have a tile tracker unfortunately, but you could easily go into the code and add some integration to openHAB using either REST API or MQTT to update your OH3 items with the properties - provided you understand at least a bit of (python) programming…
I am using pybotvac to retrieve the last map of my neato robot, but that’s just executing the script.
pytile seems to be more difficult, so I need to try.
I will post my progress here and would still be open for “accelerator”-support
I used the BT binding (FlowerCare), but was not really happy with it.
Furthermore it does not fit my needs:
Because there is some inofficial API to retrieve the location of the tile (community location), this is what I would like to make use of for geofencing (and not presence detection in BT range only).
HA!
I am able to retrieve the location with the python stuff and created the following script:
#!/usr/bin/python3
import asyncio
from aiohttp import ClientSession
from pytile import async_login
email = 'me@you.com'
password = 'geheim'
#Rucksack uuid = xxx
async def main() -> None:
"""Run!"""
async with ClientSession() as session:
api = await async_login(email, password, session)
tiles = await api.async_get_tiles()
for tile_uuid, tile in tiles.items():
print(tile.latitude,tile.longitude)
if tile.uuid == "xxx":
break
asyncio.run(main())
As I mentioned already, I am not familiar with python (yet) and would like to return the first result only (the second one is my iphone I already read using icloud binding).
So, if someone has a suggestion to get rid of the pathetic for loop with break, I am more than happy to hear about it.
Open: Read the location using REGEX into a location item.
if it works - it works! small steps.
so, the easiest part would be to use the os-capabilities and start a curl to send your information to openHAB via REST API:
I don’t know, what you mean by that, as I don’t know the tiles-API but I see “tile.latitude and tile.longitude”, I assume you already have all information on hand to just add them together like this - provided the API response is in decimal degrees:
tilePosition = tile.latitude+", "+tile.longitude
nevertheless, Regex is a cool thing, so here’s some tutorial on that:
ok. got it. you just mentioned the two main ways to incorporate Data into openHAB:
using a rule within OH to execute a commandline and use the output
using a script/program/… to execute on some machine, which sends the data to OH (via REST or MQTT)
ad 1
this one is limited to scripts/programs/… available on the OS running openHAB and of course you have to handle the output, if it’s complicated
ad 2
every machine capable of reaching either your openHAB (REST) or your broker (I’d recommend running the MQTT broker not on the same machine as your openHAB) can send data to your openHAB
that being said:
my example from earlier still works, if you combine lng and lat you can use it in your existing DSL rule and update your position item with the output.
Thank you for the summary.
That totally makes sense.
I actually used mosquitto in the past (for gps tracking), but replaced it with icloud.
However setting up mqtt is not a big deal and I will consider it.
Most of the setups here use mqtt on the same host as OH (mine definitely) and I assume it’s the “normal” use case.
So, why do you recommend to run mqtt separately?
ok, my openHAB installation is quite big (around 1.000 items, all sorts of bindings, rules …), so I want to have as much load and parallel deamons off of my openHAB Raspberry Pi.
As I use Synlogy as NAS, it serves as persistance (MariaDB), MQTT Broker (mosquitto), backup server, …
tl:>dr;
My openHAB Pi has more perfomance - and stability - dedicated for solely running openHAB and nothing else.