Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit max value of light sensor #95

Merged
merged 2 commits into from
Jun 16, 2023

Conversation

spdkimo
Copy link
Collaborator

@spdkimo spdkimo commented Jun 16, 2023

Problem: Max value of illuminance in Lux is 3.576 Mlx. But SmartThings limits its range to 100,000. MaxMeasuredValue attribute is not effect in this case.
Measure: Change the value to 100,000.

Problem: Max value of illuminance in Lux is 3.576 Mlx. But SmartThings limits its range to 100,000. MaxMeasuredValue attribute is not effect in this case.
Measure: Change the value to 100,000.
@junyong-sim
Copy link
Collaborator

How about changing below logic, too ?

lightsensor.py

def set_state(self):
        if Utils.toIlluminance(self.measured_value) >= 50000:
            self.labelStatePicture.setPixmap(Utils.get_icon_img(
                Utils.get_icon_path('lightsensor_high.png'), 70, 70))
        elif 10000 <= Utils.toIlluminance(self.measured_value) < 50000:
            self.labelStatePicture.setPixmap(Utils.get_icon_img(
                Utils.get_icon_path('lightsensor_medium.png'), 70, 70))
        else:
            self.labelStatePicture.setPixmap(Utils.get_icon_img(
                Utils.get_icon_path('lightsensor_low.png'), 70, 70))

@spdkimo
Copy link
Collaborator Author

spdkimo commented Jun 16, 2023

According to https://en.wikipedia.org/wiki/Lux, 320–500 is typical office lighting
I agree that current condition is quite coarse tuning. Do you have any idea?

Copy link
Collaborator

@junyong-sim junyong-sim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@junyong-sim
Copy link
Collaborator

According to https://en.wikipedia.org/wiki/Lux, 320–500 is typical office lighting I agree that current condition is quite coarse tuning. Do you have any idea?

No, but, your new commit looks good to me. :)

@spdkimo spdkimo merged commit 0b1dc8e into Samsung:main Jun 16, 2023
@spdkimo spdkimo deleted the spdkimo-lightsensor-initval branch June 16, 2023 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The adjustment value of the slide bar of the light sensor is abnormal.
2 participants