Giter Club home page Giter Club logo

Comments (14)

ckrey avatar ckrey commented on August 16, 2024

This is an example: You can later edit the waypoints if you use the same "rid" (region identifiers). You delete one waypoint/region by sending an invalid lat/lon e.g. (100.0,500.0)

{
	"_type": "cmd",
	"action": "setWaypoints",
	"waypoints": {
		"_type": "waypoints",
		"waypoints": [
		{
			"_type": "waypoint",
			"tst": 1708625557,
			"rid": "my-region-id-1",
			"desc": "home",
			"rad": 100,
			"lat": 30.0,
			"lon": 40.0
		},
		{
			"_type": "waypoint",
			"tst": 1708625558,
			"rid": "my-region-id-2",
			"desc": "work",
			"rad": 100,
			"lat": 30.1,
			"lon": 40.1
		}
		]
	}
}

from booklet.

jpmens avatar jpmens commented on August 16, 2024

Waypoints / regions cannot be published from the device to other users, but in Settings you can export waypoints or publish them to the server.

The latter are then stored in <STOREDIR>/waypoints/user/device/ as individual waypoints (*.json) and as all waypoints from a device (*.otrw) and can then, for example, be published as @ckrey just showed, to other users. You might need to adjust the JSON itself.

The *.otrw file can be imported into iOS.

from booklet.

whmoorejr avatar whmoorejr commented on August 16, 2024

I'm making progress. I'm testing a lot between replies to hopefully have a better understanding of where I'm at...

Outside of a device, (i.e., another computer on your network) what is the best way to publish or subscribe to events? I'm not sure if what I'm seeing is accurate, but it looks like there is a layer of screening maybe.

