Current version of the OpenAuto Pro is 6.1
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic Brightness using TSL2561 Sensor for OpenAuto Pro
#21
(08-11-2019, 10:50 AM)Daniel_BlueWave Wrote: Screen brightness script has to be applied by each user as some of screens require additional hardware.
In case you are using official RPI screen there should be no issue with getting script from internet and adapt it for your solution.
You can check this:
https://bluewavestudio.io/community/showthread.php?tid=672&highlight=screen+brightness
Thanks for your reply @Daniel_BlueWave when I use the steps listed https://bluewavestudio.io/community/showthread.php?tid=672&highlight=screen+brightness the brightness service and the OpenAuto Pro service conflict and can't both access the sensor. I am trying to figure out how OpenAuto Pro gets the command to switch to night mode as the instructions from this forum create /tmp/night_mode_enabled but OpenAuto Pro doesn't seem to look for that file.

I see from the log that this happens, but I am unsure how to make the script from this forum cause the switch.

mode changed, mode: 1, switcherId: 12
updating mode, mode: 1, switcherId: 12
Reply
#22
Hi, I'm also trying to setup my TSL2561 sensor with OAP (btw: with Crankshaft this was quite more easy, just saying).

I don't really get it what I need to do here.
Follow the instruction from the PDF file or / and use the codes from the first entry?!
But where need those scripts to be located?

Can somebody please explain in detail?
Thanks.
Reply
#23
Hi

This is what I did to get my light sensor up and running with OAP.

Note that there are no additional scripts required if all you want is automatic day / night switching in OAP and AA.


a. enable I2C in raspbian

b. ensure that the light sensor is recognised by raspbian

e.g. run i2cdetect 

>i2cdetect -y 1

The output should show the sensor - the default address is 39

::
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
::


c. Follow instructions in OAP user guide - section 5.7.2. TSL2561 sensor configuration

In my case I had to set LightSensorDescriptor to /dev/i2c-1

You may have to play around with the LightSensorMaxRange to get it to work as you want - see https://bluewavestudio.io/community/showthread.php?tid=672&page=2 post 16


d. Adjust settings under  OAP, Settings, Day / night settings


HTH

Reply
#24
Thanks for the fast reply @765GHF. 
Seems to be working, at least the sensor will be detected.
May just need to play a little bit with the range values - I will see.


I would also like to use auto brightness (within Crankshaft I have used this too). 

I have tried to follow the readme instruction from the first entry.

But when I try to start the service, I'm facing following error:

Code:
● lightsensor.service - Pi Lightsensor Service
  Loaded: loaded (/etc/systemd/system/lightsensor.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Tue 2019-09-24 15:30:34 CEST; 55s ago
  Process: 1406 ExecStart=/opt/lightsensor/service_lightsensor.py (code=exited, status=2)
  Process: 1407 ExecStartPost=/bin/touch /tmp/auto_brightness_active (code=exited, status=0/SUCCESS)
Main PID: 1406 (code=exited, status=2)

Sep 24 15:30:34 raspberrypi systemd[1]: lightsensor.service: Service RestartSec=5s expired, scheduling restart.
Sep 24 15:30:34 raspberrypi systemd[1]: lightsensor.service: Scheduled restart job, restart counter is at 3.
Sep 24 15:30:34 raspberrypi systemd[1]: Stopped Pi Lightsensor Service.
Sep 24 15:30:34 raspberrypi systemd[1]: lightsensor.service: Start request repeated too quickly.
Sep 24 15:30:34 raspberrypi systemd[1]: lightsensor.service: Failed with result 'exit-code'.
Sep 24 15:30:34 raspberrypi systemd[1]: Failed to start Pi Lightsensor Service.

I'm not sure what's going wrong here.
I have created the lightsensor folder inside /opt and applied the execution rights (chmod +x) for the necessary files which I have copied to the Pi via an USB stick.
Any ideas?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)