maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Situations app - bugs, questions, answers, help etc.. (https://talk.maemo.org/showthread.php?t=94442)

hhaveri 2020-01-07 06:23

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by P@t (Post 1564182)
- I have not anymore the two-cells bug but I started with one cell while I thought it should be from zero

Situations automatically records the first cell when you start creating a new Network Cells condition. I suppose this is what happened?

Quote:

Originally Posted by P@t (Post 1564182)
- with flight mode on, the situation was still on

Very good finding, that probably needs separate handling with the new interface then.

Quote:

Originally Posted by P@t (Post 1564182)
- the situation seems to react as expected when moving but I will test more during the day

This sounds like an improvement over the previous version, so perhaps the blind implementation is on the right track :)

Quote:

Originally Posted by P@t (Post 1564182)
- enabling/disabling mobile data does not seem to work; it could be related to the fact that there is something special about having 2 sim slots.

You are probably right. Is there a separate mobile data switch for both sim slots in the system settings?

Br,
Heikki

P@t 2020-01-07 14:09

Re: Situations app - bugs, questions, answers, help etc..
 
Thanks for your blind work :)
The application seems to handle neatly cell towers.

I can confirm that there are settings to handle the possibility to use 2 sims. You can activate one or two sims, and then you can choose one or the other for mobile data. So activating mobile data for 'situations' needs likely to add which one...

nonsuch 2020-08-27 06:22

Re: Situations app - bugs, questions, answers, help etc..
 
I have been using Situations for a while.
It works well with switching wifi on and off depending on whether I'm home or not.
Now I am trying to activate BatteryBuddy when the charger is connected, and deactivate it when the charger is disconnected.
I figured out that I need the Command module for both actions, because I just want to launch the daemon.
So I have:

Name: Charging
When: Device = Charger
What: Command: harbour-batterybuddy-daemon
What: log to situations-buddy-on.txt

This works as expected. (*)

Name: Not Charging
When: Device != Charger
What: Command: /home/nemo/situations/kill-batterybuddy-daemon <=== Problem here
What: log to situations-buddy-off.txt

This works so far that the situation changes correctly when I disconnect the charger, but the command does not: first I just used "killall harbour-batterybuddy-daemon". This works when executed on the command line (ssh), but not through Situations.
Then, I wrapped it in a shell script. Again, this works when executed on the command line but not through situations. (*)

Nothing helpful in the logs (just START/STOP messages).

I told the kill script to log its activity, too, but it logs only when executed manually. Which leads me to believe that Situations does not execute the kill script at all.
Why?

(*) I am confirming with 'ps aux | grep buddy'.

nonsuch 2020-08-28 05:25

Re: Situations app - bugs, questions, answers, help etc..
 
Progress.
The command script now executes. I had to use the full path when calling it.

I had to change the script so that it takes a START and STOP option, and added full paths to all commands just to be sure, as well as some narrative for the logs:
Code:

#!/bin/bash

exec > "$HOME/situations/situations-batterybuddy.txt" 2>&1

whoami
date
echo $1

sleep 5

case $1 in
START)
if /sbin/pidof harbour-batterybuddy-daemon ; then
        echo "no action, harbour-batterybuddy-daemon is already running"
else
            echo "launching harbour-batterybuddy-daemon"
        /usr/bin/harbour-batterybuddy-daemon & disown
fi
;;
STOP)
if /sbin/pidof harbour-batterybuddy-daemon; then
        echo "killing harbour-batterybuddy-daemon"
        /usr/bin/killall -vw harbour-batterybuddy-daemon
else
            echo "not killing harbour-batterybuddy-daemon because it is not running"
fi
;;
esac

But harbour-batterybuddy-daemon neither starts nor stops, even though this works when the script is executed manually, as a normal user.

When executed manually, "$HOME/situations/situations-batterybuddy.txt" contains:
Code:

nemo
Fri Aug 28 08:18:54 EEST 2020
STOP
25045
killing harbour-batterybuddy-daemon
Killed harbour-batterybuddy-daemon(25045) with signal 15

When executed through Situations, "$HOME/situations/situations-batterybuddy.txt" contains:
Code:

nemo
Fri Aug 28 08:18:54 EEST 2020
STOP

I am stumped.

PS: this is academic; at this point itwould be much more practical to just leave BatteryBuddy running and do its thing without help from Situations, but I want to know why the Command plugin isn't doing what I think it should.

hhaveri 2020-08-29 16:31

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by nonsuch (Post 1568942)
Progress.
The command script now executes. I had to use the full path when calling it.

