def __getitem__(self, item):
    'Return a property as an attribute for jinja.'
    if (item in _COLLECTABLE_STATE_ATTRIBUTES):
        if (self._collect and (_RENDER_INFO in self._hass.data)):
            self._hass.data[_RENDER_INFO].entities.add(self._state.entity_id)
        return getattr(self._state, item)
    if (item == 'entity_id'):
        return self._state.entity_id
    if (item == 'state_with_unit'):
        return self.state_with_unit
    raise KeyError
Return a property as an attribute for jinja.
def __getitem__(self, item):
    
    if (item in _COLLECTABLE_STATE_ATTRIBUTES):
        if (self._collect and (_RENDER_INFO in self._hass.data)):
            self._hass.data[_RENDER_INFO].entities.add(self._state.entity_id)
        return getattr(self._state, item)
    if (item == 'entity_id'):
        return self._state.entity_id
    if (item == 'state_with_unit'):
        return self.state_with_unit
    raise KeyError