mirror of
https://github.com/DigiLive/mushroom-strategy.git
synced 2025-08-04 12:04:28 +02:00
Fix Chip tap action
The action was turning off all entities of a domain. This includes entities which are excluded from the strategy by hidden/disabled status. The action now targets the strategy's entities explicitly. Closes #177
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
import { Registry } from '../Registry';
|
import { Registry } from '../Registry';
|
||||||
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
||||||
import AbstractChip from './AbstractChip';
|
import AbstractChip from './AbstractChip';
|
||||||
|
import RegistryFilter from '../utilities/RegistryFilter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fan Chip class.
|
* Fan Chip class.
|
||||||
@@ -18,8 +19,13 @@ class FanChip extends AbstractChip {
|
|||||||
icon_color: 'green',
|
icon_color: 'green',
|
||||||
content: Registry.getCountTemplate('fan', 'eq', 'on'),
|
content: Registry.getCountTemplate('fan', 'eq', 'on'),
|
||||||
tap_action: {
|
tap_action: {
|
||||||
action: 'call-service',
|
action: 'perform-action',
|
||||||
perform_action: 'fan.turn_off',
|
perform_action: 'fan.turn_off',
|
||||||
|
target: {
|
||||||
|
entity_id: new RegistryFilter(Registry.entities)
|
||||||
|
.whereDomain('fan')
|
||||||
|
.getValuesByProperty('entity_id') as string[],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
hold_action: {
|
hold_action: {
|
||||||
action: 'navigate',
|
action: 'navigate',
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
import { Registry } from '../Registry';
|
import { Registry } from '../Registry';
|
||||||
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
||||||
import AbstractChip from './AbstractChip';
|
import AbstractChip from './AbstractChip';
|
||||||
|
import RegistryFilter from '../utilities/RegistryFilter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Light Chip class.
|
* Light Chip class.
|
||||||
@@ -18,8 +19,13 @@ class LightChip extends AbstractChip {
|
|||||||
icon_color: 'amber',
|
icon_color: 'amber',
|
||||||
content: Registry.getCountTemplate('light', 'eq', 'on'),
|
content: Registry.getCountTemplate('light', 'eq', 'on'),
|
||||||
tap_action: {
|
tap_action: {
|
||||||
action: 'call-service',
|
action: 'perform-action',
|
||||||
perform_action: 'light.turn_off',
|
perform_action: 'light.turn_off',
|
||||||
|
target: {
|
||||||
|
entity_id: new RegistryFilter(Registry.entities)
|
||||||
|
.whereDomain('light')
|
||||||
|
.getValuesByProperty('entity_id') as string[],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
hold_action: {
|
hold_action: {
|
||||||
action: 'navigate',
|
action: 'navigate',
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
import { Registry } from '../Registry';
|
import { Registry } from '../Registry';
|
||||||
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
||||||
import AbstractChip from './AbstractChip';
|
import AbstractChip from './AbstractChip';
|
||||||
|
import RegistryFilter from '../utilities/RegistryFilter';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch Chip class.
|
* Switch Chip class.
|
||||||
@@ -18,8 +19,13 @@ class SwitchChip extends AbstractChip {
|
|||||||
icon_color: 'blue',
|
icon_color: 'blue',
|
||||||
content: Registry.getCountTemplate('switch', 'eq', 'on'),
|
content: Registry.getCountTemplate('switch', 'eq', 'on'),
|
||||||
tap_action: {
|
tap_action: {
|
||||||
action: 'call-service',
|
action: 'perform-action',
|
||||||
perform_action: 'switch.turn_off',
|
perform_action: 'switch.turn_off',
|
||||||
|
target: {
|
||||||
|
entity_id: new RegistryFilter(Registry.entities)
|
||||||
|
.whereDomain('switch')
|
||||||
|
.getValuesByProperty('entity_id') as string[],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
hold_action: {
|
hold_action: {
|
||||||
action: 'navigate',
|
action: 'navigate',
|
||||||
|
Reference in New Issue
Block a user