[How-To] Situations App

Pre-amble
A How-To for the Situations profile app on SFOS (Pastilli Labs, via Jolla Store).

Scope of topic
Starter information is hosted by app owner at https://pastillilabs.com/situations/ : this topic is intended to complement that information with respect to SFOS.


Starter
While this How-To is intended for the broad community, my experience is miserably limited to observation of UI behaviour without scripting, and following notes are of this nature:

Manual Control
A profile can be manually activated/de-activated by entering the settings of that profile.

Situation Activity Indicators (Flags)
Both green and yellow flags are used to indicate that a profile is active (ON); the difference signifies the logical status of the (combined) ‘When’ condition:-

  • Green: Active AND (When = TRUE)

  • Yellow: Active AND (When = FALSE, or there are no When conditions)

  • None: Inactive

Actions at Profile (‘Situation’) De-Activation
While the expected purpose is for the App to modify phone settings when a profile is activated, you may be surprised that any OFF-ON settings shown will also be toggled when de-activated.
For simplicity, therefore, any settings which you wish to control by other means - e.g. you rarely use BT and want it normally off - may be best removed entirely from profiles used (hold and drag to waste-bin).

App vs User Control of Parameters
The App merely modifies the phone settings at the moment of profile activation/de-activation; it does not appear to prevent user control.
While not verified, by extension it seems reasonable to assume that other apps are not barred from simultaneous control of mutual settings (should that affect you).

Action Precedence in "overlapping actions"
While https://pastillilabs.com/faq/ (FAQ#1) states that profile precedence is set by the profile ordering, I have not found this to be the case (YMMV).

Automation and Profile Disabling
As long as ‘Situations’ is running, each profile will automatically trigger according to the saved ‘When’ conditions.
Unwanted profiles can of course be deleted; however, they are not recoverable directly through the app (NB for file locations, see post below), nor are they (normally) restored on re-installation.
A workaround to having it both ways, effectively disabling unwanted profiles, is to add impossible AND conditions under ‘When’.

Re-installation
Re-installation restores profiles from the previous installation (i.e. files are not deleted on un-installation), while not restoring any defaults which were previously moved to trash.

Additional Parameters/Add-Ons
Additional parameters (add-ons) can be added via ‘Features’ in pull-down. I found ‘Display’ useful (see next tip).

Use in Power Conservation
Battery consumption can be reduced while device is not in use by application of ‘Display’ feature. In my case, much power was going toward the WLAN function while not in use, so I created a new profile which triggers disabling of WLAN when display is off.

Launch Action
My reading of the intended behaviour was that if a profile is asked to launch an app which is already running, the app should not be launched again.
Specifically with TintOverlay, however, in certain (not all) cases I found that - if already running in the background - profiles triggered TintOverlay to activate (unwanted) into the foreground again (YMMV).
NB there is no UI option of launching into the background.

Situations Auto-start and Schturman 'Auto-start’
It would appear that Situations auto-runs at start-up (and therefore Auto-start (Schturman) might have been superseded by up-issue).
While other actions seem correctly triggered, my finding is that Situations does not perform launch actions at OS start-up (tested: WLAN(Y), TintOverlay(N), Gallery(N)). Please see below post and kindly report here if tried.

Corrections and additions to this post are encouraged. :grinning:

14 Likes

Regarding your auto-start issue with TintOverlay, maybe you should try the solution given in https://together.jolla.com/question/404/autostart-applications/?answer=11430#post-id-11430 which basically creates a systemd service which consists of a shell script where all the auto-startable things can then be put. I used this approach for auto-starting Situations app back when there still was no other way (no autostart app available yet, or at least I hadn’t found it) and basically used that until Situations got the auto-starting functionality built in.

1 Like

One might also want to back up the situations (profiles) before doing any dramatic changes just as a precaution. Not because the app itself would mess things up (I don’t remember that ever happening) but because one might make a mistake when doing complex changes, which them might not ever work as intended). The application saves all its data under /home/nemo/.local/share/harbour-situations2application/harbour-situations2application/situations2, the actions, conditions etc being in situations.json file.

I would not recommend trying to modify that file manually except when absolutely sure what one is doing (and having a back-up available), but I’ve once had to reconfigure some cell based conditions that way (since there’s no way to copy cell locations in the app itself, and re-learning all of the cells would sometimes be pretty slow process).

1 Like

(Update on this part: please see new post Auto-Start good, Background Launch bad (Tint Overlay))

