phyphox Forums

Full Version: Remote control for phyphox
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The existing API is already great to get data from a mobile device at remote locations!

I'm missing a few features though:

General:

- Configurable port for the web interface (see request on github).
- General setting for having the web interface always enabled;
    currently it is only possible when an experiment has been selected already.
    About security: no concerns as long as the web interface is not exposed to the public internet 

Web interface and/or API:

- Option to reset data
- Option to switch experiments
- Option to configure new experiments

Thanks!
Jakob.
(04-02-2021, 01:24 PM)jer194 Wrote: [ -> ]- Configurable port for the web interface (see request on github).
Jepp, on my todo list. Might happen right after my parental leave next week.

(04-02-2021, 01:24 PM)jer194 Wrote: [ -> ]- General setting for having the web interface always enabled;
This has been requested a few times before, but we do not want to allow this because of security concerns in the context of our main use case: Science education. Our worry is that this is enabled by a student who forgets about this setting and who then exposes his data school-wide or even Uni-wide. The threat is not too high as it only works while the app is active, but especially in context with your feature request below for switching experiments via the API, any attacker can simply scan for active phyphox instances with always-on-remote-interface and automatically switch them to an experiment that exposes location and the microphone.

So, since the benefits from this feature are not too relevant for teaching and not having this feature is more an inconvenience than a limitation (in most scenarios one can just create an experiment that records all relevant data) we do not plan to implement this.

(04-02-2021, 01:24 PM)jer194 Wrote: [ -> ]- Option to reset data
This is available via "/control?cmd=clear" or did I misunderstand?

(04-02-2021, 01:24 PM)jer194 Wrote: [ -> ]- Option to switch experiments
- Option to configure new experiments
See always enabled feature Smile

Sorry that this is mostly negative feedback. Maybe it helps if you explain your use-case?
(04-02-2021, 04:57 PM)Sebastian Staacks Wrote: [ -> ]Jepp, on my todo list. Might happen right after my parental leave next week.
Thanks for that!

(04-02-2021, 04:57 PM)Sebastian Staacks Wrote: [ -> ]
(04-02-2021, 01:24 PM)jer194 Wrote: [ -> ]- General setting for having the web interface always enabled;
This has been requested a few times before, but we do not want to allow this because of security concerns in the context of our main use case: Science education. Our worry is that this is enabled by a student who forgets about this setting and who then exposes his data school-wide or even Uni-wide. The threat is not too high as it only works while the app is active, but especially in context with your feature request below for switching experiments via the API, any attacker can simply scan for active phyphox instances with always-on-remote-interface and automatically switch them to an experiment that exposes location and the microphone.

So, since the benefits from this feature are not too relevant for teaching and not having this feature is more an inconvenience than a limitation (in most scenarios one can just create an experiment that records all relevant data) we do not plan to implement this.

I fully understand those concerns.
Last try :-) : maybe authentication could be enforced, in case 'always on' is set?

(04-02-2021, 04:57 PM)Sebastian Staacks Wrote: [ -> ]
(04-02-2021, 01:24 PM)jer194 Wrote: [ -> ]- Option to reset data
This is available via "/control?cmd=clear" or did I misunderstand?

I was more thinking about the web page (localhost:8080/) in this case, where one can switch between the various sensors,
and in fact it is there (the 'bin' symbol), I just missed it.

(04-02-2021, 04:57 PM)Sebastian Staacks Wrote: [ -> ]Sorry that this is mostly negative feedback. Maybe it helps if you explain your use-case?

No problem :-)

My current use case is: take sensor data every 15 min, eg for a weather station.

I have various solutions already, so I'm not really dependent on phyphox.

termux offers an easy solution (via termux-api, plus a cron).
Using this method, I have temperature, pressure, humidity for the past two years (from a spare S4).

For temperature on other devices, values can be taken directly from the /sys tree (also current, voltage, charge level, i.e. some physics could be made out of this as well). The temperature value is quite reliable, as long as the device is not used otherwise, or being charged.

Recently I discovered phyphox for this purpose, well designed, and controllable via API, so I gave it a try.
Since I want to operate it remotely, for longterm measurements, screen should be on only during the measurements.
Essentially it is (every 15 min again):
- Switch on screen, using 'sendevent' (press power key)
- Retrieve the list of active sensors via phyphox API (local, on the device).
- Retrieve values for those sensors.
- Stop measurement.
- Switch off screen (again 'sendevent')
phyphox needs to be in started mode, experiment up, and API active.

A bit crazy maybe, but it is fun to explore possibilities :-)
I am afraid that I have to admit that this use-case hits all the weak spots of phyphox Smile Our app excels when measuring and displaying much data in a "live" measurement while seeing the reaction of the data in typical short educational experiments, but when it comes to long-term measurements it becomes a bit cumbersome. Turning of the display during the measurement is something we have on our todo list for quite a while now, but unfortunately, it requires so much restructuring of the app that we have not yet tackled it.
For long term experiments

Could you use the tasker app to gather data, log them to txt file every 15 mins for example.

then use a tasker task to send data to remote control of phyphox, and basically sue phyphox as a configuable grapher/plotter.
Thats what I did to make my sonar sort of, grabbed data from arduino ( using 1sheeld) and then redirected it to phyphox using tasker.
(09-21-2021, 03:52 PM)neoaliphant Wrote: [ -> ]For long term experiments

Could you use the tasker app to gather data, log them to txt file every 15 mins for example.

then use a tasker task to send data to remote control of phyphox, and basically sue phyphox as a configuable grapher/plotter.
Thats what I did to make my sonar sort of, grabbed data from arduino ( using 1sheeld) and then redirected it to phyphox using tasker.

Thanks for your proposal, I've heard of tasker, but haven't used it so far.

I'm using termux now, which has an easy way to collect all sensor data via command line,
and also supports cronjobs.

The job collects the sensor data every 15 min into a logfile (works fully offline), 
which can then be easily transfered to a PC, for analysing/displaying the data.
There is an easy way to 'remote control' the whole device, not just the app, eg via 'scrcpy'
(open source, cf. https://github.com/Genymobile/scrcpy):

"This application provides display and control of Android devices connected on USB (or over TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and macOS."

Thus, no need to change phyphox ...
Thanks for the info. Unfortunately, it won't work in my Appleverse this way…
(09-29-2021, 10:32 PM)Jens Noritzsch Wrote: [ -> ]Thanks for the info. Unfortunately, it won't work in my Appleverse this way…

'Appleverse', that's 'Apple Universe' / Apple / macOS (which seems to be supported)?