Node Red Experiences

Are you using Hassio and the community edition?

I really liked Node Red, but I have the opposite situation where automations ran much slower in Node Red compared to YAML and AppDaemon. So I have moved my automations to AppDaemon instead. I also had some reliability issues with Node Red, where it somehow lost connection to Home Assistant, but others had the same problems at that time, so that is probably fixed by now.

My NR flows were slow, and I also had some connection problems.

A few days ago, I moved NR to a different pi3 dedicated to NR. Works MUCH better, really responsive (i’m using alexa commands for a bunch of stuff), and I think connection problems are in the past for me. Since its a separate machine, once you make the connection it seems to be solid (knock on wood)

Randy

So after initially running HASSIO on a pi and having the SD Card go RO mode on me. I decided it was time to move everything off to a VM. I have a CoreOS vm running (no kuber) In there are the 3 containers for this stuff. I have other containers as well but for this I have HA, AD, NR. Prior to moving the install over to the VM I did rebuild it on the Pi and I had pointed AD from the docker container to the instance running on the pi as I felt it was only fair to take some of the load off of the little pi.
So that being said I now have a spare pi at the moment just hanging out while I come up with a project for it :slight_smile:

So it appears your link expired, what do you put in the switch for motion_event? When I was replicating yours I some how missed that piece.
Or if anyone else knows what you would put in the switch to just filter out motion events. Trying to find examples of this but his is the first one I’ve seen using the all events node like this. BTW slapping a debug node on that, holy cow I had no idea HA was processing that much stuff all the time.

Hey man, the link works for me. Are you using Xiaomi motion sensors?

Yeah, I think you see the events logged in the log too if you ever tail that.

Hey @chimpy weird its working now for me as well. No I’m using regular Aeotec 6 sensor devices.

EDIT: I’m also wanting to put your code to work on door sensors as well. I like the ability to have one source node to rule them all.

So I have this code

