digitaltrails / vdu_controls

VDU controls - a control panel for monitor brightness/contrast/...
GNU General Public License v3.0
114 stars 3 forks source link

[Help] GY302 Sensors not works in VDU #80

Closed Milor123 closed 5 months ago

Milor123 commented 6 months ago

Hey, Brother, how are you? I tell you I accidentally bought a "BH1750" chip but in reference "GY302" and not "30"

However I have read and find the next code to go up in my Nano port.

https://github.com/Erriez/ErriezBH1750?tab=readme-ov-file

I have modified some things, adjusting the following values as your version: Serial.begin(9600); float lux; delay(1000);

I have made sure to give all the permissions and things as you indicated in your publication for the linux. I also check on the IDE Arduino monitor that everything was working, the print correctly returns the sensor values.

But I don't understand what else I have to change to work with the VDU

image

VDU always show lux in 0, the tty link is working perfect.

Update: I've tried use the --debug mode and get this

08:57:38 DEBUG: SingletonDialog exists SettingsEditor False
08:57:38 DEBUG: SingletonDialog created for SettingsEditor
08:57:46 INFO: LuxMeterSerialDevice: Initialising character device /dev/arduino
08:57:46 WARNING: Retry read of /dev/arduino, will reopen feed in 40 seconds. Cause: [Errno 16] could not open port /dev/arduino: [Errno 16] Dispositivo o recurso ocupado: '/dev/arduino'
08:57:46 DEBUG: TRACEBACK:   File "/home/noe/vdu_controls/vdu_controls.py", line 3733, in run
    self.task_body()
  File "/home/noe/vdu_controls/vdu_controls.py", line 5933, in update_current_value
    log_warning(f"Retry read of {self.device_name}, will reopen feed in {self.backoff_secs} seconds. Cause:", problem,
  File "/home/noe/vdu_controls/vdu_controls.py", line 1184, in log_warning
    log_wrapper(syslog.LOG_WARNING, *args, trace=trace)
  File "/home/noe/vdu_controls/vdu_controls.py", line 1172, in log_wrapper
    log_debug("TRACEBACK:", ''.join(traceback.format_stack()))

08:58:26 INFO: LuxMeterSerialDevice: Initialising character device /dev/arduino
08:58:28 WARNING: Retry read of /dev/arduino, will reopen feed in 80 seconds. Cause: value that failed to parse: b'BH1750 one-time measurement & power management example\\r\\n'
08:58:28 DEBUG: TRACEBACK:   File "/home/noe/vdu_controls/vdu_controls.py", line 3733, in run
    self.task_body()
  File "/home/noe/vdu_controls/vdu_controls.py", line 5933, in update_current_value
    log_warning(f"Retry read of {self.device_name}, will reopen feed in {self.backoff_secs} seconds. Cause:", problem,
  File "/home/noe/vdu_controls/vdu_controls.py", line 1184, in log_warning
    log_wrapper(syslog.LOG_WARNING, *args, trace=trace)
  File "/home/noe/vdu_controls/vdu_controls.py", line 1172, in log_wrapper
    log_debug("TRACEBACK:", ''.join(traceback.format_stack()))

08:58:28 INFO: closing serial device

it shows [Errno 16] could not open port /dev/arduino: [Errno 16] Dispositivo o recurso ocupado that the device is bussy.

Then of try delete all print lines on arduino code, and run python vdu_controls.py --debug and it dont shows erros but not works in VDU, lux always shows 0 value


10:02:43 INFO: VDU Controls 2.0.2 vdu_controls.py  
10:02:43 INFO: python-locale: ('es_ES', 'UTF-8') Qt-locale: es_ES
10:02:43 INFO: app-style: breeze (detected a dark theme)
10:02:43 INFO: Looking for config file '/home/noe/.config/vdu_controls/vdu_controls.conf'
10:02:43 INFO: Using config file '/home/noe/.config/vdu_controls/vdu_controls.conf'
10:02:43 WARNING: command-line debug=yes overrides vdu-controls-globals.debug-enabled=no (in /home/noe/.config/vdu_controls/vdu_controls.conf)
10:02:43 INFO: Logging to stdout
10:02:43 DEBUG: config: vdu_controls.conf [metadata] version = 2.0.2
10:02:43 DEBUG: config: vdu_controls.conf [metadata] timestamp = 2024-03-07 20:33:16.853939-05:00
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] system-tray-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] hide-on-focus-out = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] translations-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] weather-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] schedule-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] lux-options-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] splash-screen-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] warnings-enabled = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] smart-window = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] monochrome-tray-enabled = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] mono-light-tray-enabled = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] debug-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] syslog-enabled = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] dbus-client-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] dbus-signals-enabled = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] location = 4.6097,-74.0817,Bogota
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] dbus-listener = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-globals] adjust-for-dpi = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] brightness = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] contrast = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] audio-volume = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] audio-mute = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] audio-treble = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] audio-bass = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] audio-mic-volume = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] input-source = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] power-mode = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] osd-language = no
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] color-temperature = yes
10:02:43 DEBUG: config: vdu_controls.conf [vdu-controls-widgets] enable-vcp-codes = 
10:02:43 DEBUG: config: vdu_controls.conf [ddcutil-parameters] sleep-multiplier = 0.0
10:02:43 DEBUG: config: vdu_controls.conf [ddcutil-parameters] ddcutil-extra-args = 
10:02:43 DEBUG: config: vdu_controls.conf [ddcutil-capabilities] capabilities-override = 
10:02:43 DEBUG: Checking for es_ES translation: /home/noe/.config/vdu_controls/translations/es_ES.ts
10:02:43 DEBUG: Checking for es_ES translation: /usr/share/vdu_controls/translations/es_ES.ts
10:02:43 DEBUG: Checking for es_ES translation: /home/noe/.config/vdu_controls/translations/es_ES.qm
10:02:43 DEBUG: Checking for es_ES translation: /usr/share/vdu_controls/translations/es_ES.qm
10:02:43 INFO: Reading autolux file '/home/noe/.config/vdu_controls/AutoLux.conf'
10:02:43 INFO: Screen DP-0
10:02:43 DEBUG: Reserve shortcut 'P'
10:02:43 DEBUG: Reserve shortcut 'G'
10:02:43 DEBUG: Reserve shortcut 'A'
10:02:43 DEBUG: Reserve shortcut 'C'
10:02:43 DEBUG: Reserve shortcut 'L'
10:02:43 DEBUG: Reserve shortcut 'S'
10:02:43 DEBUG: Reserve shortcut 'R'
10:02:43 DEBUG: Reserve shortcut 'T'
10:02:43 DEBUG: Reserve shortcut 'H'
10:02:43 DEBUG: Reserve shortcut 'Q'
10:02:43 INFO: native_font_height_pixels=18
10:02:43 INFO: Using system tray.
10:02:43 INFO: Configuring application (reconfiguring=False)...
10:02:43 DEBUG: configure: try to obtain application_configuration_lock
10:02:43 DEBUG: Holding application_configuration_lock
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Manana_7.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Manana_8_30AM.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Noche_0.1.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Noche_1.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Nube_InSole.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_2PM.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_5PM.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_6PM.conf'
10:02:43 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_7PM.conf'
10:02:43 DEBUG: Enabled callback for VDU-connectivity-change D-Bus signals
10:02:43 INFO: ddcutil version (2, 1, 4) (dynamic-sleep=True) - interface 1.0.2 (D-Bus ddcutil-service - libddcutil)
10:02:43 DEBUG: Detecting connected monitors, looping detection until it stabilises.
10:02:43 DEBUG: checking possible IDs for display 1
10:02:43 DEBUG: Unique key for vdu_number='1' manufacturer='AUS' is (model_name='PA248QV' main_id='M4LMQS006956')
10:02:45 DEBUG: checking possible IDs for display 1
10:02:45 DEBUG: Unique key for vdu_number='1' manufacturer='AUS' is (model_name='PA248QV' main_id='M4LMQS006956')
10:02:45 INFO: Number of detected monitors is stable at 1 (loop=2)
10:02:45 INFO: Initializing controls for vdu_number='1' vdu_model_name='PA248QV' self.vdu_stable_id='PA248QV_M4LMQS006956'
10:02:45 DEBUG: checking for config file '/home/noe/.config/vdu_controls/PA248QV_M4LMQS006956.conf'
10:02:45 INFO: Using config file '/home/noe/.config/vdu_controls/PA248QV_M4LMQS006956.conf'
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [metadata] version = 2.0.0
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [metadata] timestamp = 2024-01-20 19:49:00.625833-05:00
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] brightness = yes
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] contrast = yes
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] audio-volume = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] audio-mute = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] audio-treble = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] audio-bass = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] audio-mic-volume = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] input-source = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] power-mode = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] osd-language = no
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] color-temperature = yes
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [vdu-controls-widgets] enable-vcp-codes = DC
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [ddcutil-parameters] sleep-multiplier = 0.0
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [ddcutil-parameters] ddcutil-extra-args = 
10:02:45 DEBUG: config: PA248QV_M4LMQS006956.conf [ddcutil-capabilities] capabilities-override = Model: PA248QV
MCCS version: 2.1
Commands:
   Op Code: 01 (VCP Request)
   Op Code: 02 (VCP Response)
   Op Code: 03 (VCP Set)
   Op Code: 07 (Timing Request)
   Op Code: 0C (Save Settings)
   Op Code: E3 (Capabilities Reply)
   Op Code: F3 (Capabilities Request)
