One Home Assistant entity (or one of its attributes) the device asks Home Assistant to send the state of.
entity_id— the Home Assistant entity, such as"sun.sun": 1 to 255 bytes, containing a..attribute— an attribute of that entity, such as"elevation", up to 255 bytes, ornilfor the entity's state.once—trueasks Home Assistant for the current value only, instead of every change. It is a hint to the client: espex passes every matching state toEspex.HomeAssistantStates.handle_state/3either way.
Build one with new/1 or new!/1, which check the fields:
iex> Espex.HomeAssistantStates.Subscription.new!(entity_id: "sun.sun", attribute: "elevation")
%Espex.HomeAssistantStates.Subscription{entity_id: "sun.sun", attribute: "elevation", once: false}A wizard input link (see Espex.Wizard.Input) is a subscription with
entity_id: nil; the input's value fills it in.
Summary
Functions
Build a subscription from a keyword list, a map, or a subscription built by hand, checking each field.
Like new/1, but raises ArgumentError naming the bad field.
Types
Functions
Build a subscription from a keyword list, a map, or a subscription built by hand, checking each field.
An empty attribute is the same as nil. Returns
{:error, :invalid_subscription} for an unknown key or a bad value.
Like new/1, but raises ArgumentError naming the bad field.