Convert automation to Node red help needed

Recently I started moving all my automation from HA to Node Red. I am stuc how to convert this automation. Can somebody help me?

id: doobell_rings
alias: 'Someone at the frontdoor'
initial_state: 'on'
trigger:
- platform: event
  event_type: rfxtrx_event
  event_data:
    packet_type: 17
    sub_type: 0
    id_string: "1d54df6:1"
    values:
      command: "Group on"
action:
  service: notify.pushover
  data_template:
    message: "Someone at the frontdoor!"
  data:
    title: "Doorbell"

Use the event state node and input rfxtrx_event in the field.
Then add a function node with the following:

if(msg.payload.packet_type == 17 && msg.payload.sub_type == 0 && msg.payload.id_string == "1d54df6:1" && msg.payload.values.command== "Group on"){
   return msg;
}

I think…

If it doesn’t work then connect the event node to a debug node and let’s see what the payload is.

Thanks. I created the flow. I am working remote. So this evening when home will test it.


let you know if it’s working.

Just a tip. Always set your debug nodes to complete message.
Although it’s in this case only the payload that is interesting (most likely) then having the complete message is usually better.
Especially when you add message variables.

Thank you Hellis81. Your help was very usefull. I had to tweak the if statement a bit. The payload was a bit difference. Every thing works now. I had to remove the last equation in the if statement.

This part: msg.payload.values.command== “Group on” was not recognized.

The payload looks like:

So my if statement is now:

if(msg.payload.event.packet_type == 17 && msg.payload.event.sub_type == 0 && msg.payload.event.id_string == "1d54df6:1"){
   return msg;
}

I like this community. Always someone to help.

Regards,
Conrad

When you move the mouse over an value you get three buttons, one is copy the value, one is copy the path and the last one I can’t remember ( or perhaps there is only two).
But if you copy path, then you can type in the function node msg. and paste, then that is the value that should be "Group on"

Thanks. Learned a lot of new things. Node Red is very powerful. I have the feeling that it’s a reaction time is a little bit slower then automations in HA.
But much more powerful.

I don’t know. Haven’t timed it.
But you can however speed up automations more in Node red than in HA.
I noticed that recently when tried to read the events of a IKEA rotary encoder and lowering the volume.