VCP Features:
   Feature: 02 (New control value)
   Feature: 04 (Restore factory defaults)
   Feature: 05 (Restore factory brightness/contrast defaults)
   Feature: 08 (Restore color defaults)
   Feature: 10 (Brightness)
   Feature: 12 (Contrast)
   Feature: 14 (Select color preset)
      Values:
         04: 5000 K
         05: 6500 K
         08: 9300 K
         0b: User 1
   Feature: 16 (Video gain: Red)
   Feature: 18 (Video gain: Green)
   Feature: 1A (Video gain: Blue)
   Feature: 52 (Active control)
   Feature: 60 (Input Source)
      Values:
         01: VGA-1
         11: HDMI-1
         0f: DisplayPort-1
   Feature: 62 (Audio speaker volume)
   Feature: AC (Horizontal frequency)
   Feature: AE (Vertical frequency)
   Feature: B6 (Display technology type)
   Feature: C0 (Display usage time)
   Feature: C6 (Application enable key)
   Feature: C8 (Display controller type)
   Feature: C9 (Display firmware level)
   Feature: CC (OSD Language)
      Values:
         01: Chinese (traditional, Hantai)
         02: English
         03: French
         04: German
         05: Italian
         06: Japanese
         07: Korean
         08: Portuguese (Portugal)
         09: Russian
         0a: Spanish
         0c: Turkish
         0d: Chinese (simplified / Kantai)
         11: Croatian
         12: Czech
         14: Dutch
         1a: Hungarian
         1e: Polish
         1f: Romanian 
         23: Thai
   Feature: D6 (Power mode)
      Values:
         01: DPM: On,  DPMS: Off
         04: DPM: Off, DPMS: Off
         05: Write only value to turn off display
   Feature: DC (Display Mode)
      Values:
         00: Standard/Default mode
         0b: Unrecognized value
         0d: Unrecognized value
         0e: Unrecognized value
         0f: Unrecognized value
         17: Unrecognized value
         18: Unrecognized value
         21: Unrecognized value
         22: Unrecognized value
   Feature: DF (VCP Version)
