Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for door sensors #1592

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

albummi
Copy link

@albummi albummi commented Feb 7, 2025

Motivation:

I wanted to have additional sensors for my doors inside better thermostat with different timing, because a open door should not always shut down the heater if only for a minute, I did this with NodeRed and a Helper before. But having all in one place is more convinient

Changes:

  1. File: controlling.py
    Added handling for door sensors: Similar to window sensors, we added logic to check door sensors and turn off the HVAC system if a door is open.
    Added debugging logs: We included debugging logs to trace the state of door sensors and ensure they are being processed correctly.

  2. File: config_flow.py

  • Added configuration options for door sensors similar to window sensors. This allows users to specify door sensors in the thermostat configuration.
  1. File: trv.py
  • Modified trigger_trv_change and update_hvac_action functions to handle door sensors similar to window sensors. This ensures the HVAC mode is adjusted when a door is open.
  • Added debugging logs to ensure door sensor events are recognized and processed correctly.
  1. File: init.py
  • Fixed a syntax error related to an unclosed parenthesis in the async_update_entry call. This ensures the code is syntactically correct and can be executed without errors.
  1. File: door.py
  • Added logic to handle door sensors. This implementation monitors the state of door sensors and triggers appropriate actions based on their state.
  1. File: climate.py
  • Integrated door sensor checks into the climate control logic. This ensures that the HVAC mode is adjusted when a door is open.
  1. File: strings.json
  • Added strings related to door sensor configuration and states. This supports the new functionality for handling door sensors in the user interface.
  1. File: const.py
  • Defined new constants for door sensor configuration and states. These constants are used to manage door sensor settings and actions throughout the application.
  1. File: de.json
  • Added German translations for the new strings related to door sensor settings and states. This ensures that the user interface supports the new door sensor functionality in German.

Related issue (check one):

  • fixes #
  • [ X] There is no related issue ticket

Checklist (check one):

  • I did not change any code (e.g. documentation changes)
  • [X ] The code change is tested and works locally.

Test-Hardware list (for code changes)

Raspberry Pi5. , Homeassistent Supervised
Core 2025.1.4
Supervisor 2024.12.3
Operating System 14.2
Frontend 20250109.2

Zigbee2MQTT Version: [2.1.0]
TRV Hardware: SONOFF | TRVZB

## Motivation:
I wanted to have additional sensors for my doors inside better thermostat with different timing, because a open door should not always shut down the heater if only for a minute, I did this with NodeRed and a Helper before. But having all in one place is more convinient 

## Changes:
1. File: controlling.py
Added handling for door sensors: Similar to window sensors, we added logic to check door sensors and turn off the HVAC system if a door is open.
Added debugging logs: We included debugging logs to trace the state of door sensors and ensure they are being processed correctly.

2. File: config_flow.py
- Added configuration options for door sensors similar to window sensors. This allows users to specify door sensors in the thermostat configuration.

3. File: trv.py
- Modified `trigger_trv_change` and `update_hvac_action` functions to handle door sensors similar to window sensors. This ensures the HVAC mode is adjusted when a door is open.
- Added debugging logs to ensure door sensor events are recognized and processed correctly.

4. File: __init__.py
- Fixed a syntax error related to an unclosed parenthesis in the `async_update_entry` call. This ensures the code is syntactically correct and can be executed without errors.

5. File: door.py
- Added logic to handle door sensors. This implementation monitors the state of door sensors and triggers appropriate actions based on their state.

6. File: climate.py
- Integrated door sensor checks into the climate control logic. This ensures that the HVAC mode is adjusted when a door is open.

7. File: strings.json
- Added strings related to door sensor configuration and states. This supports the new functionality for handling door sensors in the user interface.

8. File: const.py
- Defined new constants for door sensor configuration and states. These constants are used to manage door sensor settings and actions throughout the application.

9. File: de.json
- Added German translations for the new strings related to door sensor settings and states. This ensures that the user interface supports the new door sensor functionality in German.

## Related issue (check one):

- [ ] fixes #<issue number goes here>
- [ X] There is no related issue ticket

## Checklist (check one):

- [ ] I did not change any code (e.g. documentation changes)
- [X ] The code change is tested and works locally.

## Test-Hardware list (for code changes)
Raspberry Pi5. , Homeassistent Supervised 
Core 2025.1.4
Supervisor 2024.12.3
Operating System 14.2
Frontend 20250109.2

Zigbee2MQTT Version: [2.1.0]
TRV Hardware:  SONOFF | TRVZB
@albummi
Copy link
Author

albummi commented Feb 7, 2025

Hope now everything is correct with the Git Structure ;)
Thanks for support @RubenKelevra

@RubenKelevra
Copy link
Collaborator

Hope now everything is correct with the Git Structure ;) Thanks for support @RubenKelevra

Yep, everything is fine now!

@RubenKelevra
Copy link
Collaborator

Have you tested this code locally?

@albummi
Copy link
Author

albummi commented Feb 7, 2025

Have you tested this code locally?

Yes, Tested with Virtual Devices first, also tested with real sensors. Door or window open turns off heater.
Tested with different delay times. Also tested creating new Thermostat entities and changing existing one.

Found no problem while day testing yesterday. Actually the changed version is running on my HA in normal use.
Please test if it also works in your enviroment to make sure it's stable with different devices / configurations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants