From 87a132097ebdd6347ba58a15645cd73548abceb1 Mon Sep 17 00:00:00 2001 From: kotborealis Date: Mon, 5 Jul 2021 15:27:38 +0300 Subject: [PATCH] Reworked cover to sync with switches state --- README.md | 278 +----------------- .../cover_rf_time_based/manifest.json | 10 - .../cover.py | 79 +++-- .../cover_time_based_synced/manifest.json | 10 + .../services.yaml | 0 hacs.json | 2 +- info.md | 38 ++- 7 files changed, 90 insertions(+), 327 deletions(-) delete mode 100644 custom_components/cover_rf_time_based/manifest.json rename custom_components/{cover_rf_time_based => cover_time_based_synced}/cover.py (82%) create mode 100644 custom_components/cover_time_based_synced/manifest.json rename custom_components/{cover_rf_time_based => cover_time_based_synced}/services.yaml (100%) diff --git a/README.md b/README.md index 6fa67a3..09f343d 100644 --- a/README.md +++ b/README.md @@ -1,291 +1,27 @@ -# Cover Time Based Component trigger script (RF) version -Cover Time Based Component for your [Home-Assistant](http://www.home-assistant.io) based on [davidramosweb's Cover Time Based Component](https://github.com/davidramosweb/home-assistant-custom-components-cover-time-based), modified for covers triggered by RF commands, or any other unidirectional methods. +# Cover Time Based Component Synced version -With this component you can add a time-based cover. You have to set triggering scripts to open, close and stop the cover. Position is calculated based on the fraction of time spent by the cover travelling up or down. You can set position from within Home Assistant using service calls. When you use this component, you can forget about the cover's original remote controllers or switches, because there's no feedback from the cover about its real state, state is assumed based on the last command sent from Home Assistant. There's a custom service available where you can update the real state of the cover based on external sensors if you want to. - -You can adapt it to your requirements, actually any cover system could be used which uses 3 triggers: up, stop, down. The idea is to embed your triggers into scripts which can be hooked into this component via config. For example, you can use RF-bridge or dual-gang switch running Tasmota firmware integrated like in the examples shown below. - -The component adds two services ```set_known_position``` and ```set_known_action``` which allow updating HA in response to external stimuli like sensors. - -[Support forum](https://community.home-assistant.io/t/custom-component-cover-time-based/187654/3?u=robi) - -## Installation -[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs) -* Install using HACS, or manually: copy all files in custom_components/cover_rf_time_based to your /custom_components/cover_rf_time_based/ directory. -* Restart Home-Assistant. -* Create the required scripts in scripts.yaml. -* Add the configuration to your configuration.yaml. -* Restart Home-Assistant again. +Cover Time Based Component for your [Home-Assistant](http://www.home-assistant.io) based on [davidramosweb's Cover Time Based Component](https://github.com/davidramosweb/home-assistant-custom-components-cover-time-based) and [nagyrobi's Cover RF Time based](https://github.com/nagyrobi/home-assistant-custom-components-cover-rf-time-based/), +modified to sync state of cover with the state of switches. ### Usage -To use this component in your installation, you have to set RF-sending scripts to open, close and stop the cover (see below), and add the following to your configuration.yaml file: ### Example configuration.yaml entry ```yaml cover: - - platform: cover_rf_time_based + - platform: cover_time_based_synced devices: my_room_cover_time_based: name: My Room Cover travelling_time_up: 36 travelling_time_down: 34 - close_script_entity_id: script.rf_myroom_cover_down - stop_script_entity_id: script.rf_myroom_cover_stop - open_script_entity_id: script.rf_myroom_cover_up + close_switch_entity_id: switch.rf_myroom_cover_down + open_switch_entity_id: switch.rf_myroom_cover_up send_stop_at_ends: False #optional aliases: #optional - my_room_cover_time_based ``` + All mandatory settings self-explanatory. Optional settings: - `send_stop_at_ends` defaults to `False`. If set to `True`, the Stop script will be run after the cover reaches to 0 or 100 (closes or opens completely). This is for people who use interlocked relays in the scripts to drive the covers, which need to be released when the covers reach the end positions. - `aliases`: to override the entity name generated by Home Assistant internally from the (friendly) name. - - -### Example scripts.yaml entry -#### RF covers -The following example assumes that you're using an [MQTT-RF bridge running Tasmota](https://tasmota.github.io/docs/devices/Sonoff-RF-Bridge-433/) open source firmware to integrate your radio-controlled covers. The command scripts pass the `rfraw_data` parameter to a general transmitter script which takes care of queuing the transmission of the codes and keeping an appropriate delay between them: -```yaml -'rf_transmitter': - alias: 'RF Transmitter' - mode: queued - max: 30 - sequence: - - service: mqtt.publish - data: - topic: 'cmnd/rf-bridge-1/rfraw' - payload: '{{ rfraw_data }}' - - delay: 00:00:01 - -'rf_myroom_cover_down': - alias: 'RF send MyRoom Cover DOWN' - mode: single - max_exceeded: silent - sequence: - - service: script.turn_on - target: - entity_id: script.rf_transmitter - data: - variables: - rfraw_data: 'AAB0XXXXX....XXXXXXXXXX' - -'rf_myroom_cover_stop': - alias: 'RF send MyRoom Cover STOP' - mode: single - max_exceeded: silent - sequence: - - service: script.turn_on - target: - entity_id: script.rf_transmitter - data: - variables: - rfraw_data: 'AAB0XXXXX....XXXXXXXXXX' - - 'rf_myroom_cover_up': - alias: 'RF send MyRoom Cover UP' - mode: single - max_exceeded: silent - sequence: - - service: script.turn_on - target: - entity_id: script.rf_transmitter - data: - variables: - rfraw_data: 'AAB0XXXXX....XXXXXXXXXX' -``` - -For the scripts above you need a small automation in **automations.yaml** to set `RfRaw` back to `0` in Tasmota to avoid spamming your MQTT server with loads of sniffed raw RF data. This trigger is checked every minute only so set `> 40` set in the `value_template` to be a bit bigger than your biggest `travelling_time`: - -```yaml -- id: rf_transmitter_cancel_sniff - alias: 'RF Transmitter cancel sniffing' - trigger: - platform: template - value_template: "{{ ( as_timestamp(now()) - as_timestamp(state_attr('script.rf_transmitter', 'last_triggered')) | int(0) ) > 40 }}" - action: - - service: mqtt.publish - data: - topic: 'cmnd/rf-bridge-1/rfraw' - payload: '0' -``` -#### Switched covers -The example below assumes you've set `send_stop_at_ends: True` in the cover config, and you're using any [two-gang switch running Tasmota](https://tasmota.github.io/docs/devices/Sonoff-Dual-R2/) open source firmware to integrate your switch-controlled covers: -```yaml -'rf_myroom_cover_down': - alias: 'Switches send MyRoom Cover DOWN' - mode: single - max_exceeded: silent - sequence: - - service: mqtt.publish - data: - topic: 'cmnd/myroomcoverswitch/POWER1' # open/close - payload: 'OFF' - - service: mqtt.publish - data: - topic: 'cmnd/myroomcoverswitch/POWER2' # power - payload: 'ON' - -'rf_myroom_cover_stop': - alias: 'Switches send MyRoom Cover STOP' - mode: single - max_exceeded: silent - sequence: - - service: mqtt.publish - data: - topic: 'cmnd/myroomcoverswitch/POWER2' # power - payload: 'OFF' - - service: mqtt.publish - data: - topic: 'cmnd/myroomcoverswitch/POWER1' # open/close - payload: 'OFF' - -'rf_myroom_cover_up': - alias: 'Switches send MyRoom Cover UP' - mode: single - max_exceeded: silent - sequence: - - service: mqtt.publish - data: - topic: 'cmnd/myroomcoverswitch/POWER1' # open/close - payload: 'ON' - - service: mqtt.publish - data: - topic: 'cmnd/myroomcoverswitch/POWER2' # power - payload: 'ON' -``` -Note how you don't have to configure these as switches in Home Assistant at all, it's enough just to publish MQTT commands strainght from the script (credits to [VDRainer](https://github.com/VDRainer) for this example). -Of course you can customize based on what ever other way to trigger these 3 type of movements. You could, for example, turn on and off warning lights along with the movement. - -### Services to set position or action without triggering cover movement - -This component provides 2 services: - -1. ```cover_rf_time_based.set_known_position``` lets you specify the position of the cover if you have other sources of information, i.e. sensors. It's useful as the cover may have changed position outside of HA's knowledge, and also to allow a confirmed position to make the arrow buttons display more appropriately. -1. ```cover_rf_time_based.set_known_action``` is for instances when an action is caught in the real world but not process in HA, .e.g. an RF bridge detects a ```stop``` action that we want to input into HA without calling the stop command. - - -#### ```cover_rf_time_based.set_known_position``` - -In addition to ```entity_id``` and ```position``` takes 2 optional parameters: -* ```confident``` that affects how the cover is presented in HA. Setting confident to ```true``` will mean that certain button operations aren't permitted. -* ```position_type``` allows the setting of either the ```target``` or ```current``` posistion. - -Following examples to help explain parameters and use cases: - -1. This example automation uses ```position_type: current``` and ```confident: true``` when a reed sensor has indicated a garage door is closed when contact is made: - -```yaml -- id: 'garage_closed' - alias: 'Doors: garage set closed when contact' - trigger: - - entity_id: binary_sensor.door_garage_cover - platform: state - to: 'off' - condition: [] - action: - - data: - confident: true - entity_id: cover.garage_door - position: 0 - position_type: current - service: cover_rf_time_based.set_known_position -``` - -We have set ```confident``` to ```true``` as the sensor has confirmed a final position. The down arrow is now no longer available in default HA frontend when the cover is closed. -```position_type``` of ```current``` means the current position is moved immediately to 0 and stops there (provided cover is not moving, otherwise will contiune moving to original target). - - -2. This example uses ```position_type: target``` (the default) and ```confident: false``` (also default) where an RF bridge has interecepted an RF command, so we know an external remote has triggered cover opening action: - -```yaml -- id: 'rf_cover_opening' - alias: 'RF_Cover: set opening when rf received' - trigger: - - entity_id: sensor.rf_command - platform: state - to: 'open' - condition: - - condition: state - entity_id: cover.rf_cover - state: closed - action: - - data: - entity_id: cover.rf_cover - position: 100 - service: cover_rf_time_based.set_known_position -``` - -```confident``` is omitted so defaulted to ```false``` as we're not sure where the movement may end, so all arrows are available. -```position_type``` is omitted so defaulted to ```target```, meaning cover will transition to ```position``` without triggering any start or stop actions. - -#### ```cover_rf_time_based.set_known_action``` -This service mimics cover movement in Home Assistant without actually sending out commands to the cover. It can be used for example when external RF remote controllers act on the cover directly, but the signals can be captured with an RF brigde and Home Assistant can play the movement in parrallel with the real cover. In addtion to ```entity_id``` takes parameter ```action``` that should be one of open, close or stop. - -Example: - -```yaml -- id: 'rf_cover_stop' - alias: 'RF_Cover: set stop action from bridge trigger' - trigger: - - entity_id: sensor.rf_command - platform: state - to: 'stop' - condition:[] - action: - - data: - entity_id: cover.rf_cover - action: stop - service: cover_rf_time_based.set_known_action -``` -In this instance we have caught a stop signal from the RF bridge and want to update HA cover without triggering another stop action. - -### Icon customization -For proper icon display (opened/moving/closed) customization can be added to `configuration.yaml` based of what type of covers you have, either one by one, or for all covers at once: - -```yaml -homeassistant: - customize_domain: #for all covers - cover: - device_class: shutter - customize: #for each cover separately - cover.my_room_cover_time_based: - device_class: shutter -``` -More details in [Home Assistant device class docs](https://www.home-assistant.io/docs/configuration/customizing-devices/#device-class). - -### Some tips when using this component with Tasmota RF Bridge in automations -Since there's no feedback from the cover about its current state, state is assumed based on the last command sent, and position is calculated based on the fraction of time spent travelling up or down. You need to measure time by opening/closing the cover using the original remote controller, not through the commands sent from Home Assistant (as they may introduce some delay). - -Tasmota RF bridge is able to send out the radio-frequency commands very quickly. If some of your covers 'miss' the commands occassionally (you can see that from the fact that the state shown in Home Assistant does not correspond to reality), it may be that those cover motors do not understand the codes when they are sent 'at once' from Home Assistant. - -This can be handled in multiple ways: -- try increasing your RF range. Make sure the wire antennas of the covers are not tied close to the power cables or to big metallic surfaces. For 433MHz, the antenna length should be around 17cm (this may include the part going inside the tube motor). Sonoff RF Bridge has two copper helical antennas near the PCB, you can unsolder them and simply solder in place two straight hard wires of 17.3cm, which can go out through some small holes on the sides of the unit. You need to solder only one end of each wire, to the points where the helical legs were shorter (points U7 and U8). This will increase the range substantially, to the cost of aesthetics. -- avoid _backlogs_ with `rfraw AAB0XXXXX....XXXXXXXXXX; rfraw 0` if you need multiple covers opening and closing at once. Switching the sniff on and off quickly for every cover movement may cause issues. It's enough to send `rfraw 0` only once with some delay after all procedures related to cover movements finished, the example scripts above take care of that. -- if you are sending `0xB0` codes (decoded with [BitBucketConverter.py](https://github.com/Portisch/RF-Bridge-EFM8BB1)) you can tweak those to be sent with repetitions (multiple times) by changing the repetition parameter (5th byte) of the code. [For example](https://github.com/arendst/Tasmota/issues/5936#issuecomment-500236581) 20 repetitions can be achieved by changing 5th byte from 04 to 14. Also BitBucketConverter can be run by specifiying the required repetitions at command line before decoding. Some covers might not like this, though. -- alternatively, you can further reduce stress by making sure you don't use [cover groups](https://www.home-assistant.io/integrations/cover.group/) containing multiple covers provided by this integration, and also in automation don't include multipe covers separated by commas in one service call. You could create separate service calls for each cover, moreover, add more delay between them: -```yaml -- alias: 'Covers down when getting dark' - mode: single - max_exceeded: silent - trigger: - - platform: numeric_state - below: 400 - for: "00:05:00" - entity_id: sensor.outside_light_sensor - action: - - service: cover.close_cover - entity_id: cover.room_1 - - delay: '00:{{ (range(1,10)|random|int) }}:00' - - service: cover.close_cover - entity_id: cover.room_2 - - delay: '00:00:02' - - service: cover.set_cover_position - data: - entity_id: cover.room_3 - position: 20 - - delay: '00:00:01' - - service: cover.set_cover_position - data: - entity_id: cover.room_4 - position: 30 -``` diff --git a/custom_components/cover_rf_time_based/manifest.json b/custom_components/cover_rf_time_based/manifest.json deleted file mode 100644 index cffd566..0000000 --- a/custom_components/cover_rf_time_based/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "domain": "cover_rf_time_based", - "name": "Cover Time Based RF (trigger script)", - "version": "1.0.8", - "documentation": "https://github.com/nagyrobi/home-assistant-custom-components-cover-rf-time-based", - "requirements": [ - "xknx==0.9.4" - ], - "codeowners": ["@davidramosweb", "@nagyrobi", "@Alfiegerner"] -} diff --git a/custom_components/cover_rf_time_based/cover.py b/custom_components/cover_time_based_synced/cover.py similarity index 82% rename from custom_components/cover_rf_time_based/cover.py rename to custom_components/cover_time_based_synced/cover.py index 2a8528d..45d64cb 100644 --- a/custom_components/cover_rf_time_based/cover.py +++ b/custom_components/cover_time_based_synced/cover.py @@ -1,4 +1,4 @@ -"""Cover Time based, RF version.""" +"""Cover Time based, Synced version.""" import logging import voluptuous as vol @@ -36,9 +36,8 @@ DEFAULT_TRAVEL_TIME = 25 DEFAULT_SEND_STOP_AT_ENDS = False -CONF_OPEN_SCRIPT_ENTITY_ID = 'open_script_entity_id' -CONF_CLOSE_SCRIPT_ENTITY_ID = 'close_script_entity_id' -CONF_STOP_SCRIPT_ENTITY_ID = 'stop_script_entity_id' +CONF_OPEN_SWITCH_ENTITY_ID = 'open_switch_entity_id' +CONF_CLOSE_SWITCH_ENTITY_ID = 'close_switch_entity_id' ATTR_CONFIDENT = 'confident' ATTR_POSITION = 'position' ATTR_ACTION = 'action' @@ -55,9 +54,8 @@ { cv.string: { vol.Required(CONF_NAME): cv.string, - vol.Required(CONF_OPEN_SCRIPT_ENTITY_ID): cv.entity_id, - vol.Required(CONF_CLOSE_SCRIPT_ENTITY_ID): cv.entity_id, - vol.Required(CONF_STOP_SCRIPT_ENTITY_ID): cv.entity_id, + vol.Required(CONF_OPEN_SWITCH_ENTITY_ID): cv.entity_id, + vol.Required(CONF_CLOSE_SWITCH_ENTITY_ID): cv.entity_id, vol.Optional(CONF_ALIASES, default=[]): vol.All(cv.ensure_list, [cv.string]), vol.Optional(CONF_TRAVELLING_TIME_DOWN, default=DEFAULT_TRAVEL_TIME): cv.positive_int, vol.Optional(CONF_TRAVELLING_TIME_UP, default=DEFAULT_TRAVEL_TIME): cv.positive_int, @@ -86,7 +84,7 @@ ) -DOMAIN = "cover_rf_time_based" +DOMAIN = "cover_time_based_synced" def devices_from_config(domain_config): """Parse configuration and add cover devices.""" @@ -95,11 +93,10 @@ def devices_from_config(domain_config): name = config.pop(CONF_NAME) travel_time_down = config.pop(CONF_TRAVELLING_TIME_DOWN) travel_time_up = config.pop(CONF_TRAVELLING_TIME_UP) - open_script_entity_id = config.pop(CONF_OPEN_SCRIPT_ENTITY_ID) - close_script_entity_id = config.pop(CONF_CLOSE_SCRIPT_ENTITY_ID) - stop_script_entity_id = config.pop(CONF_STOP_SCRIPT_ENTITY_ID) + open_switch_entity_id = config.pop(CONF_OPEN_SWITCH_ENTITY_ID) + close_switch_entity_id = config.pop(CONF_CLOSE_SWITCH_ENTITY_ID) send_stop_at_ends = config.pop(CONF_SEND_STOP_AT_ENDS) - device = CoverTimeBased(device_id, name, travel_time_down, travel_time_up, open_script_entity_id, close_script_entity_id, stop_script_entity_id, send_stop_at_ends) + device = CoverTimeBased(device_id, name, travel_time_down, travel_time_up, open_switch_entity_id, close_switch_entity_id, send_stop_at_ends) devices.append(device) return devices @@ -121,14 +118,13 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class CoverTimeBased(CoverEntity, RestoreEntity): - def __init__(self, device_id, name, travel_time_down, travel_time_up, open_script_entity_id, close_script_entity_id, stop_script_entity_id, send_stop_at_ends): + def __init__(self, device_id, name, travel_time_down, travel_time_up, open_switch_entity_id, close_switch_entity_id, send_stop_at_ends): """Initialize the cover.""" from xknx.devices import TravelCalculator self._travel_time_down = travel_time_down self._travel_time_up = travel_time_up - self._open_script_entity_id = open_script_entity_id - self._close_script_entity_id = close_script_entity_id - self._stop_script_entity_id = stop_script_entity_id + self._open_switch_entity_id = open_switch_entity_id + self._close_switch_entity_id = close_switch_entity_id self._send_stop_at_ends = send_stop_at_ends self._assume_uncertain_position = True self._target_position = 0 @@ -144,9 +140,38 @@ def __init__(self, device_id, name, travel_time_down, travel_time_up, open_scrip self.tc = TravelCalculator(self._travel_time_down, self._travel_time_up) + self._switch_close_state = "off" + self._switch_open_state = "off" + + async def _handle_state_changed(self, event): + if event.data.get("new_state").state != event.data.get("old_state").state: + if event.data.get("entity_id") == self._close_switch_entity_id: + self._switch_close_state = event.data.get("new_state").state + if event.data.get("entity_id") == self._open_switch_entity_id: + self._switch_open_state = event.data.get("new_state").state + + if self._switch_open_state == "off" and self._switch_close_state == "off": + self._handle_my_button() + elif self._switch_open_state == "on" and self._switch_close_state == "on": + self._handle_my_button() + if event.data.get("entity_id") == self._close_switch_entity_id: + await self.hass.services.async_call("homeassistant", "turn_off", {"entity_id": self._open_switch_entity_id}, False) + if event.data.get("entity_id") == self._open_switch_entity_id: + await self.hass.services.async_call("homeassistant", "turn_off", {"entity_id": self._close_switch_entity_id}, False) + elif self._switch_open_state == "on" and self._switch_close_state == "off": + self.tc.start_travel_up() + self._target_position = 100 + self.start_auto_updater() + elif self._switch_open_state == "off" and self._switch_close_state == "on": + self.tc.start_travel_down() + self._target_position = 0 + self.start_auto_updater() + + async def async_added_to_hass(self): """ Only cover position and confidence in that matters.""" """ The rest is calculated from this attribute. """ + self.hass.bus.async_listen("state_changed", self._handle_state_changed) old_state = await self.async_get_last_state() _LOGGER.debug(self._name + ': ' + 'async_added_to_hass :: oldState %s', old_state) if (old_state is not None and self.tc is not None and old_state.attributes.get(ATTR_CURRENT_POSITION) is not None): @@ -178,7 +203,7 @@ def name(self): @property def unique_id(self): """Return the unique id.""" - return "cover_rf_timebased_uuid_" + self._unique_id + return "cover_timebased_synced_uuid_" + self._unique_id @property def device_state_attributes(self): @@ -230,25 +255,16 @@ async def async_set_cover_position(self, **kwargs): async def async_close_cover(self, **kwargs): """Turn the device close.""" _LOGGER.debug(self._name + ': ' + 'async_close_cover') - self.tc.start_travel_down() - self._target_position = 0 - - self.start_auto_updater() await self._async_handle_command(SERVICE_CLOSE_COVER) async def async_open_cover(self, **kwargs): """Turn the device open.""" _LOGGER.debug(self._name + ': ' + 'async_open_cover') - self.tc.start_travel_up() - self._target_position = 100 - - self.start_auto_updater() await self._async_handle_command(SERVICE_OPEN_COVER) async def async_stop_cover(self, **kwargs): """Turn the device stop.""" _LOGGER.debug(self._name + ': ' + 'async_stop_cover') - self._handle_my_button() await self._async_handle_command(SERVICE_STOP_COVER) async def set_position(self, position): @@ -363,21 +379,24 @@ async def _async_handle_command(self, command, *args): if command == "close_cover": cmd = "DOWN" self._state = False - await self.hass.services.async_call("homeassistant", "turn_on", {"entity_id": self._close_script_entity_id}, False) + await self.hass.services.async_call("homeassistant", "turn_off", {"entity_id": self._open_switch_entity_id}, False) + await self.hass.services.async_call("homeassistant", "turn_on", {"entity_id": self._close_switch_entity_id}, False) elif command == "open_cover": cmd = "UP" self._state = True - await self.hass.services.async_call("homeassistant", "turn_on", {"entity_id": self._open_script_entity_id}, False) + await self.hass.services.async_call("homeassistant", "turn_off", {"entity_id": self._close_switch_entity_id}, False) + await self.hass.services.async_call("homeassistant", "turn_on", {"entity_id": self._open_switch_entity_id}, False) elif command == "stop_cover": cmd = "STOP" self._state = True - await self.hass.services.async_call("homeassistant", "turn_on", {"entity_id": self._stop_script_entity_id}, False) + await self.hass.services.async_call("homeassistant", "turn_off", {"entity_id": self._open_switch_entity_id}, False) + await self.hass.services.async_call("homeassistant", "turn_off", {"entity_id": self._close_switch_entity_id}, False) _LOGGER.debug(self._name + ': ' + '_async_handle_command :: %s', cmd) # Update state of entity self.async_write_ha_state() -# END +# END \ No newline at end of file diff --git a/custom_components/cover_time_based_synced/manifest.json b/custom_components/cover_time_based_synced/manifest.json new file mode 100644 index 0000000..ffe7a9a --- /dev/null +++ b/custom_components/cover_time_based_synced/manifest.json @@ -0,0 +1,10 @@ +{ + "domain": "cover_time_based_synced", + "name": "Cover Time Based Synced", + "version": "1.0.8", + "documentation": "https://github.com/kotborealis/home-assistant-custom-components-cover-time-based-synced", + "requirements": [ + "xknx==0.9.4" + ], + "codeowners": ["@kotborealis"] +} diff --git a/custom_components/cover_rf_time_based/services.yaml b/custom_components/cover_time_based_synced/services.yaml similarity index 100% rename from custom_components/cover_rf_time_based/services.yaml rename to custom_components/cover_time_based_synced/services.yaml diff --git a/hacs.json b/hacs.json index c481d28..19830e0 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { - "name": "Cover Time Based RF (trigger script)", + "name": "Cover Time Based Synced", "content_in_root": false, "render_readme": false, "domains": ["cover"], diff --git a/info.md b/info.md index 4fee941..09f343d 100644 --- a/info.md +++ b/info.md @@ -1,19 +1,27 @@ -# Cover Time Based Component RF (trigger script) version +# Cover Time Based Component Synced version -With this component you can add a time-based cover. You have to set triggering scripts to open, close and stop the cover. Position is calculated based on the fraction of time spent by the cover travelling up or down. You can set position from within Home Assistant using service calls. When you use this component, you can forget about the cover's original remote controllers or switches, because there's no feedback from the cover about its real state, state is assumed based on the last command sent from Home Assistant. There's a custom service available where you can update the real state of the cover based on external sensors if you want to. +Cover Time Based Component for your [Home-Assistant](http://www.home-assistant.io) based on [davidramosweb's Cover Time Based Component](https://github.com/davidramosweb/home-assistant-custom-components-cover-time-based) and [nagyrobi's Cover RF Time based](https://github.com/nagyrobi/home-assistant-custom-components-cover-rf-time-based/), +modified to sync state of cover with the state of switches. -[Configuration details and documentation](https://github.com/nagyrobi/home-assistant-custom-components-cover-rf-time-based) +### Usage +### Example configuration.yaml entry +```yaml +cover: + - platform: cover_time_based_synced + devices: + my_room_cover_time_based: + name: My Room Cover + travelling_time_up: 36 + travelling_time_down: 34 + close_switch_entity_id: switch.rf_myroom_cover_down + open_switch_entity_id: switch.rf_myroom_cover_up + send_stop_at_ends: False #optional + aliases: #optional + - my_room_cover_time_based +``` -## Supported features: -- Usable with covers which support only triggering, and give no feedback about their state (position is assumed based on commands sent from HA) -- State can be updated based on independent, external sensors (for example a contact or reed sensor at closed or opened state) -- State can mimic the operation based on external sensors (for example by monitoring the air for closing or opening RF codes) so usage in parrallel with controllers outside HA is possible -- Ability to take care care of queuing the transmission of the codes and keeping an appropriate delay between them to minimize 'missed' commands - -## Component authors & contributors - "@davidramosweb", - "@nagyrobi", - "@Alfiegerner" - -[Support forum](https://community.home-assistant.io/t/custom-component-cover-time-based/187654/3) +All mandatory settings self-explanatory. +Optional settings: +- `send_stop_at_ends` defaults to `False`. If set to `True`, the Stop script will be run after the cover reaches to 0 or 100 (closes or opens completely). This is for people who use interlocked relays in the scripts to drive the covers, which need to be released when the covers reach the end positions. +- `aliases`: to override the entity name generated by Home Assistant internally from the (friendly) name.