thecowan / wallpanel-android

WallPanel is an Android application for Web Based Dashboards and Home Automation Platforms
https://wallpanel.app
Apache License 2.0
750 stars 103 forks source link

[FEATURE] Toggle application screensaver setting with MQTT/HTTP commands #178

Open mattstein111 opened 4 years ago

mattstein111 commented 4 years ago

In one of my use cases I have a tablet mounted in a bedroom (cam covered) and I need the screen to shut off completely between certain hours. If the screensaver is disabled I can let the system screensaver (Fire7) shut the screen off. But I want to turn the built-in screen saver back on during the day so that I show time/date.

mattstein111 commented 4 years ago

This was intended as a feature request, if not obvious.

thanksmister commented 4 years ago

This request is a bit confusing for me. Can you explain it a little bit more indepth. Thanks!

mattstein111 commented 4 years ago

Sorry, moving too quickly.

Basically, if I could enable or disable the clock screen saver (akin to flipping the switch in settings) from MQTT, I could create the situation I'm trying to achieve. Think of it the request as nothing more than exposing the clock screen saver setting to MQTT setting.

thanksmister commented 4 years ago

Gotch, thanks for explaining.

thanksmister commented 4 years ago

We would probably also have to disable the prevent screen from sleep, this is what actually keeps the screen on, the screensaver is there to save the screen when its not able to sleep. If our screen does go to sleep, the application may stop receiving commands via MQTT/HTTP.

mattstein111 commented 4 years ago

Sure, if that could be exposed to MQTT too, I might use it. At a certain point, I suppose we're really talking about exposing the rest of the configurables to MQTT.

In my particular use case, Amazon Fire 7 (current gen) I don't need the 'prevent screen sleep' feature on to achieve the behaviour I desire. System screen sleep is set to default. If I have clock screen saver on, wallpanel flips to clock at the time out. If it's clock screen saver is off, the screen shuts off at the timeout.

eloo commented 3 years ago

We would probably also have to disable the prevent screen from sleep, this is what actually keeps the screen on, the screensaver is there to save the screen when its not able to sleep. If our screen does go to sleep, the application may stop receiving commands via MQTT/HTTP.

Hi, are there any updates on this? I would also like to have the possibility to disable/enable the "keep screen awake" over mqtt/http.

In some previously releases i could easily solve this by simple locking the device but it seems like that the last two version the app is unlocking device again so my workaround is not working anymore.

So having the possibility to change this settings using MQTT would make much easier to have some real "night mode".

Thanks

thanksmister commented 3 years ago

No, there is no work slated for this at this time since its not a bug but a feature request. If someone wants to attempt a pull request for this feature, that would be great.

eloo commented 3 years ago

@thanksmister i have already checked the code a few month before but i was not able to easily locate how the mqtt is connected to the settings stuff..

if you maybe can give some hints i can maybe give this a try

thanksmister commented 3 years ago

We have inside the WallPanelService class a handler for all incoming MQTT commands. Each new command will have to update the shared preferences, there are two classes, Configuration and MQTTOptions, these hold the settings.

The first issue will be that updating the shared preferences in a service does not instantly take effect in the main application. The second issue will be that sometimes updating a setting requires a restart if the service (i.e. camera) or reloading the application.

This is why we restarting when user's return from the settings screen. You would be bypassing this, so this is going to be an issue that I also faced when updating the camera settings remotely, I had to shut down everything about the camera and restart it.

So we cannot always map 1:1 a settings with a remote MQTT command due to how the application works. So use this sparingly and on settings that do not require the main Activity to restart. The WallPanelService does have a broadcast feature that sends out messages to the main activity, the activity can handle these and perform actions, such as open the settings.

eloo commented 3 years ago

Thanks for this insights. Maybe i can have a look at the weekend.

thanksmister commented 3 years ago

duplicate of https://github.com/thanksmister/wallpanel-android/issues/264

thanksmister commented 3 years ago

This can be tested in version https://github.com/thanksmister/wallpanel-android/releases/tag/v0.9.4.9

eloo commented 3 years ago

sadly i need to give up on implementing anything. there is to much custom config in your project i'm unable to get it run locally.

eloo commented 3 years ago

Hi, i'm not sure why this is closed now. i've tested the latest version and this functionality is still not available. There is no way to disable the screensaver so the screen goes off.

thanksmister commented 3 years ago

Sorry about that, I thought this was a duplicate of another feature. That feature was to turn off the screensaver while the device is woken using MQTT/HTTP commands.