Skip to content

Instantly share code, notes, and snippets.

@randellhodges
randellhodges / my-monster-card.js
Created March 12, 2019 19:20
Lovelace Monster-Card with When Entity Filter
class MyMonsterCard extends HTMLElement {
_getEntities(hass, filters) {
function _filterEntityId(stateObj, pattern) {
if (pattern.indexOf('*') === -1) {
return stateObj.entity_id === pattern;
}
const regEx = new RegExp(`^${pattern.replace(/\*/g, '.*')}$`, 'i');
return stateObj.entity_id.search(regEx) === 0;
}
@randellhodges
randellhodges / isy994.py
Created February 15, 2018 15:12
ISY994.py change testing
"""
Support the ISY-994 controllers.
For configuration details please visit the documentation for this component at
https://home-assistant.io/components/isy994/
"""
import asyncio
from collections import namedtuple
import logging
from urllib.parse import urlparse
In the directory your configuration.yaml file is location, create a folder called custom_components and put group_globber.py there. Then inside your configuration.yaml file, add a section like so:
group_globber:
groups:
group.group_emby:
- media_player.emby*
You should probably already have the group, in this case "group_emby" already created somewhere. Then you can add a list of wildcards that'll match entities and put them in that group.
Note: I have not tried modifying the built in "all" groups and I have always had the group I want to add things to already created.