Open etxttul opened 3 years ago
Yeah, it's possible to do it remote but we need to build that functionality into the application. Let's leave this ticket open to see if anyone is interested in this feature and possibly want to help.
Hi, this request is quite related to previous mine: be able to activate/deactivate the screenpaper screensaver type (images slideshow as screensaver) via API. It would be very interesting to have both options included.
I think i do something similar of what you want, but with a movement sensor. When there's no movement HA send a { "wake": "false" }' to my kitchen tablet. When there's movement for some time HA send a { "wake": "true", "wakeTime": 3000 }. But I'm all in favor of having more mqtt options :-).
There are many ways to kill a cat, All good except the bad ones. How it is done is not important. If I understand you correctly, you could turn of and on the screen from HA based on for example motion sensors. For my case I could for example turn on the screen for a certain time, let's say 3 hours { "wake": "true", "wakeTime": 10800}, when I'm not in the mode for music anymore I could just put in back to screen saver mode by sending { "wake": "false" } If I want more that 3 hours I just have to do it again, In a way this is even better, that means it will go back to normal after some time if I forgot to turn the fuction off. But of course, this could also been done from HA with MQTT. Still to me this sounds promising!!! I don't know if you saw the picture on my wall panel in the android 11 on RPI4 issue, but I actually have a motion sensor just beside the wall panel for other purposes than the wall panel. this way I could probably just remove the RPI camera I have mounted on top of the screen.
This even have the potential to solve my other issue, that I have to kick start the motion sensor in wall panel by first starting fully kiosk by removing the need for the camera (maybe). There is still no full version of Gapps what I can find for android 11 on RPI4.
I like the wake lock feature, what you could do is use only the wake command to disable any screensaver feature automatically, which makes sense, rather than have something separate for screensaver. Actually I think someone already has implemented a feature that just wakes the screen without a screensaver, so your wake command could toggle between the two types of screensaver.
I kind of got it working, it is really simple to configure in HA, but if you forget to turn REST API in the app, you can waste your whole evening on stupid things :-) So for all you others, turn on REST API in your wall panel before trying something else. This is my configuration.yaml in HA.
`rest_command:
screen_on:
url: 'http://192.168.2.58:2971/api/command'
method: POST
payload: '{ "wake": "true", "wakeTime": 300 }'
content_type: 'application/json'`
This are just my first test I will do more over the weekend, but it seems it is not working as it should or at least not as I wish it would work. It seems the screen saver in the app is overruling what is done over rest, meaning if I set the wake time to 5 minutes (300 seconds) it still goes to screen saver after 60 seconds as set in the app. For wake: false, in the wiki it says it will not go to sleep until the screen savers time run out. This together with the first issue, makes that kind of useless. But as said, I will test more in the coming days, maybe I just missed something.
Anyhow a good start.
Thanks again. Tobe
Ahhh, just saw there is a new version of wall panel. I upgraded, but will test it tomorrow, need to work tomorrow. :-(
Everything is working, I can even remove my camera and use the sensor. I think this would solve my issue in a way that is more than good BUT, I have not been able to set the "wakeTime", what ever I try the screen saver goes on according to the time that is set in the app.
Any tips? Still using the same config yaml.
`rest_command:
screen_on:
url: 'http://192.168.2.58:2971/api/command'
method: POST
payload: '{ "wake": "true", "wakeTime": 300 }'
content_type: 'application/json'`
You are mentioning "wake lock" feature, I haven't found any info on that, where could I find it? I might like to try that too.
We need to toggle the screensaver feature on/off in the configuration when using this wake command
We need to add a wake toggle the wake screen mode, which just keeps the screen on, they should go into BaseBrowserActivity
and from the service we broadcast a command for WAKE_ON, WAKE_OFF.
Add a variable to BaseBrowserActivity
var wakeScreen = true
In theWallPanelService
we already have a wake lock with a timer we just need to broadcast either wake on or wake off to the BaseBrowserActivity
if (commandJson.has(COMMAND_WAKE)) {
if (commandJson.getBoolean(COMMAND_WAKE)) {
val wakeTime = commandJson.optLong(COMMAND_WAKETIME, SCREEN_WAKE_TIME / 1000) * 1000
switchScreenOn(wakeTime)
broadcastWakeOn() // broadcast to main activity screen is always on
} else {
if (partialWakeLock != null && partialWakeLock!!.isHeld) {
Timber.d("Release wakelock")
partialWakeLock!!.release()
broadcastWakeOff() // broadcast to main activity screen can turn off
}
}
}
private fun broadcastWakeOn() {
val intent = Intent(BROADCAST_WAKE_ON)
val bm = LocalBroadcastManager.getInstance(applicationContext)
bm.sendBroadcast(intent)
}
private fun broadcastWakeOFF() {
val intent = Intent(BROADCAST_WAKE_OFF)
val bm = LocalBroadcastManager.getInstance(applicationContext)
bm.sendBroadcast(intent)
}
In the BaseBrowserActivity we listen to these in the the method private val mBroadcastReceiver = object : BroadcastReceiver()
and add them to the filters:
filter.addAction(BROADCAST_WAKE_ON)
filter.addAction(BROADCAST_WAKE_OFF)
Search for filter.addAction in the BaseBrowserActivity class to see how we implement filters. Now we need to save a parameter locally in the BaseBrowserActivity that remembers the state of the wake and use that to override the screensaver by adding two new if/else statements to mBroadcastReceiver
} else if (BROADCAST_WAKE_ON == intent.action && !isFinishing) {
hideScreensaver() // hide screensaver
wakeScreen = true // set our flag
} else if (BROADCAST_WAKE_OFF == intent.action && !isFinishing) {
wakeScreen = false // allow screensaver
if(userPresent.not()) {
showScreenSaver() // show the screen saver if user is not here
}
}
We have this method which on user inactivity shows screen saver:
private val inactivityCallback = Runnable {
Timber.d("inactivityCallback")
dialogUtils.clearDialogs()
userPresent = false
showScreenSaver()
}
We can just put a quick flag check here to override showing the screensaver:
private val inactivityCallback = Runnable {
Timber.d("inactivityCallback")
dialogUtils.clearDialogs()
userPresent = false
if(wakeScreen.not()) {
showScreenSaver()
}
}
So we can leverage the existing wake command to handle wake time, this functionality already exists. We are only turning off the screen saver in BaseBrowserActivity
when we do this. This allows us to keep the screen on as desired without screensaver coming back on until we release the wake lock.
I kind of get you, I kind of even understand some of the code, but unfortunatly, I will not be any help to you. The last time I coded was 1994 :-(, Spent some time on SW testing what at that time was called the Giant Sw Monster (GSM) (those where the days :-) ) Still I think this is the way to go. Even with the limitations I have now, I really prefer to control the screen from HA than from the app/camera. It really open new possibilities. I alread made some automations. Like for example returning back to the main view after some time. Thanks for pointing me to the REST stuff.
BR Tobe
I will take care of it, no worries. It's a pretty quick feature. Thanks for helping out @etxttul!!!
What I can do, is to help you with some user guides. I'm not skilled, on the coding but writing guidelines have been my profession for a couple of years. Wall panel in HA for dummies is right up my alley :-)
What I can do, is to help you with some user guides. I'm not skilled, on the coding but writing guidelines have been my profession for a couple of years. Wall panel in HA for dummies is right up my alley :-)
Excellent!! We need guides, I suck at that. Feel free to edit the wiki.
I have a pre-release version available for testing: https://github.com/thanksmister/wallpanel-android/releases/tag/v0.9.4.7
Ok I downloaded it, I need to stop testing now, because strangly enough I have a family. This is my findings so far. I set the screen saver to 15 seconds in the app to get faster responses. the I used the following in configuration.yaml
rest_command:
screen_on:
url: 'http://192.168.2.58:2971/api/command'
method: POST
payload: '{ "wake": "true", "wakeTime": 30 }'
content_type: 'application/json'
Well it is a good start. after sending the screen is awake, forever as it appears.
Trying to turn it off by sending.
screen_off:
url: "http://192.168.2.58:2971/api/command"
method: POST
payload: '{"wake": false}'
content_type: 'application/json'
Don't seem to help.
Still this was only a quick and dirty test, I might have missed something. I'm with company computer right now, I will try more with Advanced Rest Client (ARC) on my own computer tomorrow to do faster testing.
BR Tobe
Ok, I managed to do one more test before being forced from my PC. I can get the screensaver working again by reloading the page (any page?).
home_screen:
url: 'http://192.168.2.58:2971/api/command'
method: POST
payload: '{"url": "https://xxxx.duckdns.org:8123/lovelace-yaml/0"}'
When sending this the page reloads, there after the time for the screensaver kicks in. I set it to 15 seconds so 15 seconds after the command is sent the screen goes to sleep.
This is not the way, but with automations I can actually do what I want now, very ugly, but still.
I hope this info helps.
BR Tobe
Hi again, I have now test the new app with advanced Rest client from my PC. I get the same result as from HA,
All the commands in the wiki that I have tested work, the "wake": true, works, but it don't take the "wakeTime": doesn't take.
That is the screen stay on longer that the timer is set (forever? ! will try a real long time when I go to bed, but don't think it matter). the same with {"wake": false}.
I wonder if this could be related to that I run android on the RPI4 and I only found a pico-version Gapps?
For now I am still quite happy, you can get the screensaver started again by {"url": "http://
This is ugly, but it works. A bit annoying with the reload of the page, but I think I only notice now because I'm looking at it, later when using it I hope it will be less annoying.
Let me know if you you something, I willing to continue testing.
I will test this feature and get a fix. Thanks for the feedback!
In the meantime I have managed to snatch and test with my sons Huawei Mediapad with android 8 while he is school. The results are the same, so it is probably not related Gapps-pico I have loaded on my RPI.
I have now tried the same stuff with Mqtt, with the same result (using the MQTT integration/configure). I will stick with REST, I got in to serious problems with service mqtt.publish, (to long story to tell, but I'm not touching that again).
I'm not a fan of node-red, tried mqtt there as well, It apears to be a bug there, when changeing one mqtt node all mqtt nodes changes. I'm guessing no-one uses this so it is not properly tested. So REST it is for me.
Note! none of my problems today is related to wall panel, except for what was already described with REST, it is all HA integration related problems.
Hi again, I learned one more thing today. If you look up the screen with "wake" it stays awake forever, but if you touch the screen it goes back to sleep after the screen saver timer expired. It can be argued that it should work like that, but I rather still keep it awake until I tell it differently from HA
Thanks for all the feedback, I am hoping to have time to test this soon.
We can test this in https://github.com/thanksmister/wallpanel-android/releases/tag/v0.9.4.9
Hi, Did some quick basic tests and it seems to be working.
Will test more, but so far so good.
BR Tobe
Tested one thing more, if the camera is used for motion detection, the screensaver timer goes on and the screen goes to screensaver after the timer when a motion is detected by the camera.. (I was wrong in a previous post about touching the screen, it is the camera that does it). I would like to keep the camera on because the camera works better for me than a motionsensor, but if needed I can live with turning off the camera and use the motion sensor for turning of and on the screen.
Changing the view in HA also starts the screensaver timer. This complicates things a bit for me, I have to think if I can work around this with settings and automations.
One more issue, after sending {"wake": true, "wakeTime": 180}, then touching the touchscreen, (turning on a light or changing the view), the screensaver time starts and the screensaver goes on after the time set in the app. In this stage it is not possible to wake up the screen again with {"wake": true, "wakeTime": 180} untill the previous timer has expired or {"wake": false} is sent to the screen. This is simular behaviour as when you have the camera motion detector on, when the camera goes off, the screensaver turns on after the time and you can not wake it up until you have done {"wake": false} or the original {"wake": true, "wakeTime": 180} expired. There is one more case triggering this behaviour, but I have not managed to reproduce it yet.
I guess there are two ways to fix it.
Best Regards Tobe
I managed to use MQTT now as well. It took some time to figure it out. To use the MQTT you can use the service mqtt.publish as action in automations or scripts. If done in yaml mode, it would look for example like follows.
service: mqtt.publish
data:
topic: wallpanel/mywallpanel/command
payload: '{"wake": true, "wakeTime": 180}'
Please note the single quationparks around the jason. When back in visual editor mode it will look as follows.
Please note that when calling the service from the developer tools the format becomes more complicated and would look something like this.
service: mqtt.publish
data: {
topic: wallpanel/mywallpanel/command
payload: "{\"wake\": true, \"wakeTime\": 180}"
}
Just skip this and go directly to the automation or script.
Restful vs. MQTT.publish, what to use? Well they do exactly the samething. The advantage with RESTful is that you define the service once and it is easy to call from an automation (just select the correct RESful service), but you have to define it in configation.yaml. MQTT.publish is very flexible, you can call the same service in different automations and scripts with different parameters without doing templating. But, at the moment you need to yaml in each automation or script. What I'm doing right now is mixing both, which seems to work fine. For things that I want to be flexible with for example waking up the screen with different wakeTime I do with mqtt.publish. But I'm using RESTful for things I do often, for example {"wake", false}, or going back to main view {"url": "https://xxxxxx.duckdns.org/lovelace/0"}
Everything works fine with some minor issues as described in earlier post.
Best Regards Tobe
Try the using the MQTT integration tools, much easier:
One more issue, after sending {"wake": true, "wakeTime": 180}, then touching the touchscreen, (turning on a light or changing the view), the screensaver time starts and the screensaver goes on after the time set in the app. In this stage it is not possible to wake up the screen again with {"wake": true, "wakeTime": 180} untill the previous timer has expired or {"wake": false} is sent to the screen. This is simular behaviour as when you have the camera motion detector on, when the camera goes off, the screensaver turns on after the time and you can not wake it up until you have done {"wake": false} or the original {"wake": true, "wakeTime": 180} expired. There is one more case triggering this behaviour, but I have not managed to reproduce it yet.
I guess there are two ways to fix it.
- Not allowing the screensaver timer start when {"wake": true, "wakeTime": 180} is running.
- Allowing to reset/restart {"wake": true, "wakeTime": 180} while the previous {"wake": true, "wakeTime": 180} timer is still running.
- Both in combination
Best Regards Tobe
Yeah we did not disable touch or motion events resetting the screen saver. I knew this feature would really tangle up with other features. I will try to work on getting the wake time to stick even with face/motion/touch events registered.
I added web page screensaver https://github.com/thanksmister/wallpanel-android/releases/tag/v0.9.5.1
Hi, tried it, it works, but can not google photos though as you have to login the first time and the screen wakes up wakes up HA when you touch it, just as it should :-) But as said in a previous post, me personally is happy with the existing screensavers.
What stopped working is, in previous release you could have both the clock screensaver and wallpaper screensaver on at the same time, this was nice because you get the picture with the clock on top, this don't seem to work now. If you turm both on you only get the clock.
You should not have both on the same time, its either the clock, webpage, or wallpaper screensaver options. That was a bug that was corrected, not a feature.
If you want a background with a clock also, maybe we can add back that bug, but perhaps you can use a web page that has both features. But really, this was a fluke that both were used at the same time, though maybe it's not so bad. I have to think about it.
Ahhh, the old the bug that became a feature :-) I can live with it as it is, I will use the clock only, as for saving the screen I guess this is the best one (black). I look at the clock screensaver quite a lot from my corona office as I can see it from my desk. But of course if you have the time and feel bored one of these days, why not fixing it, it is quite nice bug.
Haha, well maybe we can make that bug an official feature, its not bad actually.
As regardless how it ends up, here is a small suggestion for beutification, if you turn on a screensaver and the combination is not working together, turn off the "old" levers that don't work in the combination. Without the bug that would basically mean if you turn on, URL based screensaver, the clock based screensaver lever would automatically go to off. That would make the function clear I think.
That's busy work, haha.
Sorry if I keep you busy, this is hardly the most important thing, it's not like I didn't notice that having two screensavers on at the same time didn't work.
Hola, It seems like you fixed the camera/touch screen thing in this release as well. It appears to work perfectly. Give me a day or two to test both REST and MQTT. Then I believe you can release a new official version and I will start writing HA tips and tricks with wall panel. Not sure where to put it though. Maybe a seperate HA chapter in wall panel wiki is the place to put it. To get the best coverage it probably should be Youtube, but that is not me, Maybe we can ask Dr zzz :-)
Hi,
I have tested quite a lot. Most things seems to be working. I had problems this morning, but after reloading the android everything have been working.
{"speak": "Hello!"} didn't work, but this is probably more because of my setup, with a RPI4 and a screen even though there are speakers in my screen and HDMI connection. Couldn't try {"volume": 100} Tried {"brightness": 1}, don't work for me but not so strange with my setup. I could turn on the camera with {"camera": true}, couldn't turn it off again, tried {"camera": true} and {"camera": false}
Most important when using {"wake": true, "wakeTime": 10800} , the screen stays awake even after touching the screen or activating the camera. Thanks for that!!!! I have no more requests, except for maybe the bug to come back :-)
However I have a weird one, I think I might have had this even when I was using my Samsung TAB 2, sometimes when I come back to the screen, wall panel is not there, it haven't crashed, it is just showing the android desktop, when looking on running apps, it is there and running, just switch to it and it works. I have been thinking the 14 year old son or the wife have been playing around, but today, it happened when no one except me was around. It happens 2-3 times a week but never when I'm looking :-( Not a big thing, probably related to my set up and hard to truble shoot.
Thanks again.
BR Tobe
Something weird happened, just like this morning the restful with {"wake": true, "wakeTime": 10800} stopped working in the sense that the screen turned off after the time set in the app. I just couldn't get it started again. Trying to with restarting the app, restarting android, restarting HA. I finally got it working by sending exactly the same with mqtt.publish. After this restful started to work as well. I have no idea what caused this state, but I will have my eyes open. When reloading the app and Android don't help, to me gives a hint.
Even with MQTT.publish {"wake": true} don't work anymore, when the 30 second my screensaver timer is set to the screen goes blank. But at the same time MQTT with {"wake": true, "wakeTime": 10800} seems to work fine.
In other words, there are some stability issues here.
Sorry :-) Tobe
Hi, My configuration has been running for almost a week now without any problems. I'm guessing that my wild testing last week triggered something rare. But in general, it seems good enough for me.
I released another version that allows for layering the clock screen saver on top of one of the other screensavers. Also to make things nicer, I toggle the others on/off depending on which is selected in the settings. You can have the clock with web/wallpaper, but not both web or wallpaper options. https://github.com/thanksmister/wallpanel-android/releases/tag/v0.9.5.4
Hi, been offline, vacation I have tried v0.9.5.4 and v0.9.5.5, the lever thing works perfectly. but when running the clock screen saver in combination with any other screen saver it doesn't work for me. Google wall paper with the clock results in a black screen screen saver. unsing your webpage screen saver with the clock only shows your screen saver. Most of the time everything works well. but when stressing things, it gets back to some sort of normal screen saver with the settings as is in the wall panel settings. meaning it can not be controlled by HA anymore without sending {"wake": false}. Sorry to say I can not reproduce this. I can not say when it happens, but it happens.
Hi, I have been on vacation, but the previous release loaded didn't display the clock on top of the screensaver. This version seems to do that . I will keep it running for a couple of days to see if it works. Otherwise for this issue the previous version worked fine for a couple of months.
Everything works as I want it. No complaints at all. But I have not done testing, just running my implementation for a week.
Ok, Dim screensaver don't work with my set up with Android 11 on raspberry pi 4B 4GB. I don't care :-)
**This is not a problem rather a feature request. My wall panel/HA is functioning as my "hifi". Some times I'm just listing to music/radio, relaxing. At these occations I like to see what is playing. With Mini Media Player you get a full-cover picture of the playing song. Unfortunatly in these cases wall panel is doing exactly what it is intended to do, it turns on the screensaver :-) What would be great, would be if you could turn on/off the screen saver function with an automation/scene from HA to keep the sceen on. My thinking is that this could be done with MQTT (mostly because I know it and understand it). For me this would be the icing on the cake.
Thanks Tobe