pnbruckner / ha-illuminance

Home Assistant Illuminance Sensor
The Unlicense
154 stars 16 forks source link

Simple Mode #50

Closed Pimsey1952 closed 10 months ago

Pimsey1952 commented 10 months ago

I just cannot seem to get it to work in simple mode. I have added mode: simple to the config.yaml but then the lx value just stays constant and does not update. It is almost like it is disconnecting the config. As soon as I restart HA the reading on the card defaults to 5000lx and stays there. I am using openweathermap As soon as I remove the mode: simple the lx updates as it should. Am I missing something here, as I would like to try the simple mode. Thanks

pnbruckner commented 10 months ago

Please share your configuration for this integration. Also, please enable debug for it, restart HA, then share any errors or warnings and all debug log messages for it.

Pimsey1952 commented 10 months ago

Thank you for the response.

In the meantime I have uninstalled the integration, but I can reinstall.

Before I do that, can you please just tell me if the transition of the readings is smooth OR up and down as in your diagrams, whether normal or simple? I ask this as I wanted to use the integration for automation purposes based on lux, but it seems that the readings can drop from 4000 to say 2000 in an instant, and then rise again, and that can play havoc with any light automation.

Please set me straight here and then I will know which way to go.

Thanks for your time. It is really appreciated

------ Original Message ------ From "Phil Bruckner" @.> To "pnbruckner/ha-illuminance" @.> Cc "Pimsey1952" @.>; "Author" @.> Date 11/16/2023 6:30:22 PM Subject Re: [pnbruckner/ha-illuminance] Simple Mode (Issue #50)

Please share your configuration for this integration. Also, please enable debug for it, restart HA, then share any errors or warnings and all debug log messages for it.

— Reply to this email directly, view it on GitHub https://github.com/pnbruckner/ha-illuminance/issues/50#issuecomment-1815594349, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUTJFR3TCWPBX7CBXMR7BKLYE2425AVCNFSM6AAAAAA7OXPBO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJVGU4TIMZUHE. You are receiving this because you authored the thread.Message ID: @.***>

pnbruckner commented 10 months ago

Ignoring the weather data for now, simple mode creates a trapezoid wave. I.e., it is 10 at night, then during a small window of time in the morning around sunrise it smoothly increases to 10,000. Then it stays at 10.000 during the day. Then in the evening, it does the reverse of the morning, i.e., around sunset it smoothly decreases back down to 10. This is the way this integration worked originally. It is kept mainly for backward compatibility reasons. I wouldn't generally recommend it for new users. But I don't plan to ever remove it, so feel free to use it if you like.

Again, ignoring weather data, normal mode generates a wave that emulates the illuminance from the sun based on the sun's elevation as it rises and falls throughout the day.

They both update by default every 5 minutes, although you can increase that period via the config if you want. I'd say that normal mode generates a much smoother curve than simple mode.

Once the "fully sunny" value is determined by one of the methods above, it is then divided by a factor (between 1 and 10) which depends on the weather condition or cloud percentage (depending on what type of weather entity you've specified.)

So, if the weather condition or cloud percentage doesn't change for most of the day, you'll see a constant value for most of the day (between sunrise & sunset) when using simple mode, but you'll still see the smooth rising & falling when using normal mode (just divided by the constant weather factor.)

Based on your observations, I'd say the division factor based on the weather entity stayed constant at 2 while you were watching.

If you enable debug (see below), it will tell you when it's updating, what the weather condition is, the resulting division factor, and the "fully sunny" value and the resulting value after dividing by the weather factor.

logger:
  default: <whatever you like>
  logs:
    custom_components.illuminance: debug
Pimsey1952 commented 10 months ago

Thank you for your detailed explanation

For now I have gone back to the 'normal' mode and it is working as it should

Thanks again for your time and input

------ Original Message ------ From "Phil Bruckner" @.> To "pnbruckner/ha-illuminance" @.> Cc "Pimsey1952" @.>; "Author" @.> Date 11/17/2023 9:30:51 AM Subject Re: [pnbruckner/ha-illuminance] Simple Mode (Issue #50)

Ignoring the weather data for now, simple mode creates a trapezoid wave. I.e., it is 10 at night, then during a small window of time in the morning around sunrise it smoothly increases to 10,000. Then it stays at 10.000 during the day. Then in the evening, it does the reverse of the morning, i.e., around sunset it smoothly decreases back down to 10. This is the way this integration worked originally. It is kept mainly for backward compatibility reasons. I wouldn't generally recommend it for new users. But I don't plan to ever remove it, so feel free to use it if you like.

Again, ignoring weather data, normal mode generates a wave that emulates the illuminance from the sun based on the sun's elevation as it rises and falls throughout the day.

They both update by default every 5 minutes, although you can increase that period via the config if you want. I'd say that normal mode generates a much smoother curve than simple mode.

Once the "fully sunny" value is determined by one of the methods above, it is then divided by a factor (between 1 and 10) which depends on the weather condition or cloud percentage (depending on what type of weather entity you've specified.)

So, if the weather condition or cloud percentage doesn't change for most of the day, you'll see a constant value for most of the day (between sunrise & sunset) when using simple mode, but you'll still see the smooth rising & falling when using normal mode (just divided by the constant weather factor.)

Based on your observations, I'd say the division factor based on the weather entity stayed constant at 2 while you were watching.

If you enable debug (see below), it will tell you when it's updating, what the weather condition is, the resulting division factor, and the "fully sunny" value and the resulting value after dividing by the weather factor.

logger: default: logs: custom_components.illuminance: debug — Reply to this email directly, view it on GitHub https://github.com/pnbruckner/ha-illuminance/issues/50#issuecomment-1816729727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUTJFR2QLTNRMZTQ3REY42DYE6GLXAVCNFSM6AAAAAA7OXPBO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJWG4ZDSNZSG4. You are receiving this because you authored the thread.Message ID: @.***>

pnbruckner commented 10 months ago

No problem.

BTW, I meant to also say, when using a weather entity that only provides a condition (like sunny, cloudy, etc.), it tends to change infrequently, and there are only a few corresponding division factors used (typically 1, 2, 5 & 10), so that tends to cause big jumps that don't happen very often. This will happen with both normal and simple modes (which you can see in the two pictures in the README.md doc.)

And lastly, the simple mode was implemented based on something I used with SmartThings (a home automation system that is no longer made) before I started using HA. It was really only meant for controlling lights at sunrise & sunset. I added the use of a weather entity to adjust the estimate during the day.