Ask / Submit
31

[Xperia X] Situations app

asked 2017-11-01 21:45:45 +0300

rob_kouw gravatar image

updated 2017-11-02 16:04:52 +0300

The wonderful Situations app by hhaveri is not working on SailfishX / Xperia X. For years, I let Situations put my phone to airplane mode at midnight, and revive at 7:00. On the Xperia X, it does not work.

In the Store there is a discussion going on in the Comments of this app, where hhaveri states:

Please everyone send feedback to Jolla about the broken BT, WiFi and airplane mode. They broke the APIs. However, location & volume controls seem to work at least on my Jolla 1 & tablet. Cannot verify/fix with other devices at least for now.

[Edit]
I happily used two types of situations over the past years. Detection works fine, activation does not (apparently due to privilege issues.)
1 When: Sleeping, time based from 23:59 - 07:00
   What: Activate Airplane mode
2 When: At home/work (based on cell towers) (and not Sleeping)
   What: Activate WiFi

edit retag flag offensive close delete

Comments

Situations app works for me as far as WIFI is concerned when connected to certain wifi correctly switches situation.

XFish ( 2017-11-02 01:26:13 +0300 )edit
2

Jolla support has yesterday received the note for APIs problematic. Let us hope that the situation of Situations will be improved. 😊

N9Sailfish ( 2017-11-03 12:54:54 +0300 )edit

On Intex Aqua Fish, situations also started to malfunction (cannot swtich on BT) since 2.1.2.3

Bart S ( 2017-11-04 16:52:30 +0300 )edit

5 Answers

Sort by » oldest newest most voted
7

answered 2017-11-02 09:20:47 +0300

ziellos gravatar image

The situations app works as it should, also on the Xperia X. The problem is that Jolla changed the necessary privileges for switching Wifi, Bluetooth, and airplane mode in one of the recent Sailfish OS updates. A non-privileged app like Situations isn't allowed to change these settings anymore.

The workaround is to create simple wrapper scripts that can be invoked by Situations via a sudo command (in order to provide the necessary root privileges). The basics are described here and in some linked articles.

With this configuration, Situations is able to control flight mode on my Xperia X.

edit flag offensive delete publish link more

Comments

6

The above answer is again the "coder's" way of going around a preoblem and it is OK but not for the 95% of non coder people. Give the app the necessary permissions from the start so it can behave as it always did and should.

I do also use the app but I ask it to just switch to 2G and cut off internet for the night and that works like it should.

Maximilian1st ( 2017-11-02 15:23:51 +0300 )edit
3

I don't mind applying some lines of code now and then, but I'm with hhaveri on this issue. It wasn't very nice of Jolla to change the API rules without some backward compatibility. Why not create an option to Apps - under Settings - so I can grant this right to the Situations app?

In other words: I'm happy to find Situations in the App Store. It gets a bit strange when I need Schturman's hack to have it automatically starting. And now I need another hack around new privilege rules.

Thanks for the url, and I will probably get into it. But I hope Jolla can officially reply too.

rob_kouw ( 2017-11-02 15:57:08 +0300 )edit
1

@rob_kouw i think we need something like the "Super SU" App for Android, but unlike. ;) an app or settings dialog where the user can decide, which app get which permission.

breiti_oi ( 2017-11-02 16:07:09 +0300 )edit

It did work flawlessly without coding skills on the earlier sailfish. Since 2.1.2.3 at least BT cannot be switched ON anymore by the situations app. This should simply work or there should be a setting inside sailfish where an app can be given the rights to change BT (and other) settings.... all out of the box !

Bart S ( 2017-11-04 16:50:26 +0300 )edit
7

answered 2017-11-03 19:15:42 +0300

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2017-11-03 19:15:42 +0300

I solved that easier. Installs WIFI ON and BT ON and uses the action command line in situations. This action you can also used multiple times! First I also did not know that.

line for WIFI Off: usr/share/openrepos-wifionoff/stop-wifi-root

line for WIFI ON: usr/share/openrepos-wifionoff/start-wifi-root

line for BT OFF: usr/share/openrepos-bluetoothonoff2/stop-bt2-root

line for BT ON: usr/share/openrepos-bluetoothonoff2/start-bt2-root

to play a sound when switch the sitation you can use this: "paplay /your/path"

e.g. paplay /home/nemo/Music/Situation/athome.wav

You can also read my own question and answers to this item: here I hope that helps. Have fun trying.

edit flag offensive delete publish link more

Comments

I added slashes (/) before usr and then it works perfect. Thanks for the description

mirumger ( 2017-11-08 23:22:39 +0300 )edit
5

answered 2017-11-09 17:28:02 +0300

Rolfa gravatar image

updated 2017-11-09 17:29:27 +0300

Solution with sudo - a step by step example (tested with Jolla, but should also work on Xperia):

(basic knowledge of vi editor is required)

mkdir /home/nemo/bin/

Create file /home/nemo/bin/go_online.sh with content:

#!/bin/bash
dbus-send --system --dest=com.nokia.mce --print-reply /com/nokia/mce/request com.nokia.mce.request.req_radio_states_change uint32:1 uint32:1

Create file /home/nemo/bin/go_offline.sh with content:

#!/bin/bash
dbus-send --system --dest=com.nokia.mce --print-reply /com/nokia/mce/request com.nokia.mce.request.req_radio_states_change uint32:0 uint32:1

Edit sudoers file:

sudo EDITOR=/bin/vi visudo

Insert the following lines near the end (but above #includedir) of the sudoers file:

Cmnd_Alias ONOFFLINE = /home/nemo/bin/go_offline.sh,/home/nemo/bin/go_online.sh

# syntax: user hosts = (runas) commands
nemo ALL = (ALL) NOPASSWD: ONOFFLINE

Then, in the Situations app, the two scripts can be used as commands without password:

sudo /home/nemo/bin/go_online.sh

and

sudo /home/nemo/bin/go_offline.sh
edit flag offensive delete publish link more

Comments

I tried it with Situations v3.0.134 on Xperia X and it works as described above.

Rolfa ( 2018-01-16 17:40:37 +0300 )edit
3

answered 2017-11-09 17:53:18 +0300

jollauser gravatar image

Best option to me is to extend the functionality of ambiences as described in this post and make an app like Situations apply a specific ambience.

edit flag offensive delete publish link more

Comments

Yes unfortunately Situations can't apply custom ambiences. This is also a very important item. I try to create a command line for this, but it doesn’t work.

gconftool-2 --get /desktop/meego/background/portrait/picture_filename

I found this here.

Ralf ( 2017-11-12 13:24:32 +0300 )edit

The command to change ambience is:

dbus-send --session --print-reply --dest=com.jolla.ambienced /com/jolla/ambienced com.jolla.ambienced.setAmbience string:"file://usr/share/ambience/urban/urban.ambience"

phklrz ( 2018-02-12 19:15:11 +0300 )edit
3

answered 2018-02-11 21:10:30 +0300

Holger gravatar image

updated 2018-02-11 21:13:49 +0300

Here is the easiest way: use connmanctl with the command option in Situations: "connmanctl enable offline" to switch to airplane mode in the evenning, and "connmanctl disable offline" to switch back in the morning. Works even as non-root!

edit flag offensive delete publish link more

Comments

However,

connmanctl enable/disable wifi/bluetooth

does require to be root !

phklrz ( 2018-02-12 12:56:17 +0300 )edit
Login/Signup to Answer

Question tools

Follow
20 followers

Stats

Asked: 2017-11-01 21:45:45 +0300

Seen: 1,819 times

Last updated: Feb 11