The idea is to create an external shift light. The dashboard is running on a Pi 5. I’ve create a little daemon that listens on a socket and all I have to do is write the RPM value to the socket. With the “Run Terminal Command” I can write to the socket. But Ideally I want to send the current RPM value so that I don’t need to create an action for every RPM value. Is this possible?
You can use RealDash Data Multicasting and multicast the RPM only. That will send RPM to a TCP/IP in key value pair format.
This may help you to get started:
MULTICAST connection - Dashboard Design / Generic Design Discussion - RealDash Forum
Thanks! Works like a charm. Added very basic python client code for the next one who is wondering how to do this.
#! /usr/bin/python
import socket,os
import struct
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serverAddress = ('<multicast host>', <multicast port>)
sock.connect(serverAddress)
while True:
buf = sock.recv(1024)
pair = [buf[i:i+8] for i in range(0, len(buf), 8)]
i = 0
while i < len(pair):
id = int.from_bytes(pair[i][:4], "little")
value = int(struct.unpack('<f', pair[i][4:8])[0])
print("Id: " + str(id) + ", Value: " + str(value))
i += 1
Excellent work!
Just a note to everybody. The above code will work if you only multicast simple numeric values like RPM. RealDash is also capable of multicasting text, images, navigation instructions, music player commands etc. If you are multicasting any of those, the above code will get out of sync.
And this is what it is used for. Was a bit of a challenge to get the leds to work on an RPI 5, but switching to SPI did the trick.
Looks great, good job!