SenseHat environment / motion problem


mm - very strange :frowning:

Nevertheless, thank you very much for your help. :grinning:

Try this workaround

configure two SenseHAT nodes - one for enviroment - one for motion




Now only the environment events are transferred and motion events are no longer transferred :crazy_face:

What version of Node-RED are you running?

1.3.5 is running

I'm on an old version but can't upgrade at moment due to the general internet problems but I' try and do so later

upgraded to 1.3.5 - still works fine for me

Do you have another Pi you could try it out on?

Thanks for the help and the info with the version. Yes I have two Pi and the second I prepare with an old version. Thanks. :grinning:

This is probably just one of those weird things that only happens on one computer.

As I said, I upgraded to the latest version 1.3.5 and mine still works.

I would try your other Pi and see what happens

Does your 2nd pi work?
I don't think this is a version issue

It is not.... :cry:

Which version do you have at the node-red-node-pi-sense-hat?

Good question - it turns out I had a VERY old version of that node!

Having upgraded it to 0.1.1 - I am now getting the same as you :slight_smile:

When I enable Motion - I get motion events, when I enable environment - I get environment events - when I enable both - I just get motion events

Now we just have to try and work out what change has caused this issue

I may have found a hack to cure the problem

One of the recent changes was to default to using python3 for the background data gathering instead of python2

I changed
to just use python2 again and it seems to have made it work again


1 Like

Happy to look at a PR if you like.

I'm really struggling to work out how to debug the node as I don't know how to launch it outside of NR and see what's going on :frowning:

@cymplecy Simon, I just did a compare of all the files in v0.1.0 and 0.1.1 and the only change is in the sensehat module that uses python3 if it is avaliable.

The issue is in the python code, in python2, when motion and environment are selected it sends back both, but in python3 it only sends back motion. I'm trying to debug it now.

It has to involve a change in how python3 code works compared to python2

1 Like

Experience has shown that this isn't necessarily true but it probably is :slight_smile:

Can someone exlplain that this python statement does:
ready =, [], [], 0.01)[0]

This is in the code and I have a hunch it is the cause of the issue with python3 since there is a change with timeout.

Changed in version 3.5: The function is now retried with a recomputed timeout when interrupted by a signal, except if the signal handler raises an exception (see PEP 475 for the rationale), instead of raising InterruptedError .
from select — Waiting for I/O completion — Python 3.9.5 documentation

  • here it is in context:
  # while still waiting for input on at least one file
    while files:
      ready =, [], [], 0.01)[0]
      if not ready:
        print(">>>> else")
        for file in ready:
          if file == sys.stdin:
            line = file.readline()
            if not line: # EOF, remove file from input list
            elif line.rstrip(): # optional: skipping empty lines