I had to change the script so that it takes a START and STOP option, and added full paths to all commands just to be sure, as well as some narrative for the logs:
Code:

#!/bin/bash

exec > "$HOME/situations/situations-batterybuddy.txt" 2>&1

whoami
date
echo $1

sleep 5

case $1 in
START)
if /sbin/pidof harbour-batterybuddy-daemon ; then
        echo "no action, harbour-batterybuddy-daemon is already running"
else
            echo "launching harbour-batterybuddy-daemon"
        /usr/bin/harbour-batterybuddy-daemon & disown
fi
;;
STOP)
if /sbin/pidof harbour-batterybuddy-daemon; then
        echo "killing harbour-batterybuddy-daemon"
        /usr/bin/killall -vw harbour-batterybuddy-daemon
else
            echo "not killing harbour-batterybuddy-daemon because it is not running"
fi
;;
esac

But harbour-batterybuddy-daemon neither starts nor stops, even though this works when the script is executed manually, as a normal user.

When executed manually, "$HOME/situations/situations-batterybuddy.txt" contains:
Code:

nemo
Fri Aug 28 08:18:54 EEST 2020
STOP
25045
killing harbour-batterybuddy-daemon
Killed harbour-batterybuddy-daemon(25045) with signal 15

When executed through Situations, "$HOME/situations/situations-batterybuddy.txt" contains:
Code:

nemo
Fri Aug 28 08:18:54 EEST 2020
STOP

I am stumped.

PS: this is academic; at this point itwould be much more practical to just leave BatteryBuddy running and do its thing without help from Situations, but I want to know why the Command plugin isn't doing what I think it should.

Hi,

Hard to say what the problem is, since I had no problems running your script with the command action. I'm running Situations 3.2.258 on Sailfish 3.3.0.16 (Jolla 1).

Which Situations & Sailfish version are you on?

Br,
Heikki

hhaveri 2020-08-29 16:35

Re: Situations app - bugs, questions, answers, help etc..
 
By the way, you don't need two situations to execute the scripts. You can add one command action with the "START" argument and another command action with "STOP" argument to the same situation. You just need to select "At situation end" for the latter one.

Br,
Heikki

nonsuch 2020-08-31 19:20

Re: Situations app - bugs, questions, answers, help etc..
 
^ thanks for the tip, already implemented!

SailfishOS 3.3.0.16
Situations v3.2.258
Sonar 0.0.5

I solved it!
Something weird happened to the input field for the command for When = Charger. I moved around in it with arrow keys (special keyboard layout) and suddenly there was more text than there was before. I erased it. Still didn't work.
Then I looked at ~/.local/share/harbour-situations2application/harbour-situations2application/situations2/situations.json and found that the command entry had a superfluous '\n' at the end, like so: ... START\n
Apparently this was passed to the shell script _literally_ so that the case/esac did not match.
I removed it manually (edit the .json in nano).

Solution:
- no newlines at the end of the command
and/or
- add a * to the case/esac options:
START*)
STOP*)

It is working now, batterybuddy-daemon is active when I plug the charger in, and stops when I unplug it.
It just takes a couple of minutes to switch states; I guess that's by design (taking less resources).

nonsuch 2020-08-31 19:31

Re: Situations app - bugs, questions, answers, help etc..
 
I am trying to implement the following _without GPS_:

- switch on the Wifi when I'm home
- switch it off when I'm away

I have been using the Network cells condition; it scans and finds 2 cells - does that mean cell towers?
It's been working so-so, sometimes it recognizes when I'm home, sometimes not.
Is there a better way?
I guess I cannot scan for my home wifi ssid when wifi is off?

Additionally I cannot concatenate the 2 Home/Elsewhere conditions into 1 because I cannot choose Wifi state a 2nd time in the same condition (to switch it off at condition end, instead of switching it off in a separate condition, as hhaveri told me).
Why?

hhaveri 2020-09-01 04:47

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by nonsuch (Post 1569015)
Is there a better way?

I guess Network cells (yes, basically cell towers) is your best bet. But it does have drawbacks.

First of all, if I remember correctly. it does not work well on Sailfish when the device is sleeping -> Situations might recognise cell changes only after user wakes up the device.

Secondly you need to cover (record) cells in all network technologies (2G/3G/4G/...) and over a long time span to make it as reliable as possible. But of course the location accuracy then suffers.

Quote:

Originally Posted by nonsuch (Post 1569015)
Additionally I cannot concatenate the 2 Home/Elsewhere conditions into 1 because I cannot choose Wifi state a 2nd time in the same condition (to switch it off at condition end, instead of switching it off in a separate condition, as hhaveri told me).
Why?

