Hey everyone! I’ve been working on a little project to figure out whether my room is heating up because of the sun or because my heater is kicking in. It’s been a fun challenge, and I wanted to share my findings and solution in case anyone else is tackling a similar problem. ### The Problem I have a temperature sensor placed right above my heater. When the heater turns on, the temperature spikes quickly, but when the sun starts shining through the window, the temperature rises more gradually. I wanted a way to distinguish between these two scenarios so I could adjust my home automation accordingly. ### My Initial Thoughts I thought maybe I could measure how quickly the temperature changes. If the temperature rises rapidly, it’s likely the heater. If it rises more slowly, it’s probably the sun. But how do I translate that into something my smart home system can understand? ### The Solution After some research, I discovered that I could use a combination of temperature sensors and a custom automation in Home Assistant to achieve this. Here’s how I did it: 1. Temperature Sensor Setup - I used my existing temperature sensor above the heater. - I also added a secondary sensor in a different part of the room to get a more general reading. 2. Automation Logic - I set up an automation that checks the temperature every 5 minutes. - The automation compares the current temperature to the temperature from 5 minutes ago. - If the temperature has increased by more than 2°F in that time, it triggers the “heater on” scenario. - If the increase is less than 2°F, it assumes the sun is the cause. 3. Implementation in Home Assistant - I used a template to calculate the temperature difference. - I then used this value to trigger different scenes or notifications. Here’s a snippet of the automation I used: yaml alias: Heater vs. Sun Detection trigger: platform: time_pattern minutes: /5 action: service: input_boolean.turn_on data: entity_id: input_boolean.heater_active condition: condition: template value_template: >- {{ states.sensor.temperature_sensor.state | float - states.sensor.temperature_sensor.attributes.last_5_minutes | float > 2 }} ### Tips for Success - Testing: Start with a larger temperature threshold (like 3°F) and adjust based on your observations. - Location: Make sure your sensors are placed optimally to capture the temperature changes accurately. - Logging: Keep logs of temperature changes over time to refine your automation. ### Conclusion It’s been really satisfying to see this automation working as intended. Now, I can easily tell whether the heater or the sun is responsible for the temperature changes in my room. If anyone has any questions or suggestions, I’d love to hear them! Happy automating! ![]()