Function useEntity

  • Load data about entity by ID.

    type LightAttributes = { brightness: number }
    type LightState = 'on' | 'off'
    const { state, attributes: { friendly_name } } = useEntity<LightAttributes, LightState>('entity.example_light')

    Returns

    Entity object, if found.

    Type Parameters

    • TAttributes = Record<string, any>

      Type of entity attributes attribute.

    • TState = string

      Type of entity state attribute.

    Parameters

    • entityId: string

      full entity ID as displayed in Homeassistant

    Returns THomeassistantEntity<TAttributes, TState>

Generated using TypeDoc