Transferring an Alexa Echo Automation to Node Red

I’m definitely a beginner when it comes to Node Red programming. I’m sure I’m missing something simple. I created an automation to have an Echo play a chime when the door opens. I’d like to convert it to a flow in node red since I already have a flow notifying my iphone when the door opens.

triggers:

  • type: opened
    device_id: SNZ-04P
    entity_id: Front Door Opening
    domain: binary_sensor
    trigger: device
    for:
    hours: 0
    minutes: 0
    seconds: 1
    conditions:
    actions:
  • action: notify.alexa_media_my_echo_show
    metadata: {}
    data:
    data:
    type: tts
    message:

This automation works great! I’m using an action node in Node Red. I have the action to: notify.alexa_media_my_echo_show but I’m struggling on the data entry. I figured all i needed was the data, but that didn’t work - JSONata error. I’m sure it’s just my misunderstanding of how it needs to be formatted. Any help would be greatly appreciated!

There are two entry options for the ‘Data’ object - JSON {} where you can use templates, and J: (expression) for JSONata (expressions) where you need to write appropriate and correct JSONata code.

In general, since the Action node - Data field is a JS object, and since templating does not always work (well) in this situation, the use of JSONata is recommended. JSONata is included as standard in Node-RED, and is the ‘preferred’ data manipulation language.

There are several examples in the HA WebSocket node documentation, as well as a fairly comprehensive explanation of how to generate the ‘data’ object for Actions (using JSONata) in the node cookbook.

You can find this here.

Thanks! That helped a ton!