How to make a "Heat map" with Node Red

I wanted a “heat map” to show the activity of my PIRs (passive infrared detectors).

For each PIR, I set up an input_select with five options in my configuration.yaml

  0_office_pir:
    options:
      - Level-1
      - Level-2
      - Level-3
      - Level-4
      - Level-5
    initial: Level-1  

I created different .pngs for each option:

  • Level 5 Bright green when the PIR was triggered in the last 30 seconds.
  • Level 4 (reserved)
  • Level 3 Blue when triggered between 30 seconds and 60 seconds ago.
  • Level 2 Gray when triggered between 1 and 5 minutes ago.
  • Level 1 Faint gray

My Lovelace looks like this:

          - type: picture-elements
            title: Terrace
            aspect_ratio: 1:1.74
            image: /local/Floorplan0.png
            elements:
              - type: image
                entity: input_select.0_patio_pir
                state_image:
                  'Level-1': /local/PIR01.png
                  'Level-2': /local/PIR02.png
                  'Level-3': /local/PIR03.png
                  'Level-5': /local/PIR05.png
                style:
                  top: 16%
                  left: 33%
                  transform: rotate(1deg)

In Node Red (where I’m already monitoring my PIRs for motion-sensitive lighting) my flow starts whenever my PIR is violated and triggers the following:

  • immediately set the value of my input_select to Level-5
  • wait 30 seconds, then set the input_select to Level-3
  • wait 60 seconds, then set the input_select to Level-2
  • wait 300 seconds, then set the input_select to Level-1

image

Works perfectly.

Cheers, Richard

Why do you want to violate your PIR’s?

1 Like

If you’re joking, I violate them because they like it.

If you’re not joking, violated is the term they send when they’ve been triggered.

Ok, english is not my first language, but because you asked if I joked :

violate

violate something (formal) to go against or refuse to obey a law, an agreement, etc.
violate something to damage or destroy a holy or special place
violate somebody (literary or old-fashioned) to force somebody to have sex

None seemed appropriate to PIR’s.

My PIRs are attached to an alarm system. In that context, “violated” means someone, possibly an intruder, has entered your space. Cheers.