About situation(profile) disabling. Swiping situation to left locks current status. Swiping right toggles it. Tapping play/stop icon brings timer to toggle action.

3 Likes

Thanks for great tips. I have noticed glimpses of that but didn’t pay enough attention to recognise. Very useful!

You’re welcome. I found out about timers myself by accident. :innocent:

NOTE 2 on the Jolla Store page for Situations reads:" Due to changes in Sailfish OS, some features only work when the app is launched as root"
Q1: what are the affected features ?
Q2: how to launch Situation ‘as root’ ?

1 Like

Hi, folks.
Could someone please help me setting up Situations app to launch Amazfish and connect to my Amazfit Bip watch once I turn on Bluetooth?
thx in advance

Anyone? Pretty please… ^^

Shouldn’t be too complicated really.

  1. New Situation → give a name → purpose empty (-> optional select icon)
  2. When → “Bluetooth State” == on
  3. (optional) When → “Bluetooth Devices” == “Amazfit Device”
  4. What → Launch → Select Amazfish

Done.
The one thing you can’t do easily is to force connection to a specific device. You need to do that with “Connect Automatically” in the Bluetooth Settings, not in Situations.

Did you try at all? What does not work?

1 Like

Yeah, it’s actually pretty simple. I just didn’t know that you can select two ‘Whens’.
Thank you very much.
As for ‘Connect Automatically’, I’m afraid I don’t have that option in the BT settings menu. The only option I have is ‘Always allow connections from this device’. Is that it (that was turned on the entire time)??

Maybe something can be done using dbus:

Shell version:

Python version:

Once such a script works, you can call it from Situations using the “What->Run Command” thing.

Something like dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_11_22_33_44_55/ org.bluez.Device1.Connect, with 11_22_33_44_55 being the BT address (like MAC) of the Amazfit.

1 Like

That’s amazing! Thank you so much! I’ll meddle with this as soon as I have a bit of leisure time.

I get message “Background process connection failed :(” when I restart my Xperia 10 ii. After installation it works. Is there something I could do to fix it?

I know there is an Export function to allow a back up of the settings but this doesn’t work. I’m guessing due to SailJail limitations. Unlike with SailOTP, where you can change the file path to the Documents folder, you cannot specify another file path to export the Situations settings.

How do you back up the settings? I want to do a clean re-install of sailfish to fix a few annoying glitches and don’t want to have to redo all the Situations settings.

Is the only way to copy the situations.json file listed above in esatikka’s post and then copy it back into that same location.

The Export option works if you start the app from Terminal

1 Like

Thank you. Being a Terminal novice it worked, once I’d figured out the correct method to launch the app in terminal.

You need to go and find the actual name used. Typing in Situations to start the app will get you nowhere. You need to type in something like “harbour-situations2application” in terminal

Now trying to import the backup file. I start Situations from Terminal and choose import. The file path/name offered appears to be correct. The import appears to start but everything stops with an opaque screen where you can just see the icons for the various situations none of which seem to be the any of the ones that were backed up.

There was this message in Terminal. QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory.

I haven’t been able to get my Amazfit GTR2 connected yet. (problems getting the bluetooth info file edited to work with the watrch). Perhaps there is an error with the Situation notification to the watch that’s causing the import to fail?

Hmmm. Any ideas.

I think I’ve found my problem. It’s basically the same problem I had with restoring some of the other backups after I had re-installed Sailfish Prior to the re-install the application files were in /home/nemo/folder/file but with the re-install they are now in /home/defaultuser/folder/file.

When I look in the .json file I see references to /home/nemo which of course no longer exist. I expect these references need to be /home/defaultuser.

Am I correct in my assumptions? If so is there a way to rectify this?

I used the instructions here to solve the original problems I had with the restore process. [3.4.0 onwards?] Restore backup fails when restoring notes (here: from Xperia X to Xperia 10 II )

Will something like this work to restore my backup for Situations?

Edit

I created the symlink as shown in the linked thread and put the .json file into the folder where Situations wanted to import from, ran Situations from Terminal and the restore worked. :slight_smile:

Now to see if I can achieve the same for Barwal.

Edit 2
Hmmm, Situations ran once then crashed and will not run. It starts to launch then crashes. Back to the drawing board.

Edit 3

Had a DBus issue. Completely un-installed Situations and all the Sonar files and directories that were listed by searching in File Browser. Re-installed and it works again.