thecowan / wallpanel-android

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

Add option to wake using proximity sensor #91

Open Derkades opened 5 years ago

Derkades commented 5 years ago

Pretty much all phones have a front facing proximity sensor, for sensing when someone is holding the phone against their ear when calling so the phone can disable the screen. My request is to add an option to wake the screen when a change in proximity is measured. This would allow you to wake the screen by moving your hand in front of it.

If I recall correctly, while the sensors reports data as a distance (e.g. 5.0cm), usually the sensors can only read two or a few more values. For example, it might say "0.0 cm" or "5.0 cm" but no other values.

thanksmister commented 4 years ago

This seems like a duplicate of #105

Derkades commented 4 years ago

Detecting movement of the device is not the same as detecting something coming close to the proximity sensor

thanksmister commented 4 years ago

I think it actually is, the way that I understand it, the feature you are describing works based on the devices accelerometer or gyroscope detecting certain movements. So the device knows that it is in the vertical position (next to your ear). Waking the screen on motion is already something we have built in, as well as waking the device by detecting faces. Some phones do have a proximity device, but not many. I am putting these tickets together because they are all device sensor related.

Derkades commented 4 years ago

Almost all phones have proximity sensors. image image image

In some phones it is nearly invisible unless you shine a bright light at it, for example on my oneplus 2 the proximity sensor to the left of the front facing camera is almost invisible. image

Derkades commented 4 years ago

You are missing the point. Using a proximity sensor is very useful in wall mounted situations. To solve the problem, I used a third party app that wakes the screen so I can move my hand to close to the screen to turn it on. Waving your hand at the proximity sensor is faster than trying to click the on button. It is like using the camera to detect a person coming close, but without having to do complex image recognition.

thanksmister commented 4 years ago

If someone is interested in implementing this feature, they are welcome to do a PR request. I have labeled this as help wanted for those who want to contribute.

thanksmister commented 4 years ago

I am with you, sounds like a good feature to have. I am leaving this request open hoping someone decides to help on this feature.

Derkades commented 4 years ago

I could take a look, it's an excuse to start learning android app development so that's good I suppose

thanksmister commented 4 years ago

I have some sensor code in the application already, it gets a list of supported sensors and reports them over MQTT. So that is the start, detecting if the device has the proximity sensor, then the next step is to detect a change in that sensor to wake the device.