Problem with getting life360 working with mqtt openhab

  • openHAB version: Openhab 2
  • Issue of the topic: Problem with getting life360 working with mqtt openhab

ive read Life360 and MQTT multiple times
and tried many different things but i cant make it work

i keep getting the following message:

2019-02-14 14:05:00.072 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “/etc/openhab2/scripts/life360.sh” (in directory “.”): error=13, Permission denied)

i used the same rules items and sitemap things from the Life360 and MQTT that Erkan Balci.

i think i miss something like publishing life360 messages to mqtt??
i have exec binding installed.
its my first time with using mqtt i have read a lot about it but i cant make i work.

maybe you guys can help me with this issue

What are the permissions for this file? Have you tried using sudo openhabian-config tool and selecting Apply Improvements, Fix Permissions? What mqtt binding version are you using?

i have not set special permissions for the file as i can remember. i just tried fix permissions and did a reboot afterwards.
im using binding-mqtt - 2.4.0
(after reboot still not working)

Check the permissions and owner of the files regarding scripts with ls -al /etc/openhab2/scripts. If your not sure what it should be then post the output of the command.

[20:46:21] openhabian@openHABianPi:~$ ls -al /etc/openhab2/scripts total 16 drwxrwxr-x+ 2 openhab openhabian 4096 Feb 14 20:08 . drwxrwxr-x+ 14 openhab openhabian 4096 Feb 8 22:38 .. -rw-rw-r-- 1 openhab openhabian 2827 Feb 14 20:21 life360.sh -rw-rw-r-- 1 openhab openhabian 236 Dec 17 09:01 readme.txt so then after a quick google it should be '-rwxrwxrwx' ?

Add executable to the owner and see if that changes anything.

im sorry very new to this, how can i add executable to the owner?

nevermind did this:
sudo chmod u+x /etc/openhab2/scripts

Use chmod on the script file.

Yep, that’s how to use chmod.:wink:

thnx the error message is gone. So that should work.

now i have to try to get the status from life360. at the moment it looks like nothing happens

i still can get the status of my life360 like locname, battery etc…

i have a item like

Switch PresenceW_i360Home “Wesley @ Home [%s]” {mqtt="<[mosquitto:owntracks/Wesley:state:JSONPATH($.locname):.*]"}

and my sitemap:

Text item=PresenceW_i360Home icon=“athome”

I dont understand how i can check the messages who are put on mqtt with the life360.sh script.
Is there someone who struggled with this also?
I tried: mosquitto_sub -h 192.168.1.6 -p 1883 -t owntracks/Wesley -d -u username -P password
but it seems that there is no connection to life360:

Client mosqsub/4903-openHABian sending CONNECT
Client mosqsub/4903-openHABian received CONNACK
Client mosqsub/4903-openHABian sending SUBSCRIBE (Mid: 1, Topic: owntracks/Wesley, QoS: 0)
Client mosqsub/4903-openHABian received SUBACK
Subscribed (mid: 1): 0
Client mosqsub/4903-openHABian sending PINGREQ
Client mosqsub/4903-openHABian received PINGRESP

This is an MQTTv1 configuration.

You need to create a **Broker **Thing
And then a Generic MQTT thing and create channels which you can then link to your items.

See:

1 Like

Can someone please explain more detailed how they done this with creating channels linked to the items
with the generic mqtt thing?
or is there a more easy way to do this? like someone created a mqtt 2.4.0 version of the life360 thing??

what i have done now is created a channel:
MQTT state topic: owntracks
incoming value transformation: JSONPATH:$.owntracks.status.Wesley

:sweat_smile::grimacing: really have no Idea how to set this up.

PaperUI - Things - + - MQTT Binding - Add Manually - MQTT Bridge (Insert the details of your MQTT broker)

Then

PaperUI - Things - + - MQTT Binding - Add Manually - MQTT Generic Things
Choose a Name
Choose an ID
Choose a Bridge

Open the things
Add Channels - Insert the parameters as required

Go to the things - It will display the channels with the channel names:

Copy the channel name and put in the items file:

Contact  Bathroom_Door                      "Bathroom Door [%s]"                            <door>      (Doors, Bathroom, Persist, MQTTv2)                     { channel="mqtt:topic:BathroomDoor:OpenClosed" }

i did this already but it doesn’t work.
this is what is in the shell script:

$mosquitto_pub -h $mqtt_host -p $mqtt_port -u $mqtt_user -P $mqtt_pass -t “owntracks/${firstName//”/}" -m “{“t”:“p”,“tst”:$(date +%s),“acc”:${accuracy//”/},"_type":“location”,“alt”:0,“lon”:${longitude//"/},“lat”:${latitude//"/},“batt”: ${battery//"/},“locname”: ${locationname//"/}}"

with the item that i used:

{mqtt="<[broker:owntracks/Victor:state:JSONPATH($.locname):.*]"}


really dont know how to transform this in a working generic mqtt thing.

is there a way to insall the older mqtt 1.0 binding so this will work and how can this be done?
A other solution what i looked at was life360 status via ifttt to telegram binding but i dont no and havent found a solution how to read bot messages with openhab or something.
That would also be a good solution.

transformation pattern = JSONPATH:$.locname

Please read the docs…