Remove entities tap_action patch

This commit is contained in:
Thomas Lovén 2020-01-08 09:20:49 +01:00
parent 5ab9c62cd8
commit 97018c7d67
2 changed files with 0 additions and 74 deletions

View File

@ -246,45 +246,6 @@ card:
```
![mod-card](https://user-images.githubusercontent.com/1299821/68621707-b71c1100-04d0-11ea-8473-965dbd77b762.png)
# Bonus function - entities card tap\_action
With card-mod installed, you will be able to use `tap_action` with rows in your entities cards:
Example:
```yaml
type: entities
entities:
- entity: light.bed_light
name: default
- entity: light.bed_light
name: toggle
tap_action:
action: toggle
- entity: light.bed_light
name: navigate
tap_action:
action: navigate
navigation_path: /lovelace/1
- entity: light.bed_light
name: url
tap_action:
action: url
url_path: https://google.com
- entity: light.bed_light
name: call-service
tap_action:
action: call-service
service: browser_mod.popup
service_data:
deviceID: this
title: Popup
card:
type: entities
entities:
- light.bed_light
```
# FAQ
### How do I convert my old card-modder configuration to card-mod?

View File

@ -28,40 +28,5 @@ customElements.whenDefined('hui-entities-card').then(() => {
return retval;
}
EntitiesCard.prototype._handleClick = function(config) {
const action = config.tap_action && config.tap_action.action ? config.tap_action.action : "more-info";
switch(action) {
case "more-info":
fireEvent("hass-more-info", { entityId: config.entity }, this);
break;
case "navigate":
history.pushState(null, "", config.tap_action.navigation_path);
fireEvent("location-changed", {}, this);
break;
case "url":
if(config.tap_action.url_path) {
window.open(config.tap_action.url_path);
}
break;
case "toggle":
if(config.entity) {
const domain = config.entity.split(".", 1)[0];
const isOff = ["closed", "locked", "off"].includes(this._hass.states[config.entity].state)
const service = ({
lock: ["unlock", "lock"],
cover: ["open_cover", "close_cover"]}[domain]
|| ["turn_on", "turn_off"])[isOff?0:1];
this._hass.callService(domain, service, { entity_id: config.entity });
}
break;
case "call-service": {
if(!config.tap_action.service) break;
const [domain, service] = config.tap_action.service.split(".", 2);
this._hass.callService(domain, service, config.tap_action.service_data);
break;
}
}
};
fireEvent('ll-rebuild', {});
});