When a situations ends, it should restore settings like wifi state to the value before that situation was activated. So there is no need to do it explicitly. But if you want to be absolutely sure regardless of the previous state, then you can of course use another situation for it.

Br,
Heikki

nonsuch 2020-09-02 06:09

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by hhaveri (Post 1569017)
Secondly you need to cover (record) cells in all network technologies (2G/3G/4G/...) and over a long time span to make it as reliable as possible. But of course the location accuracy then suffers.

Aha!
So does that mean more is better (when Situations is scanning network cells)?

I thought maybe the logic is that ALL cells need to be present for the What to apply...
I collected 8 cells with 2 sim cards, switching all available network modes (2G/3G/4G - took almost half an hour), and still Situations immediately recognizes my "Home" Situation, so that proves that logic wrong.
I will now test how it fares when I leave home, and if it generally switches Wlan off reliably.

nonsuch 2020-09-03 05:26

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by hhaveri (Post 1569017)
When a situations ends, it should restore settings like wifi state to the value before that situation was activated. So there is no need to do it explicitly.

I am amazed that this bit seems to work flawlessly, even when I disable the app or switch off the phone!

Quote:

Originally Posted by nonsuch (Post 1569040)
I will now test how it fares when I leave home, and if it generally switches Wlan off reliably.

Recording network cells with all different modes in Settings => Mobile network seems to have helped, as well as reducing two situations to one.
With 8 cells recorded now, I need to move pretty far from my house before Wifi switches off (looong after it looses connection to my access point) but that's OK because I live in a residential area where it's unlikely that Wifi access points scan who's moving about (like e.g. in a mall).
I guess I can still fine-tune this by re-recording the cells under slightly stricter conditions (yesterday I even held out the phone over my balcony).
______________________________

One more thing I'd like to ask:
When I start Situations it often seems to think that the phone is charging (What = Charger) even though no cable is connected.
Any idea what could be going on there?

peterleinchen 2020-09-03 11:31

Re: Situations app - bugs, questions, answers, help etc..
 
One question:
I do not have
Device- Charger
even all feature modules installed and on v3.2.258
Where/how to enable?

hhaveri 2020-09-03 17:42

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by nonsuch (Post 1569080)
When I start Situations it often seems to think that the phone is charging (What = Charger) even though no cable is connected.
Any idea what could be going on there?

Hmm... no idea, but I'll check if I manage to reproduce the issue somehow. Charger state is currently read from /var/run/state/providers/udev/Battery/ChargerType. Should be quite straightforward but I don't know how reliable that source is.

Br,
Heikki

hhaveri 2020-09-03 17:43

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by peterleinchen (Post 1569092)
One question:
I do not have
Device- Charger
even all feature modules installed and on v3.2.258
Where/how to enable?

You can find it inside the Accessory condition.

Br,
Heikki

nonsuch 2020-09-04 04:44

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by hhaveri (Post 1569102)
Hmm... no idea, but I'll check if I manage to reproduce the issue somehow. Charger state is currently read from /var/run/state/providers/udev/Battery/ChargerType. Should be quite straightforward but I don't know how reliable that source is.

With no charger connected, that file has no content.
After connecting to the Computer it still has no content - well, it takes as long as it took me to write this to change state, it's now 'usb'.

However, there's another file in that directory called 'IsCharging' - that one is '0' with no charger connected, and immediately changed to '1' with a charger connected.

The same happens when I disconnect the charger - 'IsCharging' changes to '0' immediately, 'ChargerType' takes longer to become empty again.

It's the same with a wall plug although the lag is shorter for 'ChargerType'.

Wouldn't 'IsCharging' be more reliable, since Situations doesn't differentiate between types of chargers anyhow?
________________________________________

Since I have your attention, one more question:

Erasing network cells seems to be taking as long as recording them.
In fact, atm it seems to be stuck on 5 cells (was 8).
Why? Isn't it just erasing files?
________________________________________

BTW, my Sailfish device is a Sony Xperia XA2.
________________________________________

Thank you for all the good work.

hhaveri 2020-09-06 06:51

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by nonsuch (Post 1569110)
Wouldn't 'IsCharging' be more reliable, since Situations doesn't differentiate between types of chargers anyhow?

Perhaps, but the problem is that the condition is supposed to detect a charger being connected regardless of any charging actually happening (for example battery already at 100%). Anyway, I'll check if 'IsCharging' can be used for that.

