import canToggleDomain from './can-toggle-domain';

export default function canToggleEntity(entity, servicesMap) {
  if (entity.domain === 'group') {
    return entity.state === 'on' || entity.state === 'off';
  }
  return canToggleDomain(entity.domain, servicesMap);
}

import canToggleDomain from './can-toggle-domain';

export default function canToggleEntity(entity, servicesMap) {
  if (!entity) {
    return false;
  }
  if (entity.domain === 'group') {
    return entity.state === 'on' || entity.state === 'off';
  }
  return canToggleDomain(entity.domain, servicesMap);
}

Make can-toggle-entity more robust