def is_on(hass, entity_id=None):
    entity = entity_id or ENTITY_ID_ALL_DEVICES

    return hass.states.is_state(entity, STATE_HOME)
Return the state if any or a specified device is home.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/device_tracker/__init__.py/is_on