Quote:

Originally Posted by nonsuch (Post 1569110)
Erasing network cells seems to be taking as long as recording them.
In fact, atm it seems to be stuck on 5 cells (was 8).
Why? Isn't it just erasing files?

Erasing is the opposite of recording - that is, from the recorded list of cells, it erases only those seen by the device. If you want to clear the condition, you can just move it to trash and create a new condition.

Not having erased all the 8 cells just shows how different internal & external conditions may affect which cells the device connects to.

Br,
Heikki

nonsuch 2020-09-13 12:22

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by hhaveri (Post 1569137)
Perhaps, but the problem is that the condition is supposed to detect a charger being connected regardless of any charging actually happening (for example battery already at 100%).

Oh, that makes sense and I didn't see it that way.

Quote:

Erasing is the opposite of recording - that is, from the recorded list of cells, it erases only those seen by the device.
Wow, this is some advanced logic.

Quote:

If you want to clear the condition, you can just move it to trash and create a new condition.
That's what I did in the end.

Anyhow, thanks again. Glad to be using this app.

P@t 2020-09-30 15:44

Re: Situations app - bugs, questions, answers, help etc..
 
I upgraded to the newly released 3.4 (OS update) and situations seem not to work anymore. It launches but then vanishes.

hhaveri 2020-10-02 18:57

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by P@t (Post 1569448)
I upgraded to the newly released 3.4 (OS update) and situations seem not to work anymore. It launches but then vanishes.

Thanks for the report! I will have a look at the platform update as soon as possible.

Br,
Heikki

hhaveri 2020-10-04 14:18

Re: Situations app - bugs, questions, answers, help etc..
 
Could someone try installing the new release package at https://github.com/pastillilabs/pack...leases/tag/268 ?

Not quite sure what was causing the problems with the latest platform. I recompiled against the latest SDK and app seems to start again at least for me.

There have been some very small changes since the previous official release - perhaps the most significant one being a new "night" icon.

Br,
Heikki

P@t 2020-10-04 16:54

Re: Situations app - bugs, questions, answers, help etc..
 
Thanks.
Did not have much time to dig but it still did not seem to work. I could see 'updating plugins' and then the app disappeared. A retry failed again.

hhaveri 2020-10-04 17:57

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by P@t (Post 1569508)
Thanks.
Did not have much time to dig but it still did not seem to work. I could see 'updating plugins' and then the app disappeared. A retry failed again.

I uninstalled the app, deleted the .local app directory and tried re-installing the version from Jolla Store. And even it seems to be now starting just fine. So right now I'm lost with this one :(

Br,
Heikki

P@t 2020-10-05 05:56

Re: Situations app - bugs, questions, answers, help etc..
 
I try uninstalling and reinstalling the latest release you shared .And it did work ��. Would be nice to see if someone else has the same issue.

nonsuch 2020-10-06 06:47

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by P@t (Post 1569518)
Would be nice to see if someone else has the same issue.

All this still applies only to people opting for development updates, yes?

hhaveri 2020-10-07 17:32

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by nonsuch (Post 1569537)
All this still applies only to people opting for development updates, yes?

Hmm... I suppose so, since Jolla Store page is not flooded with complaints - at least yet. Fingers crossed.

Br,
Heikki

anig 2020-10-08 01:53

Re: Situations app - bugs, questions, answers, help etc..
 
I've not had any issues with Situations after upgrading to 3.4 on xperia x.

nonsuch 2020-10-08 05:45

Re: Situations app - bugs, questions, answers, help etc..
 
Quote:

Originally Posted by hhaveri (Post 1569555)
Hmm... I suppose so, since Jolla Store page is not flooded with complaints - at least yet. Fingers crossed.

Well I haven't noticed anything on Rokua.

hhaveri 2020-10-24 15:27

Re: Situations app - bugs, questions, answers, help etc..
 
FYI: Updated v268 packages available at https://github.com/pastillilabs/pack...leases/tag/268

Contains latest Sonar update, which should in principle support the new defaultuser account (instead of nemo) for new Sailfish installations. Haven't really tested it though. And proper multi-user support is something that is left for later updates.

enai 2021-01-19 09:09

Re: Situations app - bugs, questions, answers, help etc..
 
Hi,

I have a problem on my XA2 with a fresh installed Saiflish 3.4.0.24 and the feature Display on/off. I couldn't use the display feature. The Situations App didn't detect if the Display is on or off. I have tested different Situations Version, but no success. With my Xperia X it it is no problem, but there is the old defaultuser nemo. I have read in the comments from the App, that another user have the same problem. Has anyone the same Problem? Could it be the problem with new defaultuser? Many thanks.

