node-red-contrib-home-assistant-websocketnode-red-contrib-home-assistant-websocket
Guides
Nodes
FAQ
Cookbook
Scrubber
Discussions
Discord
Github
Guides
Nodes
FAQ
Cookbook
Scrubber
Discussions
Discord
Github
  • Config Nodes

    • Device Config
    • Entity Config
    • Server Config
  • General Nodes

    • Action
    • API
    • Current State
    • Device
    • Events: all
    • Events: calendar
    • Events: state
    • Fire Event
    • Get Entities
    • Get History
    • Poll State
    • Render Template
    • Sentence
    • Tag
    • Time
    • Trigger: state
    • Wait Until
    • Webhook
    • Zone
  • Entity Nodes

    • Binary Sensor
    • Button
    • Entity
    • Number
    • Select
    • Sensor
    • Switch
    • Text
    • Time
    • Update Config

Events: state

The Events: State node listens for state changes of entities within Home Assistant. It triggers a flow in Node-RED whenever an entity's state changes, allowing you to automate responses to various conditions, like turning on lights when motion is detected or sending a notification when a door is opened.

Configuration:

Entity required

  • Type: string

The entity ID is used to listen for state changes. This can be a entity ID, regex, or a substring. If a regex or substring is used, the node will listen for all entities that match.

Example:

  • light.kitchen (entity) listens for state changes of the light.kitchen entity
  • ^light.* (regex) listens for state changes of all entities that start with light.
  • light (substring) listens for state changes of all entities that contain light in the entity ID

If State

  • Type: string

If the conditional is evaluated as true send the message to the first output otherwise send it to the second output. If blank there will only be one output.

Also see:

  • Conditionals

For

  • Type: number

An amount of time an entity's state needs to be in that state before triggering.

Warning

Output on Connect state changes will not start a timer.

State Type

  • Type: string
  • Values: string|number|boolean
  • Default: string

Convert the state of the entity to the selected type. Boolean will be converted to true based on if the string is equal by default to (y|yes|true|on|home|open). Original value stored in msg.data.original_state

Ignore state change event

  • Type: boolean

A list of possible states that will be ignored.

Output on Connect

  • Type: boolean

Output once on startup/deploy

Expose to Home Assistant

  • Type: boolean

Creates a switch within Home Assistant to enable/disable this node. This feature requires Node-RED custom integration to be installed in Home Assistant

Outputs

Value types:

  • event data: full event object
  • entity id: entity id of the triggered entity
  • entity state: entity state of the triggered entity
  • config: config properties of the node
Help us improve this page!
Last Updated:
Contributors: Jason
Prev
Events: calendar
Next
Fire Event