Metadata-Version: 2.4
Name: sun-hit-detector
Version: 2.2.0
Summary: A deterministic geometric simulator for sunlight-plant hit detection
Author: Sun Plant Simulator Team
License: MIT License
        
        Copyright (c) 2024 matiazo
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/matiazo/SunHitsIndoorPlant3DSimulator
Project-URL: Repository, https://github.com/matiazo/SunHitsIndoorPlant3DSimulator
Project-URL: Issues, https://github.com/matiazo/SunHitsIndoorPlant3DSimulator/issues
Keywords: simulation,sunlight,3d,geometry,home-assistant
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24.0
Requires-Dist: tzdata>=2023.3
Provides-Extra: visualization
Requires-Dist: plotly>=5.18.0; extra == "visualization"
Provides-Extra: full
Requires-Dist: plotly>=5.18.0; extra == "full"
Requires-Dist: pydantic>=2.0.0; extra == "full"
Requires-Dist: tzdata>=2023.3; extra == "full"
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Dynamic: license-file

# Sun Shade Integration for Home Assistant

A Home Assistant custom integration that uses 3D ray-casting simulation to determine when direct sunlight reaches indoor plants through windows.

```
                        * Sun
                       /
                      /  azimuth + elevation
                     /
   =================/=================
   ||    WALL    |     |    WALL    ||
   ||            |     |           ||          OUTSIDE
   ||            |  W  |           ||
   ||            |  I  |           ||
   ||            |  N  | ray       ||
   ||            |  D  |/          ||
   =============|  O  |============/
                |  W  |\
                |     | \            +------------------------------+
                +-----+  \          |  Home Assistant Entities      |
                       \  \         |------------------------------|
                    /---\--\        |  window_1a has sun:  ON       |
       ROOM        | //  \ |       |  window_1a intensity: 78%     |
                   | PLANT |       |  window_1a angle:    25 deg   |
                   | \\  / |       |                               |
                   +-------+       |  Plant sun start:  13:45      |
                                   |  Plant sun end:    15:30      |
                                   |  Plant sun duration: 120 min  |
                                   +-------------------------------+
```

### Entities Created

**Per window (real-time, updated every N seconds):**
- `binary_sensor.<window>_has_sun` — whether the window is receiving direct sunlight
- `sensor.<window>_sun_intensity` — intensity factor (0-100%)
- `sensor.<window>_sun_angle` — angle between sun and window normal (0-90 deg)

**Plant-level (daily forecast, computed once per day):**
- `sensor.plant_sun_start` — first time sun hits the plant today (like sunrise)
- `sensor.plant_sun_end` — last time sun hits the plant today (like sunset)
- `sensor.plant_sun_duration` — total sun exposure in minutes (like day length)

## Installation

### HACS (Recommended)

1. Open HACS in your Home Assistant instance
2. Click the three dots in the top right corner and select **Custom repositories**
3. Add `https://github.com/matiazo/SunHitsIndoorPlant3DSimulator` with category **Integration**
4. Click **Install**
5. Restart Home Assistant
6. Go to **Settings > Integrations > Add Integration** and search for "Sun Shade Integration"

### Manual

1. Copy the `custom_components/sun_shade_integration` folder into your Home Assistant `config/custom_components/` directory
2. Restart Home Assistant
3. Go to **Settings > Integrations > Add Integration** and search for "Sun Shade Integration"

## Documentation

See the full integration docs at [`custom_components/sun_shade_integration/README.md`](custom_components/sun_shade_integration/README.md) for config flow details, entity reference, and troubleshooting.
