From fe38c49661349e4c4155b2011c139f7e83ab6386 Mon Sep 17 00:00:00 2001 From: bieniu Date: Mon, 23 Sep 2019 18:09:02 +0200 Subject: [PATCH] Update readme --- README.md | 25 +++++++++++++++++++++++-- info.md | 22 +++++++++++++++++++++- python_scripts/thermostat_update.py | 8 ++++---- 3 files changed, 48 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fa1ca6e..b0f0986 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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: >- @@ -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 -- | -- | -- | -- | -- diff --git a/info.md b/info.md index 83fb554..7bb1ed3 100644 --- a/info.md +++ b/info.md @@ -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: >- @@ -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 -- | -- | -- | -- | -- diff --git a/python_scripts/thermostat_update.py b/python_scripts/thermostat_update.py index 85bf712..1c21c98 100644 --- a/python_scripts/thermostat_update.py +++ b/python_scripts/thermostat_update.py @@ -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)