10:02:45 DEBUG: Removed PA248QV_M4LMQS006956 audio-mute - not supported by VDU
10:02:45 DEBUG: Removed PA248QV_M4LMQS006956 audio-treble - not supported by VDU
10:02:45 DEBUG: Removed PA248QV_M4LMQS006956 audio-bass - not supported by VDU
10:02:45 DEBUG: Removed PA248QV_M4LMQS006956 audio-mic-volume - not supported by VDU
10:02:45 DEBUG: Removed PA248QV_M4LMQS006956 color-temperature - not supported by VDU
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Manana_7.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Manana_8_30AM.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Noche_0.1.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Noche_1.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Nube_InSole.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_2PM.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_5PM.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_6PM.conf'
10:02:45 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Sole_7PM.conf'
10:02:45 WARNING: Failed to allocate shortcut for Sole 7PM reserved shortcuts=['P', 'G', 'A', 'C', 'L', 'S', 'R', 'T', 'H', 'Q', 'N', 'O', 'E', ' ', 'M', '7', '6']
10:02:45 INFO: splash_message: 'DDC ID 1\nPA248QV:M4LMQS006956'
10:02:45 DEBUG: vcp_value_changed: PA248QV_M4LMQS006956 vcp_code='10' 23 origin=EXTERNAL
10:02:45 DEBUG: vcp_value_changed: PA248QV_M4LMQS006956 vcp_code='12' 80 origin=EXTERNAL
10:02:45 DEBUG: vcp_value_changed: PA248QV_M4LMQS006956 vcp_code='DC' 23 origin=EXTERNAL
10:02:45 INFO: splash_message: 'Checking Presets'
10:02:45 DEBUG: SingletonDialog exists SettingsEditor False
10:02:45 DEBUG: configure: released application_configuration_lock
10:02:45 DEBUG: WorkerThread: init WorkerThread from thread_pid()=99062
10:02:45 INFO: Lux auto-brightness settings refresh - restart monitoring.
10:02:45 DEBUG: WorkerThread: init LuxAutoWorker from thread_pid()=99062
10:02:45 INFO: LuxAutoWorker: lux-meter.interval-minutes=1 lux-meter.samples-per-minute=3
10:02:45 INFO: LuxAutoWorker: lux-meter.smoother-n=5 lux-meter.smoother-alpha=0.5
10:02:45 INFO: LuxAutoWorker: lux-meter.interpolation-sensitivity-percent=10
10:02:45 INFO: LuxAutoWorker: lux-meter.convergence-divisor=2
10:02:45 INFO: LuxAutoWorker: lux-meter.step_pause_millis=100
10:02:45 DEBUG: WorkerThread: class_name='LuxAutoWorker' running in thread_pid()=99128 <bound method LuxAutoWorker.adjust_for_lux of <__main__.LuxAutoWorker object at 0x7f18613d7be0>>
10:02:45 INFO: Scheduling presets reconfiguring=True
10:02:45 INFO: Scheduled preset 'Nube InSole' for 2024-03-28 11:58:45.610177-05:00 in 116 minutes SolarElevationKey(direction='eastern-sky', elevation=89)
10:02:45 INFO: Scheduled preset 'Sole' for 2024-03-28 11:58:45.610177-05:00 in 116 minutes SolarElevationKey(direction='eastern-sky', elevation=89)
10:02:45 INFO: Scheduled preset 'Sole 5PM' for 2024-03-28 17:16:45.610177-05:00 in 434 minutes SolarElevationKey(direction='western-sky', elevation=11)
10:02:45 INFO: Scheduled preset 'Sole 2PM' for 2024-03-28 13:51:45.610177-05:00 in 229 minutes SolarElevationKey(direction='western-sky', elevation=62)
10:02:45 INFO: QueryWeather: https://wttr.in/Bogota?lang=es&format=j1
10:02:47 INFO: LuxAutoWorker monitoring commences thread_pid()=99128
10:02:47 DEBUG: WorkerThread: class_name='WorkerThread' running in thread_pid()=99138 <bound method LuxMeterSerialDevice.update_current_value of <__main__.LuxMeterSerialDevice object at 0x7f18613d76d0>>
10:02:47 INFO: LuxMeterSerialDevice: Initialising character device /dev/ttyUSB1
10:02:48 INFO: QueryWeather result: Bogota, Colombia, Niebla moderada (248),cloud_cover 0, visibility 6, location=4.600,-74.083
10:02:48 INFO: Preset Manana 8 30AM met all.weather requirements. Current weather is: Bogota 248 Niebla moderada
10:02:48 INFO: Scheduled preset 'Sole 6PM' for 2024-03-28 18:16:45.610177-05:00 in 494 minutes SolarElevationKey(direction='western-sky', elevation=-4)
10:02:48 INFO: Scheduled preset 'Sole 7PM' for 2024-03-28 19:16:45.610177-05:00 in 554 minutes SolarElevationKey(direction='western-sky', elevation=-19)
10:02:48 INFO: Scheduled preset 'Noche 0.1' for 2024-03-28 18:16:45.610177-05:00 in 494 minutes SolarElevationKey(direction='western-sky', elevation=-4)
10:02:48 INFO: Scheduled preset 'Noche 1' for 2024-03-28 18:24:45.610177-05:00 in 502 minutes SolarElevationKey(direction='western-sky', elevation=-6)
10:02:48 INFO: Will update solar elevation activations tomorrow at 2024-03-29 00:00:00-05:00 (in 837 minutes)
10:02:48 INFO: Restoring preset 'Manana 8 30AM' because its scheduled to be active at this time (2024-03-28 10:02:48.891730-05:00).
10:02:48 INFO: splash_message: 'Restoring Preset\nManana 8 30AM'
10:02:48 DEBUG: Running task in gui thread
10:02:48 INFO: Activating scheduled preset Manana 8 30AM transition=True
10:02:48 DEBUG: restore_preset: try to obtain application_configuration_lock
10:02:48 DEBUG: Reading preset file '/home/noe/.config/vdu_controls/Preset_Manana_8_30AM.conf'
10:02:48 DEBUG: WorkerThread: init PresetTransitionWorker from thread_pid()=99062
10:02:48 DEBUG: TransitionWorker: init preset.name='Manana 8 30AM' immediately=True scheduled_activity=True
10:02:48 DEBUG: restore_preset: released application_configuration_lock
10:02:48 INFO: Completed configuring application
10:02:48 DEBUG: WorkerThread: class_name='PresetTransitionWorker' running in thread_pid()=99142 <bound method PresetTransitionWorker.task_body of <__main__.PresetTransitionWorker object at 0x7f18496ac160>>
10:02:49 DEBUG: vcp_value_changed: PA248QV_M4LMQS006956 vcp_code='10' 23 origin=TRANSIENT
10:02:49 DEBUG: respond vdu_stable_id='PA248QV_M4LMQS006956' vcp_code='10' value=23 origin.name='TRANSIENT'
10:02:49 DEBUG: vcp_value_changed: PA248QV_M4LMQS006956 vcp_code='12' 80 origin=TRANSIENT
10:02:49 DEBUG: respond vdu_stable_id='PA248QV_M4LMQS006956' vcp_code='12' value=80 origin.name='TRANSIENT'
10:02:50 DEBUG: vcp_value_changed: PA248QV_M4LMQS006956 vcp_code='DC' 23 origin=TRANSIENT
10:02:50 DEBUG: respond vdu_stable_id='PA248QV_M4LMQS006956' vcp_code='DC' value=23 origin.name='TRANSIENT'
10:02:50 INFO: Restored Manana 8 30AM, elapsed: 1.36 seconds
10:02:50 DEBUG: WorkerThread: class_name='PresetTransitionWorker' terminating thread_pid()=99142
10:04:32 DEBUG: SingletonDialog exists LuxDialog False
10:04:32 DEBUG: SingletonDialog created for LuxDialog
10:04:59 INFO: Refresh commences
10:04:59 DEBUG: WorkerThread: init WorkerThread from thread_pid()=99062
10:04:59 DEBUG: WorkerThread: class_name='WorkerThread' running in thread_pid()=99977 <function VduAppController.start_refresh.<locals>.update_from_vdu at 0x7f184969cd60>
10:05:00 DEBUG: checking possible IDs for display 1
10:05:00 DEBUG: Unique key for vdu_number='1' manufacturer='AUS' is (model_name='PA248QV' main_id='M4LMQS006956')
10:05:00 DEBUG: WorkerThread: class_name='WorkerThread' terminating thread_pid()=99977
10:05:00 DEBUG: Refresh - update UI view
10:05:00 DEBUG: SingletonDialog exists LuxDialog True

