Giter Site home page Giter Site logo

ha-illuminance's People

Contributors

el97 avatar gpoole avatar marcinsu avatar menelao147 avatar pnbruckner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-illuminance's Issues

Simple Mode

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

Values sometimes jump around wildly

Occasionally I'll get values that swing wildly. Not sure if this is due to specific weather conditions, temporary glitches in weather data, or what.

Example:
image
Zoomed in on that big drop:
image

Other days can jump around even more:
image

My configuration options:
image

Would this be expected behavior?

Error in homeassistant 2023.4

After updating to homeassistant 2023.4.0 I get this error "Platform error sensor.illuminance - No module named 'homeassistant.components.darksky'"
The configuration i have is

  • platform: illuminance
    entity_id: weather.home
    Where weather.home is a met.no weather entity.

Darksky in manifest ?

Hi,

I've just downloaded the updated version of this without the DarkSky dependency.
I do still see the DarkSky reference in the manifest. Is this something that can be equally removed, or does it still server a purpose ?

Forecast.io Libraryy Missing

Trying to setup again the illuminance sensor

Tried via YR and WU integrations (have a key)
I keep getting this error in the log
Please note that I do not use darksky (used in the past)

2020-04-06 19:11:02 ERROR (MainThread) [homeassistant.config] Platform error: sensor Traceback (most recent call last): File "/home/reinan/homeassistant/lib/python3.7/site-packages/homeassistant/config.py", line 769, in async_process_component_config platform = p_integration.get_platform(domain) File "/home/reinan/homeassistant/lib/python3.7/site-packages/homeassistant/loader.py", line 277, in get_platform f"{self.pkg_path}.{platform_name}" File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/reinan/.homeassistant/custom_components/illuminance/sensor.py", line 17, in <module> from homeassistant.components.darksky.sensor import ( File "/home/reinan/homeassistant/lib/python3.7/site-packages/homeassistant/components/darksky/sensor.py", line 5, in <module> import forecastio ModuleNotFoundError: No module named 'forecastio'

Running HA Core on debian

Darksky integration removed in 2023.4.0b6 causing startup failure

With Home Assistant 2023.4.0b6 released the Darksky integration have been removed. This causes a failure to for this module to start.

Platform error: sensor

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 928, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 779, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 796, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/illuminance/sensor.py", line 22, in <module>
    from homeassistant.components.darksky.weather import MAP_CONDITION as DSW_MAP_CONDITION
ModuleNotFoundError: No module named 'homeassistant.components.darksky'

Home Assistant 2023.4.0 is scheduled to be released tomorrow, on the 5th of April.

Automation integration

Hi,

I'm trying to integrate your project to trigger an automation.

I would like it to trigger an action when illumination is at a certain level. For some reason, I can't manage to get it working.

Any instructions on this matter?

Many error messages

I found many error messages like this in my log file:
2024-04-22 06:14:13.000 ERROR (MainThread) [custom_components.illuminance.sensor] Illuminance met.no: Cloud coverage sensor state is not a number between 0 and 100: 138
There are more than 1000 lines like this - per second!
That doesn't just happen with met.no but also with other weather-integrations. The coverage sensors seems to give values above 100 especally at night.

What is the Weather Underground query?

The link in the documentation:

https://www.wunderground.com/weather/api/d/docs?d=data/index

Redirects to:

https://www.wunderground.com/member/api-keys

And the example config just says:

query: !secret wu_query

So my question is, what is this query that's required?

Thanks!

Feature request: Support of Buienradar

As Dark Sky seem to be decommissioned, I'm moving towards Buienradar which is fully free (at least forthe time being).

Any possibility to support this? (or recommendation on how to customize the integration?)

Illuminance Forecast

Since the sensor is a calculated value, would it be possible to provide the forecast of illuminance in the next 12 hours, if the forecast data is provided?

For example, the Accuweather API (not the Accuweather HA integration) provides 12 hours of cloud cover forecast:

image

So I can plot fun charts like this:

image

Would be nice if I can feed the data into this integration and get what the illuminance is like for the next 12 hours. I can make automations that preemptively turn on lights in anticipation of darker skies, or it's useful simply for checking if I need to wear a hat.

No state history found

After I upgraded HA core to 2023.8.4 and HA OS to 10.5 estimated illuminance stopped with "no state history found" error message.

What is the cause?

Question / Feature Request regarding scan interval

Hello, first off, thanks for this custom integration! It's been really useful to me in having better control over my landscape lights without possessing an outdoor luminosity sensor.

With that said, my automations could be more precise if the scan interval could be lower. Is there a technical reason why the minimum is 5 minutes? I'd appreciate being able to lower my scan interval to 1 minute.

Documentation is unclear

Hello,

I've installed the integration with HACS.
Then added:

`# Illuminance

  • platform: illuminance
    entity_id: weather.accuweather_house`

and

- sensor: - name: "LUX: Exterior" unique_id: lux_exterior state: "{{ state_attr('weather.accuweather_house', 'illuminance') }}"

but those just don't work. I can't seem to make this sensor work.
I'm using accuweather. being the entiry "weather.accuweather_house"

More sensors

It is possible to create more of one illuminance sensor?
I have tried to for comparison between Accuweather, AEMET (Spain) and others, but witout luck.

And another question. It's the same to use 'weather.accuweather' and 'sensor.accuweather_cloud_cover' as entity for illuminance sensor creation? Or the integration takes the cloud cover from 'weather.accuweather' directly?

Thanks!

Failure due to darksky

With the latest update, the integration fails to start since I don't have darksky configured.

2023-01-10 07:58:45.800 ERROR (MainThread) [homeassistant.setup] Setup failed for darksky: No setup or config entry setup function defined.
2023-01-10 07:58:46.317 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of illuminance. Setup failed for dependencies: darksky
2023-01-10 07:58:46.321 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform illuminance.sensor: (DependencyError(...), 'Could not setup dependencies: darksky')

Unhandled reload exception

HA: 2024.3.0b1

Error:

