Custom speed, depth and water temperature sensors with logging - how do I do that best?

From my plotter I MQTT messages with the values I would like to create sensors with logging for. I get speed like this




The value is in knots, but I don’t know if that matters.

Depth under transducer:


That’s in meters.

And finally temp:


Today this is the payload:


In Celcius.

So these I would like to create custom sensors for. I see that template sensor is probably what I need, but I tried putting it in an automation, and that didn’t do anything at all. Could anybody please give me a pointer or five?

Ah, so we meet again… :laughing:

We can’t continue meeting this way, my wife is getting suspicious… :rofl: Thanks, for some reason I did not see that one! :+1:

1 Like

Not all that difficult, with a bit of reading. The only annoying thing is that “knots” isn’t a valid speed unit, so I just had to name it “knop” (Norwegian for knots). Temp, depth, speed:

  - platform: mqtt
    name: "Vanntemperatur"
    state_topic: "madmax/vanntemperatur"
    device_class: "temperature"
    unit_of_measurement: "°C"
    qos: 0

  - platform: mqtt
    name: "Dybde"
    state_topic: "madmax/dybde"
    unit_of_measurement: "m"
    qos: 0

  - platform: mqtt
    name: "Fart"
    state_topic: "madmax/fart"
    unit_of_measurement: "knop"
    qos: 0

I’m curious, what plotter do you use which outputs in MQTT?

CaptTom, I have omitted a step there… :wink: The plotter is a Garmin GPSMap, which sends out regular NMEA0183. I take that via an USB RS-232 plugged into the Pi, and a SignalK server on the Pi converts it to MQTT with the plug-in MQTT Gateway. Then I have Node-RED read the MQTT message and reformat it in a function node to an easy format and send it out again to the MQTT broker, and that’s what comes into Hass. So only one Pi does that, and a lot of other stuff. I use a Pi 4 4 gig RAM, but that’s mostly because I have J.River Media Center on it as well, with a library of around 200 000 tracks.

1 Like