I also try rename /home/noe/.config/vdu_controls to vdu_controls.bak for restore to default and test again, but the result its the same

Milor123 commented 6 months ago

Problem Solved

SOLVEDDDD, know understand it hahahaha, sorry for the issues, it was my firts time try.

I need delete all prints and only keep print with data Serial.println(lux);, also I've change the type of data of lux variable to FLOAT like in your example, and change the Serial.begin(9600); value to 9600

this code works for BH1750 GY310 the author named it as BH1750OneTimePowerMgt

#include <Wire.h>
#include <ErriezBH1750.h>

// ADDR line LOW/open:  I2C address 0x23 (0x46 including R/W bit) [default]
// ADDR line HIGH:      I2C address 0x5C (0xB8 including R/W bit)
BH1750 sensor(LOW);

void setup()
{
    Serial.begin(9600);
    while (!Serial) {
        ;
    }

    // Initialize I2C bus
    Wire.begin();

    // Initialize sensor in one-time mode, medium 1 lx resolution
    sensor.begin(ModeOneTime, ResolutionMid);
}

void loop()
{
    float lux;

    // Power on and start conversion
    sensor.startConversion();

    // Wait for completion (blocking busy-wait delay)
    if (sensor.waitForCompletion()) {
        // Read light
        lux = sensor.read();

        // Print light

        Serial.println(lux);

    } else {

    }

    // Device is automatically set in power-down after one-time conversion, but
    // powerDown() can be explicitly called as well
    //sensor.powerDown();

    // Implement power management and interrupt support here for low-power
    // devices instead of the delay example below
    delay(1000);
}

I want add the sketch used for it (download from https://github.com/Erriez/ErriezBH1750?tab=readme-ov-file)

File with codes examples of Erriez. ErriezBH1750-1.1.2.zip

Once again, I would like to express my gratitude for this wonderful application, and once again I would like to give my regards to its author. ❤️

digitaltrails commented 6 months ago

Hey, that's great news that you managed to sort this out. Thanks for taking the time to raise the issue and write up a solution.

I wasn't aware that the GY302/BH1750 differed in the coding required from the GY30. To clarify the situation I'll add some documentation to the Lux-metering.md and refer to this issue.

You're the only other confirmed user of hardware light metering. I suppose there might be a few others lurking out there. It's nice to know at another user actually exists. 👍

digitaltrails commented 5 months ago

I've added a note to Lux-metering.md.

Closing this for now. Although at some point in the future it might be good to put all this kind of stuff in a wiki.