Owntracks Entity does not update as expected
-
Me again
Bare metal install of latest-22274-24dfd72c on Debian Bullseye on an Intel NUC.I definitely traversed the region boundary this afternoon. In the Mostquito log I can see:
1665508761: Client catmancatmaniphone disconnected. 1665508821: Socket error on client catmancatmaniphone, disconnecting. 1665508821: New client connected from 192.168.70.1 as catmancatmaniphone (c0, k60, u'catman'). 1665508821: owntracks/catman/catmaniphone 1665508821: Sending CONNACK to catmancatmaniphone (1, 0) 1665508821: Received PUBLISH from catmancatmaniphone (d0, q1, r1, m32, 'owntracks/catman/catmaniphone', ... (241 bytes)) 1665508821: Sending PUBACK to catmancatmaniphone (Mid: 32) 1665508821: Sending PUBLISH to reactor_openluup_mqqt (d0, q0, r0, m0, 'owntracks/catman/catmaniphone', ... (241 bytes)) 1665508821: Sending PUBLISH to catmancatmaniphone (d0, q1, r0, m264, 'owntracks/catman/catmaniphone', ... (241 bytes)) 1665508821: Received PUBACK from catmancatmaniphone (Mid: 264) 1665508825: Received DISCONNECT from catmancatmaniphone 1665508825: Client catmancatmaniphone disconnected. 1665508974: Sending PUBLISH to rachel49610FDD9BED4C648D4F36DC952B61BC (d0, q1, r0, m392, 'owntracks/catman/catmaniphone', ... (195 bytes)) 1665508974: Sending PUBLISH to rachel49610FDD9BED4C648D4F36DC952B61BC (d0, q1, r0, m393, 'owntracks/catman/catmaniphone', ... (200 bytes)) 1665508974: Sending PUBLISH to rachel49610FDD9BED4C648D4F36DC952B61BC (d0, q1, r0, m394, 'owntracks/catman/catmaniphone', ... (241 bytes)) 1665511338: Socket error on client catmancatmaniphone, disconnecting. 1665511338: New client connected from 192.168.70.1 as catmancatmaniphone (c0, k60, u'catman'). 1665511338: owntracks/catman/catmaniphone 1665511338: Sending CONNACK to catmancatmaniphone (1, 0
The entries at 1665508401 correlate with my phone entering the region and immediately publishing the fact to my wite's pone (which makes sense and seem to indicate that Owntracks and Mosquitto are correctly configured.
1665508401 is 1805 local time (Zulu +1)
MSR logs:
[latest-22274]2022-10-11T16:50:41.344Z <VeraController:CRIT> *Entity#vera>device_20631 [latest-22274]2022-10-11T17:00:00.002Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) starting evaluation; because timer-trigger Timer#rule-l6gxvycu [latest-22274]2022-10-11T17:00:00.005Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) evaluated; trigger state unchanged (false); rule state remains RESET [latest-22274]2022-10-11T17:00:00.007Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) evaluation complete [latest-22274]2022-10-11T17:00:00.007Z <Rule:INFO> Morning Heating (Rule#rule-l60fkpo3) starting evaluation; because timer-trigger Timer#rule-l60fkpo3 [latest-22274]2022-10-11T17:00:00.013Z <Rule:INFO> Morning Heating (Rule#rule-l60fkpo3) evaluated; trigger state unchanged (false); rule state remains RESET [latest-22274]2022-10-11T17:00:00.014Z <Rule:INFO> Morning Heating (Rule#rule-l60fkpo3) evaluation complete [latest-22274]2022-10-11T17:00:00.015Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) starting evaluation; because timer-trigger Timer#rule-l6gxvycu [latest-22274]2022-10-11T17:00:00.016Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) evaluated; trigger state unchanged (false); rule state remains RESET [latest-22274]2022-10-11T17:00:00.017Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) evaluation complete [latest-22274]2022-10-11T17:00:00.023Z <Rule:INFO> Morning Heating (Rule#rule-l60fkpo3) starting evaluation; because timer-trigger Timer#rule-l60fkpo3 [latest-22274]2022-10-11T17:00:00.025Z <Rule:INFO> Morning Heating (Rule#rule-l60fkpo3) evaluated; trigger state unchanged (false); rule state remains RESET [latest-22274]2022-10-11T17:00:00.025Z <Rule:INFO> Morning Heating (Rule#rule-l60fkpo3) evaluation complete [latest-22274]2022-10-11T17:00:05.003Z <Engine:INFO> [Engine]Engine#1 master timer tick, local time "10/11/2022, 6:00:05 PM" (TZ offset 60 mins from UTC) [latest-22274]2022-10-11T17:15:00.008Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) starting evaluation; because timer-trigger Timer#rule-l6gxvycu [latest-22274]2022-10-11T17:15:00.011Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) evaluated; trigger state unchanged (false); rule state remains RESET [latest-22274]2022-10-11T17:15:00.013Z <Rule:INFO> Morning Lights (Rule#rule-l6gxvycu) evaluation complete
reactor.yaml for the entity:
- id: mqqt enabled: true implementation: MQTTController name: Mosquito config: source: "mqtt://192.168.70.249:8883/" username: xxxxx password: xxxxx entities: catman_iphone: name: "Catman Phone" topic: catmaniphone uses_template: owntracks_in_region region: Home2
Owntracks config screen:
Owntracks region
I'm going away tomorrow. Please save me from myself!
TIA
C
-
I'm not sure your topic is correct in config. Try owntracks/catman/catmaniphone
I'm away from my PC so I couldn't double check the template, but I'll definitely try it.
Thanks, pretty sure (as mentioned in another thread) it's right. Here's the template:
# owntracks_in_region # Receive OwnTracks location updates and drive a binary sensor that tells if a designated device # is in a given region or not (e.g. is Dad home?). The topic is the "Device ID" configured in the # OwnTracks app (under Identification). The regionName is the name of a region defined in the app. # Requires: topic, regionName owntracks_in_region: capabilities: [ binary_sensor ] primary_attribute: binary_sensor.state type: BinarySensor events: "owntracks/user/%topic%": "binary_sensor.state": json_payload: true if_expr: "payload._type == 'location'" expr: > ( first region in ( payload.inregions ?? [] ) with region == regionName: true ) ?? false
Still think I I should change. Looks to me like it should just be catmaniphone?
C
-
I see the issue... for some reason, your phone is publishing the topic
owntracks/catman/catmaniphone
, where it seems most others getowntracks/user/catmaniphone
... it must be possible to set theuser
part somewhere in the app, although I'm not sure where.No worries. Update the template (in
mqtt_device.yaml
-- just this once, I normally don't encourage modifying system files) -- make the lines look like this:events: "owntracks/%user%/%topic%":
And then add
user: catman
to your entity config indented the same as thetopic
andname
lines.Edit: also the
region
line in your entity config should sayregionName: Home2
Edit2: Mystery solved. The
user
portion of the topic is the username defined in the Identification section of Owntracks preferences, and it is set whether login with password is used or not. I've already updated the template for the next version of MQTTController to incorporate the change above. -
C CatmanV2 has marked this topic as solved on
-
T toggledbits locked this topic on