[{"id":"f643f713.6dcbf8","type":"switch","z":"63b888ad.567028","name":"Which Door Sensor?","property":"payload.entity_id","propertyType":"msg","rules":[{"t":"eq","v":"sensor.back_door_status","vt":"str"},{"t":"eq","v":"sensor.inside_garage_door_contact","vt":"str"},{"t":"eq","v":"sensor.freezer_door","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":360,"y":340,"wires":[["31b8da80.8406b6","db32b1e2.c375f"],[],[]],"outputLabels":["Back Door","Inside Garage Door","Freezer Door"]},{"id":"db32b1e2.c375f","type":"debug","z":"63b888ad.567028","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":610,"y":540,"wires":[]},{"id":"4acf8627.5a4308","type":"switch","z":"63b888ad.567028","name":"","property":"payload.event_type","propertyType":"msg","rules":[{"t":"cont","v":"state_changed","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":170,"y":340,"wires":[["f643f713.6dcbf8"]]},{"id":"31b8da80.8406b6","type":"switch","z":"63b888ad.567028","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":510,"y":220,"wires":[["db32b1e2.c375f"]]}]

image
I’m trying to catch the state change of when the door opens/closes so that I can set the timer for a 5 min delay and then if the door is closed prior to that 5 mins it resets the timer. That part seems simple enough but I can’t get the payload to go to that switch that contains the open/closed status of the sensor. I’ve tried msg.playload.new_state as well as just msg.payload but nothing is thrown out into the debug node.

EDIT: YES!!! Figured it out you need to capture this payload

payload.event.new_state.state

So i wanted to compare some values from HASS in a function, and made the following. Maby someone can use the idea.

HomeAssistant Template node

{% set getinfo = {
“shower”: states(“sensor.humidity1”)|float,
“emma”: states(“sensor.humidity3”)|float,
“ventilator” : states(“switch.bad_ventilator”)
} %}

{{ getinfo }}

Function

var obj = JSON.parse(msg.payload.replace(/[']/g, ‘"’));
msg.payload = obj;

var diff = ( msg.payload.shower- msg.payload.emma );

if(diff > 10 && msg.payload.ventilator == “off”){
return [msg,null];
}else if(diff < 10 && msg.payload.ventilator == “on”){
return [null,msg];
}else{
return [null,null];
}

Hi @DrJeff quick question on your pool temperature. Whats the purpose of using a time stamp node? and for the temperature node where can I find it? I am a noob to Node Red so just learning my way through…

What I am trying to achieve is my current yaml automation which basically detects temperature i.e. if its below 35 degress Celsius of the water and turns the water heater on and turns it back off if the temperature has reached 45 degrees Celsius.

How can I achieve that?

Thanks.

@bachoo786 I used the time stamp just to inject the reading of the temp, Now this is done a lot different. I use ESPeasy to read the temps via ONEwire and analog read of the filter pressure. Node Red does the processing. Temps also are used for Air, Pool Water, Spa Water, and Solar.

Here is the pressure flow

Here is the temps for heating the Spa

I think you could achieve what you want with something similar to my spa heating, but instaed of a loop use an inject node or bigtimer node as the trigger and a switch node to compare the temps, then send the On or Off command

@TheFuzz4 why not use a stoptimer node set for 5 minutes the send a STOP command if you want the timer stopped then the its retriggered when opened?

I actually ended up doing it with a trigger node like this

image

Works like a champ :slight_smile:

I’m probably dense here, but how do you set the Spa target temp?

I also have an esp running espeasy to control my spa. I use a DS18B20 to monitor temps, but currently don’t control temps in NR, have to use the heater panel because I’ve been lazy lol.

Of sorry that first node is watching an input select, or could be a slider when it changes then the following switch send the command on its marry path.

Does anyone know how I can recreate this in nodered please?

- alias: cube dimmer
  id: '1518421297609'
  trigger:
    platform: event
    event_type: cube_action
    event_data:
      entity_id: binary_sensor.cube_158d000276fdad
      action_type: rotate
  action:
    - service: light.turn_on
      data_template:
        entity_id: light.living_room
        brightness: >
          {%if trigger.event.data.action_value | float > 0 %}
          {{ states.light.living_room.attributes.brightness | int + 50 }}
          {% else %}
          {{ states.light.living_room.attributes.brightness | int - 50 }}
          {% endif %}

You’ll want something like:

  • Events node --> Three switch nodes, each filtering on event_type, entity_id, action_type respectively. Use the debug node (entire msg) to get the proper path --> Fourth switch node with greater than & “other” tests on action_value:
  • First fork (greater): Current State node on light.living_room --> Function node --> call service node (light.living_room)
  • Second fork (other): Current State node on light.living_room --> Function node --> call service node (light.living_room)

Contents of Function nodes:

newmsg = {};
brightness = msg.data.attributes.brightness + 50; [choose according to fork]
brightness = msg.data.attributes.brightness - 50; [choose according to fork]
newmsg.payload = { data: {"brightness":brightness, "transition":0.5 }};
return newmsg;
  • Take a look here for an Events node example with a couple of switches: https://www.hastebin.com/ewiyajikeb.json
  • Take a look here for an example with the Function node (concentrate on the Brightness Data node and have a look at where I grab “Kitchen Brightness” at the beginning): Node Red Experiences
1 Like

Thank you, i was banging my head when trying to get “ramp-thermostat” to change my temperature based on when the profile said it should be.

Hey, I hope this is the right place to ask for.

I wanted to create a simple flow to control my zwave thermostat based on specific times. I wanted it to be as clean as possible to learn something.

I have two input notes that trigger on specific times. They either sent msg.payload = “Heat” or “Heat Eco”
I inserted a function node to use the payload and format it for the HA service call node.

The problem is, It only sends me NaN after the function node. When i change the input to timestamp, its correct.

Can someone help me?

seems to me that operation_mode is looking for a number and you are feeding it a string.

remove the + before msg.payload

2 Likes