├── requirements.txt ├── hacs.json ├── .github ├── dependabot.yml └── workflows │ └── actions.yaml ├── custom_components └── ventoptimization │ ├── manifest.json │ ├── const.py │ ├── translations │ ├── sk.json │ ├── en.json │ └── de.json │ ├── __init__.py │ ├── config_flow.py │ └── sensor.py ├── README.md ├── LICENSE └── .gitignore /requirements.txt: -------------------------------------------------------------------------------- 1 | homeassistant==2025.9.3 2 | -------------------------------------------------------------------------------- /hacs.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Vent Optimization", 3 | "render_readme": true, 4 | "zip_release": true, 5 | "filename": "ventoptimization.zip" 6 | } 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | 8 | - package-ecosystem: "pip" 9 | directory: "/" 10 | schedule: 11 | interval: weekly 12 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "domain": "ventoptimization", 3 | "name": "Vent optimization", 4 | "codeowners": ["@HrGaertner"], 5 | "config_flow": true, 6 | "dependencies": [], 7 | "documentation": "https://github.com/HrGaertner/HA-vent-optimization", 8 | "iot_class": "local_push", 9 | "issue_tracker": "https://github.com/HrGaertner/HA-vent-optimization/issues/", 10 | "requirements": [], 11 | "version": "0.8" 12 | } 13 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/const.py: -------------------------------------------------------------------------------- 1 | # Base component constants 2 | DOMAIN = "ventoptimization" 3 | DEFAULT_NAME = "Vent Optimization Time" 4 | 5 | # Configuration and options 6 | CONF_ROOM_VOLUME = "room_volume" 7 | CONF_WINDOW_SIZE = "total_open_window_surface" 8 | CONF_MAX_ALLOWED_HUMIDITY = "maximum_wished_humidity" 9 | 10 | CONF_INDOOR_TEMP = "indoor_temp_sensor" 11 | CONF_OUTDOOR_TEMP = "outdoor_temp_sensor" 12 | CONF_INDOOR_HUMIDITY = "indoor_humidity_sensor" 13 | CONF_OUTDOOR_HUMIDITY = "outdoor_humidity_sensor" 14 | -------------------------------------------------------------------------------- /.github/workflows/actions.yaml: -------------------------------------------------------------------------------- 1 | name: Validate 2 | 3 | on: 4 | push: 5 | pull_request: 6 | schedule: 7 | - cron: "0 0 * * *" 8 | 9 | jobs: 10 | validate_hacs: 11 | name: "HACS Validation" 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: "actions/checkout@v4" 15 | - name: HACS Action 16 | uses: "hacs/action@main" 17 | with: 18 | category: "integration" 19 | validate_hassfest: 20 | name: "Hassfest Validation" 21 | runs-on: "ubuntu-latest" 22 | steps: 23 | - uses: "actions/checkout@v4" 24 | - uses: home-assistant/actions/hassfest@master -------------------------------------------------------------------------------- /custom_components/ventoptimization/translations/sk.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "step": { 4 | "user": { 5 | "title": "Optimalizácia vetrania", 6 | "description": "Integrácia pre Home-Assistant, ktorá predpovedá, ako dlho musíte otvárať okná, aby ste predišli plesniam a iným nepríjemným veciam.", 7 | "data": { 8 | "room_volume": "Objem miestnosti", 9 | "indoor_humidity_sensor": "Vnútorný snímač vlhkosti", 10 | "indoor_temp_sensor": "Vnútorný snímač teploty", 11 | "outdoor_temp_sensor": "Vonkajší snímač teploty", 12 | "outdoor_humidity_sensor": "Vonkajší snímač vlhkosti", 13 | "maximum_wished_humidity": "Maximálna požadovaná vlhkosť", 14 | "total_open_window_surface": "Celková plocha otvoreného okna" 15 | } 16 | } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/translations/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "step": { 4 | "user": { 5 | "title": "Vent Optimization", 6 | "description": "An integration for Home Assistant that predicts how long you have to open your windows in order to prevent mold and other nasty things.", 7 | "data": { 8 | "room_volume": "Room Volume", 9 | "indoor_humidity_sensor": "Indoor Humidity Sensor", 10 | "indoor_temp_sensor": "Indoor Temperature Sensor", 11 | "outdoor_temp_sensor": "Outdoor Temperature Sensor", 12 | "outdoor_humidity_sensor": "Outdoor Humidity Sensor", 13 | "maximum_wished_humidity": "Maximum Wished Humidity", 14 | "total_open_window_surface": "Total Open Window Surface" 15 | } 16 | } 17 | }, 18 | "abort": { 19 | "already_configured": "Entry with the same name is already configured", 20 | "reconfigure_successful": "Successfully reconfigured" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/translations/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "config": { 3 | "step": { 4 | "user": { 5 | "title": "Vent Optimization", 6 | "description": "Eine Integration für Home Assistant, die vorhersagt, wie lange du lüften musst, um Schimmel zu verhindern.", 7 | "data": { 8 | "room_volume": "Zimmervolumen", 9 | "indoor_humidity_sensor": "Innenluftluftfeuchtigkeits-Sensor", 10 | "indoor_temp_sensor": "Innentemperatur-Sensor", 11 | "outdoor_temp_sensor": "Außentemperatur-Sensor", 12 | "outdoor_humidity_sensor": "Außenluftfeuchtigkeits-Sensor", 13 | "maximum_wished_humidity": "Maximale gewünschte Luftfeuchtigkeit", 14 | "total_open_window_surface": "Gesamtfläche der geöffneten Fenster" 15 | } 16 | } 17 | }, 18 | "abort": { 19 | "already_configured": "Ein Eintrag mit diesem Namen ist bereits konfiguriert", 20 | "reconfigure_successful": "Erfolgreich neu konfiguriert" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/__init__.py: -------------------------------------------------------------------------------- 1 | """Predicts how long you have to vent given temperature and humidity from inside and outside""" 2 | 3 | from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN 4 | from homeassistant.config_entries import ConfigEntry 5 | from homeassistant.core import HomeAssistant 6 | 7 | 8 | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): 9 | """ 10 | Set up this integration using the UI. 11 | 12 | This function is called by Home Assistant when the integration is set up with the UI. 13 | """ 14 | # Forward entry setup for the sensor platform 15 | await hass.config_entries.async_forward_entry_setups(entry, [SENSOR_DOMAIN]) 16 | 17 | return True 18 | 19 | 20 | async def async_unload_entry(_hass: HomeAssistant, _entry: ConfigEntry) -> bool: 21 | """ 22 | Handle removal of an entry. 23 | 24 | This function is called by Home Assistant when the integration is being removed. 25 | """ 26 | return await _hass.config_entries.async_forward_entry_unload(_entry, SENSOR_DOMAIN) 27 | 28 | 29 | async def async_reload_entry(_hass: HomeAssistant, _entry: ConfigEntry) -> None: 30 | """ 31 | Reload config entry. 32 | 33 | This function is called by Home Assistant when the integration configuration is updated. 34 | """ 35 | # Unload the entry and its dependent components 36 | await async_unload_entry(_hass, _entry) 37 | 38 | # Set up the entry again 39 | await async_setup_entry(_hass, _entry) 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vent Optimization 2 | [![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg?style=for-the-badge)](https://github.com/hacs/integration) 3 | ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/HrGaertner/HA-vent-optimization/actions.yaml?label=HA%20compatible&style=for-the-badge) 4 | 5 | A integration for Home-Assistant that predicts how long you have to open your windows (specially optimized for bathrooms, but should work for any other room too) in order to prevent mold and other nasty things. You can use it for example to get notification how long you should vent if it is necessary. 6 | 7 | ## Installation 8 | Install [HACS](https://hacs.xyz) 9 | 10 | Use this link: 11 | 12 | [![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=HrGaertner&repository=HA-vent-optimization&category=integration) 13 | 14 | And install the integration 15 | 16 | ## Configuration 17 | You can configure and setup this integration via a Config Flow. Thanks a lot to [Alexwijn](https://github.com/Alexwijn) 18 | 19 | ![image](https://github.com/HrGaertner/HA-vent-optimization/assets/53614377/d1e04abb-b06d-4407-89e2-3754c54de6bf) 20 | 21 | ## Sensor Values 22 | - `0 minutes` means venting doesn't make sense right now because the outside is to humid 23 | - `1-299 minutes` means you should vent for that amount of time 24 | - `300 minutes` means it would take 300 minutes or longer to vent 25 | - `unavailable` means one or more of the temperature and humidity sensors are unavailable 26 | 27 | ## The optimization 28 | If you want to customize the opimization to adapt to your local situation gather training data and use either this [jupyter notebook](https://github.com/HrGaertner/vent-optimization/blob/main/code/model%7Ctraining/model-training.ipynb) or this [webapp](https://hrgaertner.github.io/vent-optimization/) (under "Training" (i am sorry it is currently German only)) 29 | 30 | To learn about the model and the optimization itself have look at the whole repository dedicated to the development of the model and the webapp 31 | 32 | **This integration used the [Mold Indicator Integration](https://www.home-assistant.io/integrations/mold_indicator/) as a minimal template to start from.** 33 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/config_flow.py: -------------------------------------------------------------------------------- 1 | from typing import Any 2 | 3 | import voluptuous as vol 4 | from homeassistant import config_entries 5 | from homeassistant.components.sensor import SensorDeviceClass 6 | from homeassistant.const import CONF_NAME, PERCENTAGE, UnitOfArea, UnitOfVolume 7 | from homeassistant.data_entry_flow import FlowResult 8 | from homeassistant.helpers import selector 9 | 10 | from .const import * 11 | 12 | 13 | class VentOptimizationFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): 14 | """Config flow.""" 15 | 16 | VERSION = 1 17 | 18 | def __init__(self, *args, **kwargs): 19 | self._name = DEFAULT_NAME 20 | self._indoor_temp = None 21 | self._outdoor_temp = None 22 | self._indoor_humidity = None 23 | self._outdoor_humidity = None 24 | self._window_size = 0.75 25 | self._room_volume = 30 26 | self._max_allowed_humidity = 65 27 | self._existing_entry: ConfigEntry | None = None 28 | super().__init__(*args, **kwargs) 29 | 30 | async def async_step_user(self, _user_input=None) -> FlowResult: 31 | if _user_input is not None: 32 | await self.async_set_unique_id( 33 | _user_input[CONF_NAME].lower().replace(" ", "_") 34 | ) 35 | if self._existing_entry is None: 36 | self._abort_if_unique_id_configured() 37 | else: 38 | self.hass.config_entries.async_update_entry( 39 | self._existing_entry, data=_user_input 40 | ) 41 | self.hass.async_create_task( 42 | self.hass.config_entries.async_reload(self._existing_entry.entry_id) 43 | ) 44 | return self.async_abort(reason="reconfigure_successful") 45 | return self.async_create_entry( 46 | title=_user_input[CONF_NAME], data=_user_input 47 | ) 48 | 49 | humidity_entity_selector = selector.EntitySelector( 50 | selector.EntitySelectorConfig(device_class=SensorDeviceClass.HUMIDITY) 51 | ) 52 | 53 | temperature_entity_selector = selector.EntitySelector( 54 | selector.EntitySelectorConfig(device_class=SensorDeviceClass.TEMPERATURE) 55 | ) 56 | 57 | return self.async_show_form( 58 | step_id="user", 59 | data_schema=vol.Schema({ 60 | vol.Required(CONF_NAME, default=self._name): str, 61 | vol.Required(CONF_INDOOR_TEMP, default=self._indoor_temp): temperature_entity_selector, 62 | vol.Required(CONF_OUTDOOR_TEMP, default=self._outdoor_temp): temperature_entity_selector, 63 | vol.Required(CONF_INDOOR_HUMIDITY, default=self._indoor_humidity): humidity_entity_selector, 64 | vol.Required(CONF_OUTDOOR_HUMIDITY, default=self._outdoor_humidity): humidity_entity_selector, 65 | vol.Optional(CONF_WINDOW_SIZE, default=self._window_size): selector.NumberSelector( 66 | selector.NumberSelectorConfig(min=0, max=10, step=0.1, unit_of_measurement=UnitOfArea.SQUARE_METERS) 67 | ), 68 | vol.Optional(CONF_ROOM_VOLUME, default=self._room_volume): selector.NumberSelector( 69 | selector.NumberSelectorConfig(min=0, max=100, step=0.1, unit_of_measurement=UnitOfVolume.CUBIC_METERS) 70 | ), 71 | vol.Optional(CONF_MAX_ALLOWED_HUMIDITY, default=self._max_allowed_humidity): selector.NumberSelector( 72 | selector.NumberSelectorConfig(min=1, max=100, step=1, unit_of_measurement=PERCENTAGE) 73 | ), 74 | }), 75 | ) 76 | 77 | async def async_step_reconfigure(self, _user_input: dict[str, Any] | None = None) -> FlowResult: 78 | self._existing_entry = self.hass.config_entries.async_get_entry( 79 | self.context["entry_id"] 80 | ) 81 | assert self._existing_entry is not None 82 | if _user_input is None: 83 | self._name = self._existing_entry.data.get(CONF_NAME, self._indoor_temp) 84 | self._indoor_temp = self._existing_entry.data.get(CONF_INDOOR_TEMP, self._indoor_temp) 85 | self._outdoor_temp = self._existing_entry.data.get(CONF_OUTDOOR_TEMP, self._outdoor_temp) 86 | self._indoor_humidity = self._existing_entry.data.get(CONF_INDOOR_HUMIDITY, self._indoor_humidity) 87 | self._outdoor_humidity = self._existing_entry.data.get(CONF_OUTDOOR_HUMIDITY, self._outdoor_humidity) 88 | self._window_size = self._existing_entry.data.get(CONF_WINDOW_SIZE, self._window_size) 89 | self._room_volume = self._existing_entry.data.get(CONF_ROOM_VOLUME, self._room_volume) 90 | self._max_allowed_humidity = self._existing_entry.data.get(CONF_MAX_ALLOWED_HUMIDITY, self._max_allowed_humidity) 91 | return await self.async_step_user(_user_input) 92 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /custom_components/ventoptimization/sensor.py: -------------------------------------------------------------------------------- 1 | """Calculates how long one has to vent for a given values.""" 2 | from __future__ import annotations 3 | 4 | import logging 5 | import math 6 | 7 | import voluptuous as vol 8 | 9 | from homeassistant import util 10 | from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity 11 | from homeassistant.config_entries import ConfigEntry 12 | from homeassistant.const import ( 13 | ATTR_UNIT_OF_MEASUREMENT, 14 | CONF_NAME, 15 | UnitOfTime, 16 | PERCENTAGE, 17 | EVENT_HOMEASSISTANT_START, 18 | STATE_UNKNOWN, 19 | UnitOfTemperature, 20 | ) 21 | from homeassistant.core import HomeAssistant, callback 22 | import homeassistant.helpers.config_validation as cv 23 | from homeassistant.helpers.entity_platform import AddEntitiesCallback 24 | from homeassistant.helpers.event import async_track_state_change_event 25 | from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType 26 | from homeassistant.util.unit_conversion import TemperatureConverter 27 | from homeassistant.util.unit_system import METRIC_SYSTEM 28 | 29 | from .const import * 30 | 31 | _LOGGER = logging.getLogger(__name__) 32 | 33 | ATTR_MAXIMUM_HUMIDITY = "maximum_possible_indoor_absolute_humidity" 34 | ATTR_INDOOR_ABSOLUTE_HUMIDITY = "absolute_humidity_inside" 35 | ATTR_OUTDOOR_ABSOLUTE_HUMIDITY = "absolute_humidity_outside" 36 | 37 | # Parameters of the model 38 | k_1 = 49.9737675 39 | k_2 = 2.28452262 40 | k_3 = 49.3679433 41 | k_4 = 8.39747826 42 | 43 | PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( 44 | { 45 | vol.Required(CONF_INDOOR_TEMP): cv.entity_id, 46 | vol.Required(CONF_OUTDOOR_TEMP): cv.entity_id, 47 | vol.Required(CONF_INDOOR_HUMIDITY): cv.entity_id, 48 | vol.Required(CONF_OUTDOOR_HUMIDITY): cv.entity_id, 49 | vol.Optional(CONF_MAX_ALLOWED_HUMIDITY): vol.Coerce(float), 50 | vol.Optional(CONF_ROOM_VOLUME): vol.Coerce(float), 51 | vol.Optional(CONF_WINDOW_SIZE): vol.Coerce(float), 52 | vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, 53 | } 54 | ) 55 | 56 | async def async_setup_platform( 57 | hass: HomeAssistant, 58 | config: ConfigType, 59 | async_add_entities: AddEntitiesCallback, 60 | discovery_info: DiscoveryInfoType | None = None, 61 | ) -> None: 62 | """Set up Vent time sensor.""" 63 | name = config.get(CONF_NAME, DEFAULT_NAME) 64 | indoor_temp_sensor = config.get(CONF_INDOOR_TEMP) 65 | outdoor_temp_sensor = config.get(CONF_OUTDOOR_TEMP) 66 | indoor_humidity_sensor = config.get(CONF_INDOOR_HUMIDITY) 67 | outdoor_humidity_sensor = config.get(CONF_OUTDOOR_HUMIDITY) 68 | max_humidity_allowed = config.get(CONF_MAX_ALLOWED_HUMIDITY) 69 | window_size = config.get(CONF_WINDOW_SIZE) 70 | room_volume = config.get(CONF_ROOM_VOLUME) 71 | 72 | async_add_entities([ 73 | VentTime( 74 | name, 75 | indoor_temp_sensor, 76 | outdoor_temp_sensor, 77 | indoor_humidity_sensor, 78 | outdoor_humidity_sensor, 79 | max_humidity_allowed, 80 | window_size, 81 | room_volume, 82 | )]) 83 | 84 | async def async_setup_entry( 85 | hass: HomeAssistant, 86 | config_entry: ConfigEntry, 87 | async_add_entities: AddEntitiesCallback 88 | ) -> None: 89 | """Set up Vent time sensor through the UI.""" 90 | name = config_entry.data.get(CONF_NAME, DEFAULT_NAME) 91 | indoor_temp_sensor = config_entry.data.get(CONF_INDOOR_TEMP) 92 | outdoor_temp_sensor = config_entry.data.get(CONF_OUTDOOR_TEMP) 93 | indoor_humidity_sensor = config_entry.data.get(CONF_INDOOR_HUMIDITY) 94 | outdoor_humidity_sensor = config_entry.data.get(CONF_OUTDOOR_HUMIDITY) 95 | max_humidity_allowed = config_entry.data.get(CONF_MAX_ALLOWED_HUMIDITY) 96 | window_size = config_entry.data.get(CONF_WINDOW_SIZE) 97 | room_volume = config_entry.data.get(CONF_ROOM_VOLUME) 98 | 99 | async_add_entities([ 100 | VentTime( 101 | name, 102 | indoor_temp_sensor, 103 | outdoor_temp_sensor, 104 | indoor_humidity_sensor, 105 | outdoor_humidity_sensor, 106 | max_humidity_allowed, 107 | window_size, 108 | room_volume, 109 | ) 110 | ]) 111 | 112 | 113 | class VentTime(SensorEntity): 114 | """Represents a Vent time sensor.""" 115 | 116 | _attr_should_poll = False 117 | 118 | def __init__( 119 | self, 120 | name, 121 | indoor_temp_sensor, 122 | outdoor_temp_sensor, 123 | indoor_humidity_sensor, 124 | outdoor_humidity_sensor, 125 | max_humidity_allowed, 126 | window_size, 127 | room_volume, 128 | ): 129 | """Initialize the sensor.""" 130 | self._name = name 131 | self._state = None 132 | self._unique_id = str(name).lower() 133 | 134 | self._indoor_temp_sensor = indoor_temp_sensor 135 | self._indoor_humidity_sensor = indoor_humidity_sensor 136 | self._outdoor_temp_sensor = outdoor_temp_sensor 137 | self._outdoor_humidity_sensor = outdoor_humidity_sensor 138 | self._max_hum_allowed = max_humidity_allowed 139 | self._window_size = window_size 140 | self._room_volume = room_volume 141 | self._available = False 142 | self._entities = { 143 | self._indoor_temp_sensor, 144 | self._indoor_humidity_sensor, 145 | self._outdoor_temp_sensor, 146 | self._outdoor_humidity_sensor, 147 | } 148 | 149 | self._indoor_absolute_humidity = None 150 | self._outdoor_absolute_humidity = None 151 | self._indoor_temp = None 152 | self._outdoor_temp = None 153 | self._indoor_hum = None 154 | self._outdoor_hum = None 155 | 156 | async def async_added_to_hass(self) -> None: 157 | """Register callbacks.""" 158 | 159 | @callback 160 | def vent_time_sensors_state_listener(event): 161 | """Handle for state changes for dependent sensors.""" 162 | new_state = event.data.get("new_state") 163 | old_state = event.data.get("old_state") 164 | entity = event.data.get("entity_id") 165 | _LOGGER.debug( 166 | "Sensor state change for %s that had old state %s and new state %s", 167 | entity, 168 | old_state, 169 | new_state, 170 | ) 171 | 172 | if self._update_sensor(entity, old_state, new_state): 173 | self.async_schedule_update_ha_state(True) 174 | 175 | async_track_state_change_event( 176 | self.hass, list(self._entities), vent_time_sensors_state_listener 177 | ) 178 | 179 | # Read initial state 180 | indoor_temp = self.hass.states.get(self._indoor_temp_sensor) 181 | outdoor_temp = self.hass.states.get(self._outdoor_temp_sensor) 182 | indoor_hum = self.hass.states.get(self._indoor_humidity_sensor) 183 | outdoor_hum = self.hass.states.get(self._outdoor_humidity_sensor) 184 | 185 | schedule_update = self._update_sensor( 186 | self._indoor_temp_sensor, None, indoor_temp 187 | ) 188 | 189 | schedule_update = ( 190 | False 191 | if not self._update_sensor( 192 | self._outdoor_temp_sensor, None, outdoor_temp 193 | ) 194 | else schedule_update 195 | ) 196 | 197 | schedule_update = ( 198 | False 199 | if not self._update_sensor( 200 | self._indoor_humidity_sensor, None, indoor_hum 201 | ) 202 | else schedule_update 203 | ) 204 | 205 | schedule_update = ( 206 | False 207 | if not self._update_sensor( 208 | self._outdoor_humidity_sensor, None, outdoor_hum 209 | ) 210 | else schedule_update 211 | ) 212 | 213 | if schedule_update: 214 | self.async_schedule_update_ha_state(True) 215 | 216 | def _update_sensor(self, entity, old_state, new_state): 217 | """Update information based on new sensor states.""" 218 | _LOGGER.debug("Sensor update for %s", entity) 219 | if new_state is None: 220 | return False 221 | 222 | # If old_state is not set and new state is unknown then it means 223 | # that the sensor just started up 224 | if old_state is None and new_state.state == STATE_UNKNOWN: 225 | return False 226 | 227 | if entity == self._indoor_temp_sensor: 228 | self._indoor_temp = VentTime._update_temp_sensor(new_state) 229 | if entity == self._outdoor_temp_sensor: 230 | self._outdoor_temp = VentTime._update_temp_sensor(new_state) 231 | if entity == self._indoor_humidity_sensor: 232 | self._indoor_hum = VentTime._update_hum_sensor(new_state) 233 | if entity == self._outdoor_humidity_sensor: 234 | self._outdoor_hum = VentTime._update_hum_sensor(new_state) 235 | 236 | return True 237 | 238 | @staticmethod 239 | def _update_temp_sensor(state): 240 | """Parse temperature sensor value.""" 241 | _LOGGER.debug("Updating temp sensor with value %s", state.state) 242 | 243 | # Return an error if the sensor change its state to Unknown. 244 | if state.state == STATE_UNKNOWN: 245 | _LOGGER.debug( 246 | "Unable to parse temperature sensor %s with state: %s", 247 | state.entity_id, 248 | state.state, 249 | ) 250 | return None 251 | 252 | unit = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) 253 | 254 | if (temp := util.convert(state.state, float)) is None: 255 | _LOGGER.debug( 256 | "Unable to parse temperature sensor %s with state: %s", 257 | state.entity_id, 258 | state.state, 259 | ) 260 | return None 261 | 262 | # convert to celsius if necessary 263 | if unit == UnitOfTemperature.FAHRENHEIT: 264 | return TemperatureConverter.convert( 265 | temp, UnitOfTemperature.FAHRENHEIT, UnitOfTemperature.CELSIUS 266 | ) 267 | if unit == UnitOfTemperature.CELSIUS: 268 | return temp 269 | _LOGGER.error( 270 | "Temp sensor %s has unsupported unit: %s (allowed: %s, %s)", 271 | state.entity_id, 272 | unit, 273 | UnitOfTemperature.CELSIUS, 274 | UnitOfTemperature.FAHRENHEIT, 275 | ) 276 | 277 | return None 278 | 279 | @staticmethod 280 | def _update_hum_sensor(state): 281 | """Parse humidity sensor value.""" 282 | _LOGGER.debug("Updating humidity sensor with value %s", state.state) 283 | 284 | # Return an error if the sensor change its state to Unknown. 285 | if state.state == STATE_UNKNOWN: 286 | _LOGGER.debug( 287 | "Unable to parse humidity sensor %s, state: %s", 288 | state.entity_id, 289 | state.state, 290 | ) 291 | return None 292 | 293 | if (hum := util.convert(state.state, float)) is None: 294 | _LOGGER.debug( 295 | "Unable to parse humidity sensor %s, state: %s", 296 | state.entity_id, 297 | state.state, 298 | ) 299 | return None 300 | 301 | if (unit := state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)) != PERCENTAGE: 302 | _LOGGER.error( 303 | "Humidity sensor %s has unsupported unit: %s %s", 304 | state.entity_id, 305 | unit, 306 | " (allowed: %)", 307 | ) 308 | return None 309 | 310 | if hum > 100 or hum < 0: 311 | _LOGGER.error( 312 | "Humidity sensor %s is out of range: %s %s", 313 | state.entity_id, 314 | hum, 315 | "(allowed: 0-100%)", 316 | ) 317 | return None 318 | 319 | return hum 320 | 321 | async def async_update(self) -> None: 322 | """Calculate latest state.""" 323 | _LOGGER.debug("Update state for %s", self.entity_id) 324 | # check all sensors 325 | if None in (self._indoor_temp, self._indoor_hum, self._outdoor_temp, self._outdoor_hum): 326 | self._available = False 327 | self._outdoor_absolute_humidity = None 328 | self._indoor_absolute_humidity = None 329 | return 330 | 331 | # re-calculate e_s and vent time 332 | self._calc_indoor_absolute_humidity() 333 | self._calc_outdoor_absolute_humidity() 334 | self._calc_time_to_vent() 335 | if self._state is None: 336 | self._available = False 337 | self._outdoor_absolute_humidity = None 338 | self._indoor_absolute_humidity = None 339 | else: 340 | self._available = True 341 | 342 | def _calc_e_s(self, temp): 343 | """Calculate the maximum possible absolute humidity for the indoor temperature""" 344 | # According to https://journals.ametsoc.org/view/journals/bams/86/2/bams-86-2-225.xml?tab_body=pdf Equation 6 p.226 345 | C_1 = 610.94 # Kp 346 | A_1 = 17.625 347 | B_1 = 243.04 # °C 348 | return C_1*math.exp((A_1*temp)/(B_1+temp)) 349 | 350 | def _calc_indoor_absolute_humidity(self): 351 | self._indoor_absolute_humidity = (self._indoor_hum/100)*self._calc_e_s(self._indoor_temp) 352 | _LOGGER.debug("Indoor absolute humidity: %f", self._indoor_absolute_humidity) 353 | 354 | def _calc_outdoor_absolute_humidity(self): 355 | self._outdoor_absolute_humidity = (self._outdoor_hum/100)*self._calc_e_s(self._outdoor_temp) 356 | _LOGGER.debug("Outdoor absolute humidity: %f", self._outdoor_absolute_humidity) 357 | 358 | def _humidity_model(self, time): 359 | return (self._indoor_absolute_humidity - self._outdoor_absolute_humidity)/((time+1)**((k_1*self._window_size)/(k_2*self._room_volume))) + self._outdoor_absolute_humidity 360 | 361 | def _temperature_model(self, time): 362 | return (self._indoor_temp - self._outdoor_temp)/((time+1)**((k_3*self._window_size)/(k_4*self._room_volume))) + self._outdoor_temp 363 | 364 | def _calc_time_to_vent(self): 365 | """Calculate the time until the humidity is under max_allowed_hum""" 366 | 367 | if self._indoor_absolute_humidity <= self._outdoor_absolute_humidity: 368 | _LOGGER.debug("Venting has no point, the outside is to humid") 369 | self._state = 0 370 | else: 371 | # One could use a binary search here, but it is unecessary 372 | for i in range(301): 373 | if (self._humidity_model(i)/self._calc_e_s(self._temperature_model(i)))*100 <= self._max_hum_allowed: 374 | self._state = i 375 | break 376 | else: 377 | self._state = 300 378 | _LOGGER.debug("Venting would take longer than 5h") 379 | 380 | 381 | _LOGGER.debug("You have to vent %s minutes", self._state) 382 | 383 | @property 384 | def name(self): 385 | """Return the name.""" 386 | return self._name 387 | 388 | @property 389 | def unique_id(self) -> str: 390 | return self._unique_id 391 | 392 | @property 393 | def native_unit_of_measurement(self): 394 | """Return the unit of measurement.""" 395 | return UnitOfTime.MINUTES 396 | 397 | @property 398 | def native_value(self): 399 | """Return the state of the entity.""" 400 | return self._state 401 | 402 | @property 403 | def available(self): 404 | """Return the availability of this sensor.""" 405 | return self._available 406 | 407 | @property 408 | def extra_state_attributes(self): 409 | """Return the state attributes.""" 410 | return { 411 | ATTR_INDOOR_ABSOLUTE_HUMIDITY: round(self._indoor_absolute_humidity, 2), 412 | ATTR_OUTDOOR_ABSOLUTE_HUMIDITY: round(self._outdoor_absolute_humidity, 2) 413 | } 414 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ---> Python 2 | # Byte-compiled / optimized / DLL files 3 | __pycache__/ 4 | *.py[cod] 5 | *$py.class 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | cover/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3 63 | db.sqlite3-journal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | .pybuilder/ 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | # For a library or package, you might want to ignore these files since the code is 88 | # intended to run in multiple environments; otherwise, check them in: 89 | # .python-version 90 | 91 | # pipenv 92 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 93 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 94 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 95 | # install all needed dependencies. 96 | #Pipfile.lock 97 | 98 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 99 | __pypackages__/ 100 | 101 | # Celery stuff 102 | celerybeat-schedule 103 | celerybeat.pid 104 | 105 | # SageMath parsed files 106 | *.sage.py 107 | 108 | # Environments 109 | .env 110 | .venv 111 | env/ 112 | venv/ 113 | ENV/ 114 | env.bak/ 115 | venv.bak/ 116 | 117 | # Spyder project settings 118 | .spyderproject 119 | .spyproject 120 | 121 | # Rope project settings 122 | .ropeproject 123 | 124 | # mkdocs documentation 125 | /site 126 | 127 | # mypy 128 | .mypy_cache/ 129 | .dmypy.json 130 | dmypy.json 131 | 132 | # Pyre type checker 133 | .pyre/ 134 | 135 | # pytype static type analyzer 136 | .pytype/ 137 | 138 | # Cython debug symbols 139 | cython_debug/ 140 | 141 | # ---> TeX 142 | ## Core latex/pdflatex auxiliary files: 143 | *.aux 144 | *.lof 145 | *.log 146 | *.lot 147 | *.fls 148 | *.out 149 | *.toc 150 | *.fmt 151 | *.fot 152 | *.cb 153 | *.cb2 154 | .*.lb 155 | 156 | ## Intermediate documents: 157 | *.dvi 158 | *.xdv 159 | *-converted-to.* 160 | # these rules might exclude image files for figures etc. 161 | # *.ps 162 | # *.eps 163 | *.pdf 164 | 165 | ## Generated if empty string is given at "Please type another file name for output:" 166 | .pdf 167 | 168 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 169 | *.bbl 170 | *.bcf 171 | *.blg 172 | *-blx.aux 173 | *-blx.bib 174 | *.run.xml 175 | 176 | ## Build tool auxiliary files: 177 | *.fdb_latexmk 178 | *.synctex 179 | *.synctex(busy) 180 | *.synctex.gz 181 | *.synctex.gz(busy) 182 | *.pdfsync 183 | 184 | ## Build tool directories for auxiliary files 185 | # latexrun 186 | latex.out/ 187 | 188 | ## Auxiliary and intermediate files from other packages: 189 | # algorithms 190 | *.alg 191 | *.loa 192 | 193 | # achemso 194 | acs-*.bib 195 | 196 | # amsthm 197 | *.thm 198 | 199 | # beamer 200 | *.nav 201 | *.pre 202 | *.snm 203 | *.vrb 204 | 205 | # changes 206 | *.soc 207 | 208 | # comment 209 | *.cut 210 | 211 | # cprotect 212 | *.cpt 213 | 214 | # elsarticle (documentclass of Elsevier journals) 215 | *.spl 216 | 217 | # endnotes 218 | *.ent 219 | 220 | # fixme 221 | *.lox 222 | 223 | # feynmf/feynmp 224 | *.mf 225 | *.mp 226 | *.t[1-9] 227 | *.t[1-9][0-9] 228 | *.tfm 229 | 230 | #(r)(e)ledmac/(r)(e)ledpar 231 | *.end 232 | *.?end 233 | *.[1-9] 234 | *.[1-9][0-9] 235 | *.[1-9][0-9][0-9] 236 | *.[1-9]R 237 | *.[1-9][0-9]R 238 | *.[1-9][0-9][0-9]R 239 | *.eledsec[1-9] 240 | *.eledsec[1-9]R 241 | *.eledsec[1-9][0-9] 242 | *.eledsec[1-9][0-9]R 243 | *.eledsec[1-9][0-9][0-9] 244 | *.eledsec[1-9][0-9][0-9]R 245 | 246 | # glossaries 247 | *.acn 248 | *.acr 249 | *.glg 250 | *.glo 251 | *.gls 252 | *.glsdefs 253 | *.lzo 254 | *.lzs 255 | 256 | # uncomment this for glossaries-extra (will ignore makeindex's style files!) 257 | # *.ist 258 | 259 | # gnuplottex 260 | *-gnuplottex-* 261 | 262 | # gregoriotex 263 | *.gaux 264 | *.glog 265 | *.gtex 266 | 267 | # htlatex 268 | *.4ct 269 | *.4tc 270 | *.idv 271 | *.lg 272 | *.trc 273 | *.xref 274 | 275 | # hyperref 276 | *.brf 277 | 278 | # knitr 279 | *-concordance.tex 280 | # TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files 281 | # *.tikz 282 | *-tikzDictionary 283 | 284 | # listings 285 | *.lol 286 | 287 | # luatexja-ruby 288 | *.ltjruby 289 | 290 | # makeidx 291 | *.idx 292 | *.ilg 293 | *.ind 294 | 295 | # minitoc 296 | *.maf 297 | *.mlf 298 | *.mlt 299 | *.mtc[0-9]* 300 | *.slf[0-9]* 301 | *.slt[0-9]* 302 | *.stc[0-9]* 303 | 304 | # minted 305 | _minted* 306 | *.pyg 307 | 308 | # morewrites 309 | *.mw 310 | 311 | # newpax 312 | *.newpax 313 | 314 | # nomencl 315 | *.nlg 316 | *.nlo 317 | *.nls 318 | 319 | # pax 320 | *.pax 321 | 322 | # pdfpcnotes 323 | *.pdfpc 324 | 325 | # sagetex 326 | *.sagetex.sage 327 | *.sagetex.py 328 | *.sagetex.scmd 329 | 330 | # scrwfile 331 | *.wrt 332 | 333 | # sympy 334 | *.sout 335 | *.sympy 336 | sympy-plots-for-*.tex/ 337 | 338 | # pdfcomment 339 | *.upa 340 | *.upb 341 | 342 | # pythontex 343 | *.pytxcode 344 | pythontex-files-*/ 345 | 346 | # tcolorbox 347 | *.listing 348 | 349 | # thmtools 350 | *.loe 351 | 352 | # TikZ & PGF 353 | *.dpth 354 | *.md5 355 | *.auxlock 356 | 357 | # todonotes 358 | *.tdo 359 | 360 | # vhistory 361 | *.hst 362 | *.ver 363 | 364 | # easy-todo 365 | *.lod 366 | 367 | # xcolor 368 | *.xcp 369 | 370 | # xmpincl 371 | *.xmpi 372 | 373 | # xindy 374 | *.xdy 375 | 376 | # xypic precompiled matrices and outlines 377 | *.xyc 378 | *.xyd 379 | 380 | # endfloat 381 | *.ttt 382 | *.fff 383 | 384 | # Latexian 385 | TSWLatexianTemp* 386 | 387 | ## Editors: 388 | # WinEdt 389 | *.bak 390 | *.sav 391 | 392 | # Texpad 393 | .texpadtmp 394 | 395 | # LyX 396 | *.lyx~ 397 | 398 | # Kile 399 | *.backup 400 | 401 | # gummi 402 | .*.swp 403 | 404 | # KBibTeX 405 | *~[0-9]* 406 | 407 | # TeXnicCenter 408 | *.tps 409 | 410 | # auto folder when using emacs and auctex 411 | ./auto/* 412 | *.el 413 | 414 | # expex forward references with \gathertags 415 | *-tags.tex 416 | 417 | # standalone packages 418 | *.sta 419 | 420 | # Makeindex log files 421 | *.lpz 422 | 423 | # xwatermark package 424 | *.xwm 425 | 426 | # REVTeX puts footnotes in the bibliography by default, unless the nofootinbib 427 | # option is specified. Footnotes are the stored in a file with suffix Notes.bib. 428 | # Uncomment the next line to have this generated file ignored. 429 | #*Notes.bib 430 | 431 | # ---> JupyterNotebooks 432 | # gitignore template for Jupyter Notebooks 433 | # website: http://jupyter.org/ 434 | 435 | .ipynb_checkpoints 436 | */.ipynb_checkpoints/* 437 | 438 | # IPython 439 | profile_default/ 440 | ipython_config.py 441 | 442 | # Remove previous ipynb_checkpoints 443 | # git rm -r .ipynb_checkpoints/ 444 | 445 | # ---> VisualStudioCode 446 | .vscode/* 447 | !.vscode/settings.json 448 | !.vscode/tasks.json 449 | !.vscode/launch.json 450 | !.vscode/extensions.json 451 | !.vscode/*.code-snippets 452 | 453 | # Local History for Visual Studio Code 454 | .history/ 455 | 456 | # Built Visual Studio Code Extensions 457 | *.vsix 458 | 459 | # ---> VisualStudio 460 | ## Ignore Visual Studio temporary files, build results, and 461 | ## files generated by popular Visual Studio add-ons. 462 | ## 463 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore 464 | 465 | # User-specific files 466 | *.rsuser 467 | *.suo 468 | *.user 469 | *.userosscache 470 | *.sln.docstates 471 | 472 | # User-specific files (MonoDevelop/Xamarin Studio) 473 | *.userprefs 474 | 475 | # Mono auto generated files 476 | mono_crash.* 477 | 478 | # Build results 479 | [Dd]ebug/ 480 | [Dd]ebugPublic/ 481 | [Rr]elease/ 482 | [Rr]eleases/ 483 | x64/ 484 | x86/ 485 | [Ww][Ii][Nn]32/ 486 | [Aa][Rr][Mm]/ 487 | [Aa][Rr][Mm]64/ 488 | bld/ 489 | [Bb]in/ 490 | [Oo]bj/ 491 | [Ll]og/ 492 | [Ll]ogs/ 493 | 494 | # Visual Studio 2015/2017 cache/options directory 495 | .vs/ 496 | # Uncomment if you have tasks that create the project's static files in wwwroot 497 | #wwwroot/ 498 | 499 | # Visual Studio 2017 auto generated files 500 | Generated\ Files/ 501 | 502 | # MSTest test Results 503 | [Tt]est[Rr]esult*/ 504 | [Bb]uild[Ll]og.* 505 | 506 | # NUnit 507 | *.VisualState.xml 508 | TestResult.xml 509 | nunit-*.xml 510 | 511 | # Build Results of an ATL Project 512 | [Dd]ebugPS/ 513 | [Rr]eleasePS/ 514 | dlldata.c 515 | 516 | # Benchmark Results 517 | BenchmarkDotNet.Artifacts/ 518 | 519 | # .NET Core 520 | project.lock.json 521 | project.fragment.lock.json 522 | artifacts/ 523 | 524 | # ASP.NET Scaffolding 525 | ScaffoldingReadMe.txt 526 | 527 | # StyleCop 528 | StyleCopReport.xml 529 | 530 | # Files built by Visual Studio 531 | *_i.c 532 | *_p.c 533 | *_h.h 534 | *.ilk 535 | *.meta 536 | *.obj 537 | *.iobj 538 | *.pch 539 | *.pdb 540 | *.ipdb 541 | *.pgc 542 | *.pgd 543 | *.rsp 544 | *.sbr 545 | *.tlb 546 | *.tli 547 | *.tlh 548 | *.tmp 549 | *.tmp_proj 550 | *_wpftmp.csproj 551 | *.log 552 | *.tlog 553 | *.vspscc 554 | *.vssscc 555 | .builds 556 | *.pidb 557 | *.svclog 558 | *.scc 559 | 560 | # Chutzpah Test files 561 | _Chutzpah* 562 | 563 | # Visual C++ cache files 564 | ipch/ 565 | *.aps 566 | *.ncb 567 | *.opendb 568 | *.opensdf 569 | *.sdf 570 | *.cachefile 571 | *.VC.db 572 | *.VC.VC.opendb 573 | 574 | # Visual Studio profiler 575 | *.psess 576 | *.vsp 577 | *.vspx 578 | *.sap 579 | 580 | # Visual Studio Trace Files 581 | *.e2e 582 | 583 | # TFS 2012 Local Workspace 584 | $tf/ 585 | 586 | # Guidance Automation Toolkit 587 | *.gpState 588 | 589 | # ReSharper is a .NET coding add-in 590 | _ReSharper*/ 591 | *.[Rr]e[Ss]harper 592 | *.DotSettings.user 593 | 594 | # TeamCity is a build add-in 595 | _TeamCity* 596 | 597 | # DotCover is a Code Coverage Tool 598 | *.dotCover 599 | 600 | # AxoCover is a Code Coverage Tool 601 | .axoCover/* 602 | !.axoCover/settings.json 603 | 604 | # Coverlet is a free, cross platform Code Coverage Tool 605 | coverage*.json 606 | coverage*.xml 607 | coverage*.info 608 | 609 | # Visual Studio code coverage results 610 | *.coverage 611 | *.coveragexml 612 | 613 | # NCrunch 614 | _NCrunch_* 615 | .*crunch*.local.xml 616 | nCrunchTemp_* 617 | 618 | # MightyMoose 619 | *.mm.* 620 | AutoTest.Net/ 621 | 622 | # Web workbench (sass) 623 | .sass-cache/ 624 | 625 | # Installshield output folder 626 | [Ee]xpress/ 627 | 628 | # DocProject is a documentation generator add-in 629 | DocProject/buildhelp/ 630 | DocProject/Help/*.HxT 631 | DocProject/Help/*.HxC 632 | DocProject/Help/*.hhc 633 | DocProject/Help/*.hhk 634 | DocProject/Help/*.hhp 635 | DocProject/Help/Html2 636 | DocProject/Help/html 637 | 638 | # Click-Once directory 639 | publish/ 640 | 641 | # Publish Web Output 642 | *.[Pp]ublish.xml 643 | *.azurePubxml 644 | # Note: Comment the next line if you want to checkin your web deploy settings, 645 | # but database connection strings (with potential passwords) will be unencrypted 646 | *.pubxml 647 | *.publishproj 648 | 649 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 650 | # checkin your Azure Web App publish settings, but sensitive information contained 651 | # in these scripts will be unencrypted 652 | PublishScripts/ 653 | 654 | # NuGet Packages 655 | *.nupkg 656 | # NuGet Symbol Packages 657 | *.snupkg 658 | # The packages folder can be ignored because of Package Restore 659 | **/[Pp]ackages/* 660 | # except build/, which is used as an MSBuild target. 661 | !**/[Pp]ackages/build/ 662 | # Uncomment if necessary however generally it will be regenerated when needed 663 | #!**/[Pp]ackages/repositories.config 664 | # NuGet v3's project.json files produces more ignorable files 665 | *.nuget.props 666 | *.nuget.targets 667 | 668 | # Microsoft Azure Build Output 669 | csx/ 670 | *.build.csdef 671 | 672 | # Microsoft Azure Emulator 673 | ecf/ 674 | rcf/ 675 | 676 | # Windows Store app package directories and files 677 | AppPackages/ 678 | BundleArtifacts/ 679 | Package.StoreAssociation.xml 680 | _pkginfo.txt 681 | *.appx 682 | *.appxbundle 683 | *.appxupload 684 | 685 | # Visual Studio cache files 686 | # files ending in .cache can be ignored 687 | *.[Cc]ache 688 | # but keep track of directories ending in .cache 689 | !?*.[Cc]ache/ 690 | 691 | # Others 692 | ClientBin/ 693 | ~$* 694 | *~ 695 | *.dbmdl 696 | *.dbproj.schemaview 697 | *.jfm 698 | *.pfx 699 | *.publishsettings 700 | orleans.codegen.cs 701 | 702 | # Including strong name files can present a security risk 703 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 704 | #*.snk 705 | 706 | # Since there are multiple workflows, uncomment next line to ignore bower_components 707 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 708 | #bower_components/ 709 | 710 | # RIA/Silverlight projects 711 | Generated_Code/ 712 | 713 | # Backup & report files from converting an old project file 714 | # to a newer Visual Studio version. Backup files are not needed, 715 | # because we have git ;-) 716 | _UpgradeReport_Files/ 717 | Backup*/ 718 | UpgradeLog*.XML 719 | UpgradeLog*.htm 720 | ServiceFabricBackup/ 721 | *.rptproj.bak 722 | 723 | # SQL Server files 724 | *.mdf 725 | *.ldf 726 | *.ndf 727 | 728 | # Business Intelligence projects 729 | *.rdl.data 730 | *.bim.layout 731 | *.bim_*.settings 732 | *.rptproj.rsuser 733 | *- [Bb]ackup.rdl 734 | *- [Bb]ackup ([0-9]).rdl 735 | *- [Bb]ackup ([0-9][0-9]).rdl 736 | 737 | # Microsoft Fakes 738 | FakesAssemblies/ 739 | 740 | # GhostDoc plugin setting file 741 | *.GhostDoc.xml 742 | 743 | # Node.js Tools for Visual Studio 744 | .ntvs_analysis.dat 745 | node_modules/ 746 | 747 | # Visual Studio 6 build log 748 | *.plg 749 | 750 | # Visual Studio 6 workspace options file 751 | *.opt 752 | 753 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 754 | *.vbw 755 | 756 | # Visual Studio 6 auto-generated project file (contains which files were open etc.) 757 | *.vbp 758 | 759 | # Visual Studio 6 workspace and project file (working project files containing files to include in project) 760 | *.dsw 761 | *.dsp 762 | 763 | # Visual Studio 6 technical files 764 | *.ncb 765 | *.aps 766 | 767 | # Visual Studio LightSwitch build output 768 | **/*.HTMLClient/GeneratedArtifacts 769 | **/*.DesktopClient/GeneratedArtifacts 770 | **/*.DesktopClient/ModelManifest.xml 771 | **/*.Server/GeneratedArtifacts 772 | **/*.Server/ModelManifest.xml 773 | _Pvt_Extensions 774 | 775 | # Paket dependency manager 776 | .paket/paket.exe 777 | paket-files/ 778 | 779 | # FAKE - F# Make 780 | .fake/ 781 | 782 | # CodeRush personal settings 783 | .cr/personal 784 | 785 | # Python Tools for Visual Studio (PTVS) 786 | __pycache__/ 787 | *.pyc 788 | 789 | # Cake - Uncomment if you are using it 790 | # tools/** 791 | # !tools/packages.config 792 | 793 | # Tabs Studio 794 | *.tss 795 | 796 | # Telerik's JustMock configuration file 797 | *.jmconfig 798 | 799 | # BizTalk build output 800 | *.btp.cs 801 | *.btm.cs 802 | *.odx.cs 803 | *.xsd.cs 804 | 805 | # OpenCover UI analysis results 806 | OpenCover/ 807 | 808 | # Azure Stream Analytics local run output 809 | ASALocalRun/ 810 | 811 | # MSBuild Binary and Structured Log 812 | *.binlog 813 | 814 | # NVidia Nsight GPU debugger configuration file 815 | *.nvuser 816 | 817 | # MFractors (Xamarin productivity tool) working folder 818 | .mfractor/ 819 | 820 | # Local History for Visual Studio 821 | .localhistory/ 822 | 823 | # Visual Studio History (VSHistory) files 824 | .vshistory/ 825 | 826 | # BeatPulse healthcheck temp database 827 | healthchecksdb 828 | 829 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 830 | MigrationBackup/ 831 | 832 | # Ionide (cross platform F# VS Code tools) working folder 833 | .ionide/ 834 | 835 | # Fody - auto-generated XML schema 836 | FodyWeavers.xsd 837 | 838 | # VS Code files for those working on multiple tools 839 | .vscode/* 840 | !.vscode/settings.json 841 | !.vscode/tasks.json 842 | !.vscode/launch.json 843 | !.vscode/extensions.json 844 | *.code-workspace 845 | 846 | # Local History for Visual Studio Code 847 | .history/ 848 | 849 | # Windows Installer files from build outputs 850 | *.cab 851 | *.msi 852 | *.msix 853 | *.msm 854 | *.msp 855 | 856 | # JetBrains Rider 857 | *.sln.iml 858 | --------------------------------------------------------------------------------