Logger: homeassistant
Source: config_entries.py:1575
First occurred: 9:10:27 AM (2 occurrences)
Last logged: 9:10:27 AM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1603, in async_reload
    unload_result = await self.async_unload(entry_id)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1575, in async_unload
    raise OperationNotAllowed(
homeassistant.config_entries.OperationNotAllowed: The config entry Illuminance (illuminance) with entry_id 150df2dfcb364e5436c1de92d528e176 cannot be unloaded because it is not in a recoverable state (ConfigEntryState.SETUP_IN_PROGRESS)

Illuminance Startup Error (Darksky)

Hi,
I've updated to the latest version of the integration through HACS and am seeing this error:

Logger: homeassistant.setup
Source: setup.py:334 
First occurred: 10:58:27 (1 occurrences) 
Last logged: 10:58:27

Unable to prepare setup for platform illuminance.sensor: (DependencyError(...), 'Could not setup dependencies: darksky')

I don't have dark sky setup, and I guess I can't because the APIs are now depreciated, so not sure how to fix this

Constant curve, not taking info on the weather conditions

Hi,
My graph is constant every day dispite changes in weather conditions.

image

I have Met.no installed.

Code:

  - platform: illuminance
    name: Outdoor Illuminance
    entity_id: weather.forecast_home

EntityID above is the Mee.no entity
Have I missed something in the configuration?

Use Accuweather Cloud Cover %

The Accuweather HA integration also provides a Cloud Cover % value. Using that should result in a more accurate graph instead of mapping the current conditions.

Thanks for the awesome integration!

HACS Custom Updater

Unable to add this repository to settings in HACS custom repositories

Repo: https://github.com/pnbruckner/ha-illuminance

HACS UI Error: Could not add 'pnbruckner/ha-illuminance' with type 'plugin' at this time. If you used the correct type, check the log for more details.

Logs:
2019-08-22 17:10:57 ERROR (MainThread) [hacs.repository.plugin.pnbruckner.ha-illuminance] Repostitory structure not compliant 2019-08-22 17:10:57 ERROR (MainThread) [hacs.api] Validation for pnbruckner/ha-illuminance failed.

Error loading 5.4.0 with HA 2023.12.4

Logger: homeassistant.loader
Source: loader.py:814
First occurred: 12:51:00 AM (1 occurrences)
Last logged: 12:51:00 AM

Unexpected exception importing component custom_components.illuminance
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 814, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/config/custom_components/illuminance/init.py", line 25, in
from .sensor import ILLUMINANCE_SCHEMA
File "/config/custom_components/illuminance/sensor.py", line 155, in
@DataClass(frozen=True, kw_only=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dataclasses.py", line 1220, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dataclasses.py", line 993, in _process_class
raise TypeError('cannot inherit frozen dataclass from a '
TypeError: cannot inherit frozen dataclass from a non-frozen one

Feature Request: Brightness percentage entities

It would be helpful if ha-illuminance provides entities to be used as value for the brightness of light entities.

Multiple entities for different needs:

  • brightness percentage mapping to estimated illuminance (lux / (DAYLIGHT_LUX / 100))
  • brightness percentage mapping to estimated illuminance that does the reverse of above

The reverse values for people that want their lights to blast on in the evening, instead of following the natural circadian rhythm.

Filtered with lower bound set to 1 and upper bound to 100.

DAYLIGHT_LUX being 400, the lux value during sunrise or sunset.

yr removed

As per 0.115.1 blog,

The yr integration has been removed after a request from yr.no. Use the Met.no integration instead (@Danielhiversen - #39247)

This breaks this integration, although I'm not using yr myself.

  - platform: illuminance                                                       # Luminosité extérieur
    name: DSW Illuminance
    entity_id: weather.dark_sky
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 815, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 401, in get_platform
    cache[full_name] = importlib.import_module(
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/illuminance/sensor.py", line 19, in <module>
    from homeassistant.components.yr.sensor import ATTRIBUTION as YRS_ATTRIBUTION
ModuleNotFoundError: No module named 'homeassistant.components.yr'

Ramp variation according to weather

I noticed that it gets darker more rapidly when the weather is bad, than it would when it is sunny.
The sunset ramp always starts one hour earlier, regardless of the weather conditions, and I would argue that in these conditions the ramp should start earlier.

Its now 18:30, its cloudy and its getting dark, the sun will be setting at 20:14.
A real sensor outside is reporting ~1200lx, this sensor reports 7500lx, and will continue until 19:14.

edit: I know its not perfect and it is supposed to be a rough estimation but I just thought this could be an improvement. Its an awesome piece of software, thank you for that.

Error message after update of Home Assistant

After updating Home Assistant to:
Home Assistant 2023.4.1
Supervisor 2023.04.0
Operating System 9.5
Frontend 20230406.1 - latest

I get the following error, which prevents HA to restart:
Platform error sensor.illuminance - No module named 'homeassistant.components.darksky'
Commenting out these lines in configuration.yaml solves the issue, of course disabling the sensor :( :

#  - platform: illuminance
#    entity_id: sensor.openweathermap_condition

Any hint on how to resolve this? Thanks!

FR: Add irradiance equivalent as an output option

Rather than for light levels, I am using the irradiance sensors to estimate how much heat my windows are getting from the Sun and whether it is worth it to close the blinds.

The conversion factor from lx to W/m2 for the Sun is around 120 lx/(W/m2), so it's just a constant value for the relevant range of Solar illuminances. Here is a reference:

https://www.extrica.com/article/21667

Could you add irradiance as an output option to your integration?

Feature Request: fallback when weather sensor fails

The last Home Assistant update broke OpenWeatherMap, resulting in the illuminance sensor returning unknown, (log: No attribution attribute: weather.openweathermap.)
My automations expect a numeric value (to prevent flickering the lights when illuminance is unknown during HA restart), so didn't turn on my lights when it got dark.

Maybe instead of bailing out when it can't find/handle current conditions, the illuminance sensor could just fall back to ignoring the weather sensor, so lights at least still turn on/off according to day/night?

Add support for your own illumaniance sensor

Because Darksky will be removed it's good to have a working alternative. On of the ideas that could be done is giving users the choice of determing their own illuminance sensor. Make this in a predefined template sensor that is used by the HA-Illuminance sensor or just use the illuminance from one of the device below

For example:
Own weatherstation like weatherflow - https://github.com/briis/smartweather
Xiaomi light sensor - https://nl.aliexpress.com/item/4000475208359.html?spm=a2g0s.9042311.0.0.27424c4d6xJq8U
Xiaomi motion sensor - https://www.aliexpress.com/snapshot/0.html?spm=a2g0s.9042311.0.0.27424c4dfukaxi&orderId=900277006434090&productId=32975225751

config_check in v0.96 errors

I poked around and tried a few things but wasn't able to figure this out. All of my other custom_components are fine. This started with the 96 upgrade.

Testing configuration at /opt/hass-prod-cfg
Failed config
  General Errors:
    - Platform not found: sensor.illuminance

Successful config (partial)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.