LTR390 different gain and resolution for ALS and UV
Describe the problem you have/What new integration you would like
The LTR390 uses one gain and resolution setting for both ALS and UV measurements. Outdoors it's not the best solution.
Please describe your use case for this integration and alternatives you've tried:
I'd like to use smaller gain and resolution for ALS measurement outdoors, so that both ALS and UV measurements would be usable
Additional context
In arduino lib example code, they are used with different values https://registry.platformio.org/libraries/levkovigor/LTR390/examples/ltr390/ltr390.ino
@tgrosz ltr390 doesnt support different gains for als/uv. That library is just switching gain and mode and then read data. I think I can update the component to do similar approach.
@tgrosz try it.
Gain can be set as usual - same value for ALS and UV (
gain: X18
or granular
gain:
ambient_light: X9
uv: X3
external_components:
- source: github://pr#7026
components: [ltr390]
sensor:
- platform: ltr390
uv_index:
name: "UV Index"
uv:
name: "UV Sensor Counts"
light:
name: "Light"
ambient_light:
name: "Light Sensor Counts"
gain:
ambient_light: X9
uv: X3
Hi @latonita , thanks - as I see it's working OK. My idea was the same - to set the gain before reading the value
@tgrosz please test separate resolution. similarly:
resolution:
ambient_light: 20
uv: 13
@latonita I get error message
Unknown value '{'ambient_light': 18, 'uv': 20}', valid options are '20', '19', '18', '17', '16', '13'. resolution: ambient_light: 18 uv: 20
I cleared build files, what else should I do?
Share your config please. Ltr390 part
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: tgrosz @.> Sent: Tuesday, July 2, 2024 12:44:32 PM To: esphome/feature-requests @.> Cc: Anton Viktorov @.>; Mention @.> Subject: Re: [esphome/feature-requests] LTR390 different gain and resolution for ALS and UV (Issue #2765)
@latonitahttps://github.com/latonita I get error message Unknown value '{'ambient_light': 18, 'uv': 20}', valid options are '20', '19', '18', '17', '16', '13'. resolution: ambient_light: 18 uv: 20 I cleared build files, what else should I do?
— Reply to this email directly, view it on GitHubhttps://github.com/esphome/feature-requests/issues/2765#issuecomment-2202709561, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6O66THOSR646M3OKCXFZTZKKABBAVCNFSM6AAAAABJNTLTDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBSG4YDSNJWGE. You are receiving this because you were mentioned.Message ID: @.***>
I have an idea - check if you have white spaces like this 'resolution: ', remove if they exist. I will check this also
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: tgrosz @.> Sent: Tuesday, July 2, 2024 12:44:32 PM To: esphome/feature-requests @.> Cc: Anton Viktorov @.>; Mention @.> Subject: Re: [esphome/feature-requests] LTR390 different gain and resolution for ALS and UV (Issue #2765)
@latonitahttps://github.com/latonita I get error message Unknown value '{'ambient_light': 18, 'uv': 20}', valid options are '20', '19', '18', '17', '16', '13'. resolution: ambient_light: 18 uv: 20 I cleared build files, what else should I do?
— Reply to this email directly, view it on GitHubhttps://github.com/esphome/feature-requests/issues/2765#issuecomment-2202709561, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6O66THOSR646M3OKCXFZTZKKABBAVCNFSM6AAAAABJNTLTDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBSG4YDSNJWGE. You are receiving this because you were mentioned.Message ID: @.***>
Tried deleting indentation and adding spaces manually, did not help
- platform: ltr390
gain:
ambient_light: X3
uv: X18
resolution:
ambient_light: 18
uv: 20
id: ltr390_
update_interval: 60s
uv_index:
name: "UV Index"
id: ltr390_uvi
unit_of_measurement: "UVI"
uv:
name: "UV"
internal: true
light:
name: "Light"
id: ltr390_light
ambient_light:
name: "Ambient Light"
internal: true
This is strange. Please send full yaml
Get Outlook for Androidhttps://aka.ms/AAb9ysg
From: tgrosz @.> Sent: Tuesday, July 2, 2024 5:12:58 PM To: esphome/feature-requests @.> Cc: Anton Viktorov @.>; Mention @.> Subject: Re: [esphome/feature-requests] LTR390 different gain and resolution for ALS and UV (Issue #2765)
Tried deleting indentation and adding spaces manually, did not help ` - platform: ltr390
gain: X18
gain: ambient_light: X3 uv: X18
resolution: 20
resolution: ambient_light: 18 uv: 20 id: ltr390_ update_interval: 60s uv_index: name: "UV Index" id: ltr390_uvi unit_of_measurement: "UVI" uv: name: "UV" internal: true light: name: "Light" id: ltr390_light ambient_light: name: "Ambient Light" internal: true`
— Reply to this email directly, view it on GitHubhttps://github.com/esphome/feature-requests/issues/2765#issuecomment-2203490449, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6O66W3CWDS5VFMY5JFDTLZKK7PVAVCNFSM6AAAAABJNTLTDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBTGQ4TANBUHE. You are receiving this because you were mentioned.Message ID: @.***>
Strange, now it compiles without any change. Maybe some cache issue. So, it works, Thanks