pnbruckner / ha-illuminance Goto Github PK
View Code? Open in Web Editor NEWHome Assistant Illuminance Sensor
License: The Unlicense
Home Assistant Illuminance Sensor
License: The Unlicense
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
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
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 ?
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
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.
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?
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.
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!
since darksky is going away, could you add openweathermap?
Hi,
Would it be possible to add support for SMHI service?
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?)
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:
So I can plot fun charts like this:
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.
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?
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.
Hello,
I've installed the integration with HACS.
Then added:
`# Illuminance
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"
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!
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')
Hey can you add more weather integrations / Supported weather sources?
DWD - https://github.com/FL550/dwd_weather
Weather.com - https://github.com/jaydeethree/Home-Assistant-weatherdotcom
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)
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
It'd be cool if your custom component could be installed via HACS.
Also it would boost adoption/usage I think!
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!
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.
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
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:
(lux / (DAYLIGHT_LUX / 100))
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.
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'
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.
Heey,
thanks for this great integration.
I am using it successfully with weather information from https://github.com/FL550/dwd_weather, so this "issue" is my way of letting you know that you can add them to the list of supported weather sources.
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!
Because Darksky will be removed from Home Assistant it's great to have a working alternative for your work that is used by me and a lot of other users
One of the community replacements is Weatherbit:
https://community.home-assistant.io/t/weatherbit-io-current-weather-and-forecast-data/200224
https://github.com/briis/weatherbit
If possible, could you please update this component to use the data provided by the Climacell service (https://github.com/r-renato/ha-climacell-weather 2), now that Dark Sky is on its way out?
I really like what you have created here and wish I would be able to use it even after Dark Sky is removed from my instance.
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?
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?
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
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.