I have to use an owntracks username / password to log into the MQTT to subscribe or publish. That seems to work and I can see some topics (user, device and info for all devices) I was able to publish a card. Then I noticed I was logged in as the user "indigo" when I published a card to the "indigo" phone. (One of the phones running an older version that doesn't have a "card" creation option on it.) Trying to publish a card to any other device did nothing. Similarly with any cmd topic. I can publish a cmd topic to the Indigo device, but only to that one. If I adjust publish settings to owntracks/anything_besides_Indigo/myphone/cmd I don't even see any traffic on the MQTT in terminal when I'm watching sudo mosquitto_sub -v -t 'owntracks/#'

Then I realized that all the things I'm not seeing are all the things that don't publish from device to device. If on my device (owntracks/bill/myphone) I publish my waypoints, I will see it on the terminal (rPi), but I can't see it from any other application (MQTT Explorer, or from my Indigo home automation platform)

Previously, I had user names and passwords for each device and a separate login I used for my local network connections for the MQTT broker, which allowed me to publish a cmd topic to any device from another computer on my network (mainly from my home automation computer). Is this still doable? Is the behavior I'm seeing accurate?

from booklet.

jpmens avatar jpmens commented on August 16, 2024

Previously, I had user names and passwords for each device

with quicksetup you still do: you specified users in configuration.yaml and their passwords where generated into files in /usr/local/owntracks/userdata/*.pass

and a separate login I used for my local network connections for the MQTT broker

You have this as well; it's the _lr user, documented here

from booklet.

whmoorejr avatar whmoorejr commented on August 16, 2024

Interesting.
So I have the password now for the _lr user. A couple things...

  1. I didn't know there were hidden files in a raspberry pi. I'm sure that's documented somewhere, but when I looked in that folder "/usr/local/owntracks/userdata/" I didn't see a ".lr.pw"
  2. I did see two other files that I'm not sure what they are used for.... I could guess, but that typically gets me in trouble...
  • htpasswd (at first glance, it looked like a single list of all users and their password, but they aren't the same password located in user.pass)
  • recorder.pw (I assume that's a password for ot-recorder to communicate with MQTT?)

FYI: These are some of my goals for OT implementation (so you know why I'm trying to get access in different ways)

  • Firstly, use OT as a tool for the family to see where each other is to replace other geo apps (which all have implementation limits: Life360, Locative, FindFriends, Bark)
  • Perform automations for home comfort (i.e., all devices away, adjust thermostat)
  • Perform automations for reminders/notifications/awarness: All kids arrived at school. Youngest child left school (got on bus), etc.
  • Create dynamic geofence: Use a virtual button to obtain a device's location, use that data to create a temporary geofence (waypoint) on that device, enable triggers for enter/exit. Example case use: You drop a kid off at her friend's house.. but you want a notification if your child and her friend decide to wander off
  • Consider leveraging ibeacons for additional nerdiness. (I have some hardware from an abandoned project... it used rPis as beacon receivers throughout the house to triangulate indoor location... worked great, but it was a compliance issue... I couldn't convice family members to carry a blutooth card around with them.)

EDIT: Last question...for now :-) Is there a publish wildcard option: Can I publish a command to all devices? /owntracks/++/myphone/cmd (where "myphone" is the same for everyone's primary device)

from booklet.

jpmens avatar jpmens commented on August 16, 2024
  • Hidden files (filenames begining with a period) have been in Unix/Linux since decades
  • htpasswd is a file containing hashed passwords for logging into your OwnTracks web site; each user has such a password which matches the random password generated for MQTT
  • recorder.pw is a file containing a password with which the Recorder connects to your MQTT broker.

OK, I think this is going way off-topic for this issue, so I'm closing here.

Feel free to open new issues at Quicksetup.

from booklet.

jpmens avatar jpmens commented on August 16, 2024

Can I publish a command to all devices?

MQTT doesn't know how to wildcard-publish, so no. You'd have to do that individually.

from booklet.

whmoorejr avatar whmoorejr commented on August 16, 2024

Sorry, I know this should be closed. I can now sucessfully publish a cmd to any device... that's a huge win... I think my formatting for a waypoint is still off. I did verify that the cmd toggle on the device is selected. I published a waypoint, but it didn't populate on the device. This is traffic from the broker, am I missing something?
owntracks/bill/myphone/cmd { "_type": "cmd", "action": "setWaypoints", "waypoints": { "_type": "waypoints", "waypoints": [ { "_type": "waypoint", "tst": 010, "rid": "my-region-id-010", "desc": "Woodlands|1|2", "rad": 250, "lat": 30.14447, "lon": -95.51607 } ] } }

from booklet.

jpmens avatar jpmens commented on August 16, 2024

from booklet.

whmoorejr avatar whmoorejr commented on August 16, 2024

No and yes. I'm publishing with qos 1, but when I look at the message on MQTT Explorer, it shows qos 0.
That happens if I publish from within MQTT Explorer or from within my home automation system... both logged in as user "_lr"

from booklet.

ckrey avatar ckrey commented on August 16, 2024

Your problem is that 010 is not a JSON number (https://www.json.org/json-en.html)
tst here means timestamp of creation, but if you want to use the value ten (10), write 10, not 010.

from booklet.

ckrey avatar ckrey commented on August 16, 2024

log on the iPhone:

2024-02-23T15:28:45.677Z  Validation error: Error Domain=NSCocoaErrorDomain
 Code=3840 "Number with leading zero around line 1, column 127."
 UserInfo={NSDebugDescription=Number with leading zero around line 1, column 127., NSJSONSerializationErrorIndex=127}
  with
  { "_type": "cmd", "action": "setWaypoints", "waypoints": { "_type": "waypoints", "waypoints": [ { "_type": "waypoint", "tst": 010, "rid": "my-region-id-010", "desc": "Woodlands|1|2", "rad": 250, "lat": 30.14447, "lon": -95.51607 } ] } } 

from booklet.

whmoorejr avatar whmoorejr commented on August 16, 2024

That worked. Thank you Mr. Krey! It doesn't need to be "10". I just wanted to fill in the blank and make it work. I don't have a need (at the moment) to know exactly when a waypoint was created.

from booklet.

whmoorejr avatar whmoorejr commented on August 16, 2024

log on the iPhone:

Holly crap! I just now realized those were log files not logs. A quck glance after looking at the "Logs" screen, I thought, nothing much to see here, move along. Airdrop the file to my mac and presto. I'm an idiot.

Did I at least put the "|1|2" in the right spot? Documentation says to write it with the name... on the device it's "Name" on publish it's "desc".... but that should switch the phone to significant on enter and move on exit.

from booklet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.