Kind regards
enai

peterleinchen 2021-01-19 09:58

Re: Situations app - bugs, questions, answers, help etc..
 
I do not know but if you think that thdle new user name may be the culprit just create a symlink from /home/nemo to /home/defaultuser
devel-su ln -s /home/defaultuser /home/nemo

enai 2021-01-19 10:23

Re: Situations app - bugs, questions, answers, help etc..
 
Hi peterleinchen,

many thanks for the answer. I try this before, but this not solved the problem. I don't know if the username is the problem. It was only an idea.

Kind regards
enai

hhaveri 2021-01-22 11:15

Re: Situations app - bugs, questions, answers, help etc..
 
Hi,

There's a new pre-release that should fix many of the problems with latest SF OS versions, available here:

https://github.com/pastillilabs/pack...leases/tag/271

Actually it has been sitting there already for a while. I'm updating the Android version at the same time but it has been stuck in the Play Store publishing process, so the Sailfish version got forgotten there also...

Can you pleas try that version and report back?

Br,
Heikki

enai 2021-01-24 14:51

Re: Situations app - bugs, questions, answers, help etc..
 
Hi Heikki,

many thanks for the response. I have tested this version before I post. But now I have tested this version again. It didn't work. Situations didn't detect if the display is on. Has anyone the same problem with an XA2? Many thanks.

kind regards
einai

hhaveri 2021-01-26 14:34

Re: Situations app - bugs, questions, answers, help etc..
 
Hi enai,

I only have Xperia 10 to test with and there the display condition works (with 271). If you (or anyone) can find out where to read & get notified of display state changes on XA2, I can try to add it also to the app.

The app is currently monitoring '/var/run/state/providers/mce/Screen/Blanked' (which is deprecated) and '/sys/class/backlight/panel0-backlight/brightness' which seems to work for Xperia 10.

Br,
Heikki

peterleinchen 2021-01-26 17:16

Re: Situations app - bugs, questions, answers, help etc..
 
On XA2 with SFOS 3.2 (DualSIM, no Plus/no Ultra) following path reports 0 when on and 1 when blanked:
/var/run/state/providers/mce/Screen/Blanked

/sys/class/ does not have a path for backlight/....

On a X with SFOS 3.4 it is absolutely the same

enai 2021-01-27 10:45

Re: Situations app - bugs, questions, answers, help etc..
 
Hi Heikki,

many thanks for the Info, that was the information that I need. I have no other directories under /var/run/state/providers/ und no directory /sys/class/backlight , that should be the problem. But if I use the programm mcetool, I get the correct information about the display state. I try to find out where mcetool get this information about the display state.

I have found a display state in /sys under

/sys/devices/soc/c900000.qcom,mdss_mdp/c900000.qcom,mdss_mdp:qcom,mdss_fb_primary/leds/lcd-backlight/brightness

There a the correct state.

Edit: I found the solution. The problem was the statefs-provider-mce package was not installed. pkcon install statefs-provider-mce and reboot solved the problem. After reboot I have /var/run/state/providers/mce/Screen/Blanked

I read that statefs is deprecated and this should be the problem. It is not default installed in new(3.4.0.24) fresh Sailfish installation.
https://irclogs.sailfishos.org/logs/...11-24.log.html

Kind regards
enai

hhaveri 2021-01-27 18:29

Re: Situations app - bugs, questions, answers, help etc..
 
Thanks, I'll check if it would make sense to switch to using mce dbus api.

Br,
Heikki

hhaveri 2021-02-06 14:56

Re: Situations app - bugs, questions, answers, help etc..
 
Switched (almost) all file system based conditions to dbus now:

https://github.com/pastillilabs/pack...leases/tag/272

Br,
Heikki

hhaveri 2021-03-02 18:18

Re: Situations app - bugs, questions, answers, help etc..
 
Mildly celebrating 10000 downloads of Situations in Jolla Store with an internal viewer for Log action + 64bit arm build. Available here:
https://github.com/pastillilabs/pack...leases/tag/273

And naturally / hopefully soon in Jolla Store.

Br,
Heikki

hhaveri 2021-03-26 14:30

Re: Situations app - bugs, questions, answers, help etc..
 
Next alpha version with Do Not Disturb support added:

https://github.com/pastillilabs/pack...leases/tag/275

Br,
Heikki


All times are GMT. The time now is 15:35.

vBulletin® Version 3.8.8