Skip to content

Commit

Permalink
fix: remembers heating mode
Browse files Browse the repository at this point in the history
- adds off, cool heat, heat_cool hvac modes
- remembers last hvac_mode after restart (only if initial_hvac_mode is not set)
- no platfrom setup error on startup

Fixes #8
Fixes #7
Fixes #5
  • Loading branch information
= committed May 13, 2022
1 parent ec7d0d6 commit c63d162
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 142 deletions.
6 changes: 3 additions & 3 deletions .devcontainer/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ climate:
seconds: 5
keep_alive:
minutes: 3
initial_hvac_mode: "off"
# initial_hvac_mode: "off"
away_temp: 16
precision: 0.1

Expand All @@ -144,7 +144,7 @@ climate:
seconds: 5
keep_alive:
minutes: 3
initial_hvac_mode: "off"
# initial_hvac_mode: "off"
away_temp: 16
precision: 0.1

Expand All @@ -153,4 +153,4 @@ logger:
logs:
custom_components.dual_smart_thermostat: debug

debugpy:
# debugpy:
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Dual Smart Thermostat Component",
"image": "ghcr.io/ludeeus/devcontainer/integration:stable",
"postCreateCommand": "container install",
"postCreateCommand": "container install && sudo apt-get install libpcap-dev ",
"context": "..",
"appPort": [
"9123:8123"
Expand Down
60 changes: 31 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,98 +37,100 @@ climate:
### name
    _(required) (string)_ Name of thermostat
_(required) (string)_ Name of thermostat
    _default: Dual Smart_
_default: Dual Smart_
### heater
    _(required) (string)_ "`entity_id` for heater switch, must be a toggle device. Becomes air conditioning switch when `ac_mode` is set to `true`"
_(required) (string)_ "`entity_id` for heater switch, must be a toggle device. Becomes air conditioning switch when `ac_mode` is set to `true`"

### cooler

    _(optional) (string)_ "`entity_id` for cooler switch, must be a toggle device."
_(optional) (string)_ "`entity_id` for cooler switch, must be a toggle device."

### target_sensor

    _(required) (string)_ "`entity_id` for a temperature sensor, target_sensor.state must be temperature."
_(required) (string)_ "`entity_id` for a temperature sensor, target_sensor.state must be temperature."

### floor_sensor

    _(optional) (string)_ "`entity_id` for the foor temperature sensor, floor_sensor.state must be temperature."
_(optional) (string)_ "`entity_id` for the foor temperature sensor, floor_sensor.state must be temperature."

### openings
    _(optional) (list)_ "list of opening `entity_id`'s for detecting open widows or doors that will idle the termostat until any of them are open"
_(optional) (list)_ "list of opening `entity_id`'s for detecting open widows or doors that will idle the termostat until any of them are open"

### min_temp

    _(optional) (float)_
_(optional) (float)_

    _default: 7_
_default: 7_

### max_temp

    _(optional) (float)_
_(optional) (float)_

    _default: 35_
_default: 35_

### max_floor_temp

    _(optional) (float)_
_(optional) (float)_

    _default: 28_
_default: 28_

### target_temp

    _(optional) (float)_ Set initial target temperature. Failure to set this variable will result in target temperature being set to null on startup.
_(optional) (float)_ Set initial target temperature. Failure to set this variable will result in target temperature being set to null on startup.

### target_temp_low

    _(optional) (float)_ Set initial target low temperature. Failure to set this variable will result in target temperature being set to null on startup.
_(optional) (float)_ Set initial target low temperature. Failure to set this variable will result in target temperature being set to null on startup.

### target_temp_high

    _(optional) (float)_ Set initial target high temperature. Failure to set this variable will result in target temperature being set to null on startup.
_(optional) (float)_ Set initial target high temperature. Failure to set this variable will result in target temperature being set to null on startup.

### ac_mode

    _(optional) (boolean)_ Set the switch specified in the *heater* option to be treated as a cooling device instead of a heating device.
_(optional) (boolean)_ Set the switch specified in the *heater* option to be treated as a cooling device instead of a heating device.

    _default: false_
_default: false_

### min_cycle_duration

    _(optional) (time, integer)_ Set a minimum amount of time that the switch specified in the *heater* and/or *cooler* option must be in its current state prior to being switched either off or on.
_(optional) (time, integer)_ Set a minimum amount of time that the switch specified in the *heater* and/or *cooler* option must be in its current state prior to being switched either off or on.

### cold_tolerance

    _(optional) (float)_ Set a minimum amount of difference between the temperature read by the sensor specified in the *target_sensor* option and the target temperature that must change prior to being switched on. For example, if the target temperature is 25 and the tolerance is 0.5 the heater will start when the sensor equals or goes below 24.5.
_(optional) (float)_ Set a minimum amount of difference between the temperature read by the sensor specified in the *target_sensor* option and the target temperature that must change prior to being switched on. For example, if the target temperature is 25 and the tolerance is 0.5 the heater will start when the sensor equals or goes below 24.5.

    _default: 0.3_
_default: 0.3_

### hot_tolerance

    _(optional) (float)_ Set a minimum amount of difference between the temperature read by the sensor specified in the *target_sensor* option and the target temperature that must change prior to being switched off. For example, if the target temperature is 25 and the tolerance is 0.5 the heater will stop when the sensor equals or goes above 25.5.
_(optional) (float)_ Set a minimum amount of difference between the temperature read by the sensor specified in the *target_sensor* option and the target temperature that must change prior to being switched off. For example, if the target temperature is 25 and the tolerance is 0.5 the heater will stop when the sensor equals or goes above 25.5.

    _default: 0.3_
_default: 0.3_

### keep_alive

    _(optional) (time, integer)_ Set a keep-alive interval. If set, the switch specified in the *heater* and/or *cooler* option will be triggered every time the interval elapses. Use with heaters and A/C units that shut off if they don't receive a signal from their remote for a while. Use also with switches that might lose state. The keep-alive call is done with the current valid climate integration state (either on or off).
_(optional) (time, integer)_ Set a keep-alive interval. If set, the switch specified in the *heater* and/or *cooler* option will be triggered every time the interval elapses. Use with heaters and A/C units that shut off if they don't receive a signal from their remote for a while. Use also with switches that might lose state. The keep-alive call is done with the current valid climate integration state (either on or off).

### initial_hvac_mode

    _(optional) (string)_ Set the initial HVAC mode. Valid values are `off`, `heat`, `cool` or `heat_cool`. Value has to be double quoted. If this parameter is not set, it is preferable to set a *keep_alive* value. This is helpful to align any discrepancies between *dual_smart_thermostat* *heater* and *cooler* state.
_(optional) (string)_ Set the initial HVAC mode. Valid values are `off`, `heat`, `cool` or `heat_cool`. Value has to be double quoted. If this parameter is not set, it is preferable to set a *keep_alive* value. This is helpful to align any discrepancies between *dual_smart_thermostat* *heater* and *cooler* state.

**NOTE! If this is set, the saved state will not be restored after HA retstarts.**

### away_temp

    _(optional) (float)_ "Set the temperature used by `preset_mode: away`. If this is not specified, the preset mode feature will not be available."
_(optional) (float)_ "Set the temperature used by `preset_mode: away`. If this is not specified, the preset mode feature will not be available."

### precision

    _(optional) (float)_ "The desired precision for this device. Can be used to match your actual thermostat's precision. Supported values are `0.1`, `0.5` and `1.0`."
_(optional) (float)_ "The desired precision for this device. Can be used to match your actual thermostat's precision. Supported values are `0.1`, `0.5` and `1.0`."

    _default: "`0.5` for Celsius and `1.0` for Fahrenheit."_
_default: "`0.5` for Celsius and `1.0` for Fahrenheit."_

## Installation

Expand Down Expand Up @@ -160,7 +162,7 @@ climate:
seconds: 5
keep_alive:
minutes: 3
initial_hvac_mode: "off"
initial_hvac_mode: "off" # hvac mode vill reset to this value after restart
away_temp: 16
precision: 0.1
```
Expand Down
4 changes: 3 additions & 1 deletion custom_components/dual_smart_thermostat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""The dual_smart_thermostat component."""

from homeassistant.const import Platform

DOMAIN = "dual_smart_thermostat"
PLATFORMS = ["climate"]
PLATFORMS = [Platform.CLIMATE]
Loading

0 comments on commit c63d162

Please sign in to comment.