forked from DigiLive/mushroom-strategy
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 { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
||||
import AbstractChip from './AbstractChip';
|
||||
import RegistryFilter from '../utilities/RegistryFilter';
|
||||
|
||||
/**
|
||||
* Fan Chip class.
|
||||
@@ -18,8 +19,13 @@ class FanChip extends AbstractChip {
|
||||
icon_color: 'green',
|
||||
content: Registry.getCountTemplate('fan', 'eq', 'on'),
|
||||
tap_action: {
|
||||
action: 'call-service',
|
||||
action: 'perform-action',
|
||||
perform_action: 'fan.turn_off',
|
||||
target: {
|
||||
entity_id: new RegistryFilter(Registry.entities)
|
||||
.whereDomain('fan')
|
||||
.getValuesByProperty('entity_id') as string[],
|
||||
},
|
||||
},
|
||||
hold_action: {
|
||||
action: 'navigate',
|
||||
|
@@ -3,6 +3,7 @@
|
||||
import { Registry } from '../Registry';
|
||||
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
||||
import AbstractChip from './AbstractChip';
|
||||
import RegistryFilter from '../utilities/RegistryFilter';
|
||||
|
||||
/**
|
||||
* Light Chip class.
|
||||
@@ -18,8 +19,13 @@ class LightChip extends AbstractChip {
|
||||
icon_color: 'amber',
|
||||
content: Registry.getCountTemplate('light', 'eq', 'on'),
|
||||
tap_action: {
|
||||
action: 'call-service',
|
||||
action: 'perform-action',
|
||||
perform_action: 'light.turn_off',
|
||||
target: {
|
||||
entity_id: new RegistryFilter(Registry.entities)
|
||||
.whereDomain('light')
|
||||
.getValuesByProperty('entity_id') as string[],
|
||||
},
|
||||
},
|
||||
hold_action: {
|
||||
action: 'navigate',
|
||||
|
@@ -3,6 +3,7 @@
|
||||
import { Registry } from '../Registry';
|
||||
import { TemplateChipConfig } from '../types/lovelace-mushroom/utils/lovelace/chip/types';
|
||||
import AbstractChip from './AbstractChip';
|
||||
import RegistryFilter from '../utilities/RegistryFilter';
|
||||
|
||||
/**
|
||||
* Switch Chip class.
|
||||
@@ -18,8 +19,13 @@ class SwitchChip extends AbstractChip {
|
||||
icon_color: 'blue',
|
||||
content: Registry.getCountTemplate('switch', 'eq', 'on'),
|
||||
tap_action: {
|
||||
action: 'call-service',
|
||||
action: 'perform-action',
|
||||
perform_action: 'switch.turn_off',
|
||||
target: {
|
||||
entity_id: new RegistryFilter(Registry.entities)
|
||||
.whereDomain('switch')
|
||||
.getValuesByProperty('entity_id') as string[],
|
||||
},
|
||||
},
|
||||
hold_action: {
|
||||
action: 'navigate',
|
||||
|
Reference in New Issue
Block a user