Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniu committed Sep 23, 2019
1 parent 36d2b5d commit fe38c49
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ You can install this script via [HACS](https://custom-components.github.io/hacs/
Go to [HA community](https://community.home-assistant.io/t/update-current-temperature-for-z-wave-thermostats/32834) for support and help.

## Configuration example
```yaml- id: update_thermostats
```yaml
- id: update_thermostats
alias: 'Update Thermostats'
trigger:
platform: state
Expand All @@ -38,7 +39,7 @@ Go to [HA community](https://community.home-assistant.io/t/update-current-temper
action:
service: python_script.thermostat_update
data_template:
heat_stat: 'auto'
heat_state: 'auto'
idle_state: 'idle'
idle_heat_temp: 10
thermostat: >-
Expand All @@ -54,6 +55,26 @@ Go to [HA community](https://community.home-assistant.io/t/update-current-temper
sensor.temperature_{{ (trigger.entity_id | replace('climate.thermostat_', '')) }}
{% endif %}
```
## Configuration example for state only update
```yaml
- id: update_thermostats
alias: 'Update Thermostats'
trigger:
platform: state
entity_id:
- climate.thermostat_kitchen
- climate.thermostat_bedroom
- climate.thermostat_bathroom
action:
service: python_script.thermostat_update
data_template:
heat_state: 'auto'
idle_state: 'idle'
idle_heat_temp: 10
thermostat: '{{ trigger.entity_id }}'
```
## Script arguments
key | optional | type | default | description
-- | -- | -- | -- | --
Expand Down
22 changes: 21 additions & 1 deletion info.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
action:
service: python_script.thermostat_update
data_template:
heat_stat: 'auto'
heat_state: 'auto'
idle_state: 'idle'
idle_heat_temp: 10
thermostat: >-
Expand All @@ -40,6 +40,26 @@
sensor.temperature_{{ (trigger.entity_id | replace('climate.thermostat_', '')) }}
{% endif %}
```
## Configuration example for state only update
```yaml
- id: update_thermostats
alias: 'Update Thermostats'
trigger:
platform: state
entity_id:
- climate.thermostat_kitchen
- climate.thermostat_bedroom
- climate.thermostat_bathroom
action:
service: python_script.thermostat_update
data_template:
heat_state: 'auto'
idle_state: 'idle'
idle_heat_temp: 10
thermostat: '{{ trigger.entity_id }}'
```
## Script arguments
key | optional | type | default | description
-- | -- | -- | -- | --
Expand Down
8 changes: 4 additions & 4 deletions python_scripts/thermostat_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
ATTR_HVAC_MODE = "hvac_mode"
ATTR_TEMPERATURE = "temperature"

ATTR_HEAT_STATE_DEFAULT = "heat"
ATTR_IDLE_STATE_DEFAULT = "off"
HVAC_HEAT = "heat"
HVAC_OFF = "off"
ATTR_IDLE_HEAT_TEMP_DEFAULT = 8
ATTR_STATE_ONLY_DEFAULT = False
ATTR_TEMP_ONLY_DEFAULT = False

thermostat_id = data.get(ATTR_THERMOSTAT)
sensor_id = data.get(ATTR_SENSOR)
heat_state = data.get(ATTR_HEAT_STATE, ATTR_HEAT_STATE_DEFAULT)
idle_state = data.get(ATTR_IDLE_STATE, ATTR_IDLE_STATE_DEFAULT)
heat_state = data.get(ATTR_HEAT_STATE, HVAC_HEAT)
idle_state = data.get(ATTR_IDLE_STATE, HVAC_OFF)
idle_heat_temp = float(data.get(ATTR_IDLE_HEAT_TEMP, ATTR_IDLE_HEAT_TEMP_DEFAULT))
state_only = data.get(ATTR_STATE_ONLY, ATTR_STATE_ONLY_DEFAULT)
temp_only = data.get(ATTR_TEMP_ONLY, ATTR_TEMP_ONLY_DEFAULT)
Expand Down

0 comments on commit fe38c49

Please sign in to comment.