Raspberry pi sense hat - No topic dialog

Hi,

The sense hat appeared to install ok, however in the property sheets there is no opportunity to edit the topic or the payload. Is this a common config issue or not? please

pi@raspberrypi:~/.node-red/node_modules pi@raspberrypi:~/.node-red/node_modules
pi@raspberrypi:~/.node-red/node_modules $ npm install node-red-node-pi-sense-hat
npm WARN node-red-project@0.0.1 No repository field.
npm WARN node-red-project@0.0.1 No license field.

  • node-red-node-pi-sense-hat@0.0.18
    updated 1 package and audited 242 packages in 5.062s

3 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

pi@raspberrypi:~/.node-red/node_modules $

Does the info or readme not tell you what it uses ?

I does as per the enclosed, however as I say there is no ability to set the topic or payload to direct the ouptut

The node sets msg.topic to identify the type of event it's sending a message for.

The payload is the value of the event. It wouldn't make sense for you to set a hardcoded payload as you'd lose the sensor data.

Thanks for the response, I understand what your saying. Clearly I am not understanding how this node works. I want to take the outputs and send them out via an MQTT message.

You can connect the SenseHat node straight to an MQTT node and it will publish the messages using the topic set by the SenseHat node, unless you hardcode a topic in the MQTT node.

Or you can add a Change node to customise the topic before passing it to the MQTT node.

Yes they do:

ooops - replaces glasses
I'll amend my code :slight_smile:

2nd attempt now I've found my glasses :slight_smile:
If you connect a debug node - you can see that its sending the motion and the environment info out as two separate messages (with a joystick message when you do something with it)

Each of the messages has a different topic assigned to them.

So if you leave the topic empty on your MQTT out node, they'll all get sent to 3 different topics.

But if you'd like to group them under a specified topic, you can just add a change node to help do this

and they'll end up on your broker like this

[edit] - slightly less typing if you don't mind using some JSONata to just prefix on all topics

image
[/edit]

Thanks for all the responses, I have connected it to debug and MQTT nodes etc, however I am going to rebuild the machine I have NR running on as it has been bashed around a good deal and I would not be surprised if there a few issues. This morning the palette no longer recognises the hat nodes at all. time for a lobotomy and restart....

Rebuilt the PI4 sticking to the instructions on the Running on RPi page, all working.. thanks for the responses

Not suggesting this needs doing quickly but would making the topic names explicit and editable be a good idea?

Also, what about the concept of having a editable prefix as well?

I played with a copy of the node to produce a POC

Is it worth me carrying on to produce a full PR?

From a UI design point of view, I'd suggest putting each topic input below the corresponding checkbox and enable/disable the input according to the selection.

And I wouldn't separate out the prefix as its just another thing a user has to then mentally parse and understand, rather than just seeing the explicit topics being used.

1 Like

Yes - and it only makes sense if sending onto a MQTT node anyway

Did a few modified drafts - not sure about using plain Topic or msg.topic

image

image

What is the problem with letting a change node do what it is good at ?

Just my 2c worth but reading the trail, I was thinking I would most likely use a change node more often than not

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.