From 97018c7d679a413707908e30c24902e38fcf2432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Wed, 8 Jan 2020 09:20:49 +0100 Subject: [PATCH] Remove entities tap_action patch --- README.md | 39 --------------------------------------- src/hui-entities-card.js | 35 ----------------------------------- 2 files changed, 74 deletions(-) diff --git a/README.md b/README.md index 411559b..5711ded 100644 --- a/README.md +++ b/README.md @@ -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? diff --git a/src/hui-entities-card.js b/src/hui-entities-card.js index ded9e8f..3dcd184 100644 --- a/src/hui-entities-card.js +++ b/src/hui-entities-card.js @@ -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', {}); });