Bluelab Connect to Home assistant (Bluelab integration for home assistant)

This will allow you to plug the connect stick 2 into your home assistant and start receiving information.

Node red Addon :::

[
    {
        "id": "4121fba4c644fabd",
        "type": "serial in",
        "z": "0694583562892d91",
        "name": "BLC",
        "serial": "162d4aeefd114975",
        "x": 430,
        "y": 420,
        "wires": [
            [
                "2f9eb23fea61396a"
            ]
        ]
    },
    {
        "id": "2f9eb23fea61396a",
        "type": "function",
        "z": "0694583562892d91",
        "name": "Cmsg",
        "func": "var now = new Date().toLocaleString('en-US', {\n    timeZone: 'America/New_York',\n    year: 'numeric',\n    month: '2-digit',\n    day: '2-digit',\n    hour: '2-digit',\n    minute: '2-digit',\n    second: '2-digit',\n    hour12: false \n}).replace(/\\//g, '-').replace(/,/g, ' ');\n\n\nvar segments = msg.payload.split('\\t');\nvar ec = parseFloat(segments[2]); \nvar temperatureCelsius = parseFloat(segments[3]); \nvar ph = parseFloat(segments[5]); \n\n\nif (isNaN(ec) || isNaN(temperatureCelsius) || isNaN(ph)) {\n    ec = null;\n    temperatureCelsius = null;\n    ph = null;\n    return null;\n}\n\nvar ppm700 = ec ? Math.round(ec * 700) : null;\nvar temperatureFahrenheit = temperatureCelsius ? Math.round(temperatureCelsius * 9 / 5 + 32) : null;\nvar outputMsg = {\n    payload: now + \",\" + \"ppm700\" + \",F,\" + ppm700 + \",\" + ph + \",\" + temperatureFahrenheit\n};\n\nreturn outputMsg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 550,
        "y": 420,
        "wires": [
            [
                "e66bc2e1cf7fb990"
            ]
        ]
    },
    {
        "id": "e66bc2e1cf7fb990",
        "type": "file",
        "z": "0694583562892d91",
        "name": "save",
        "filename": "/homeassistant/FILENAME.csv",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 670,
        "y": 420,
        "wires": [
            []
        ]
    },
    {
        "id": "162d4aeefd114975",
        "type": "serial-port",
        "name": "",
        "serialport": "/dev/ttyUSB0",
        "serialbaud": "115200",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "waitfor": "",
        "dtr": "none",
        "rts": "none",
        "cts": "none",
        "dsr": "none",
        "newline": "10000",
        "bin": "false",
        "out": "time",
        "addchar": "",
        "responsetimeout": "10000"
    }
]

HA config :::

  - platform: file
    name: Water Temp
    file_path: /config/FILENAME.csv
    value_template: '{{ value.split(",")[5] }}'
    unit_of_measurement: F

  - platform: file
    name: Water ph
    file_path: /config/FILENAME.csv
    value_template: '{{ value.split(",")[4] }}'
    unit_of_measurement: Ph

  - platform: file
    name: Water Ppm
    file_path: /config/FILENAME.csv
    value_template: '{{ value.split(",")[3] }}'
    unit_of_measurement: Ppm

  - platform: file
    name: Water Time
    file_path: /config/FILENAME.csv
    value_template: '{{ value.split(",")[0] }}'

Lovelace UI::: (YOU WILL NEED CUSTOM GAUGE CARD)
PH

type: custom:tempometer-gauge-card
entity: sensor.water_ph
max: 14
min: 0
title: Ph
card_style: custom
icon1: mdi:numeric-3
icon2: mdi:numeric-6
icon3: mdi:numeric-10
severity:
  red: 1
  yellow: 4000
  green: 4000

EC

type: custom:tempometer-gauge-card
entity: sensor.water_ppm
max: 3500
min: 0
title: Total Dissolved Salts
card_style: custom
icon1: mdi:shaker-outline
icon2: mdi:water-percent
icon3: mdi:beach
severity:
  white: 4000
  red: 4000
  yellow: 4000
  green: 4000
  max: 4000

temp

type: custom:tempometer-gauge-card
entity: sensor.water_temp
max: 100
min: 0
title: Temp of Reservior
card_style: custom
icon1: mdi:sun-snowflake
icon2: mdi:weather-sunset
icon3: mdi:sun-thermometer-outline
severity:
  red: 80
  yellow: 4000
  green: 4000
  max: 4000

time file was last saved (important if you want to make it auto doser with fail safes)

type: entities
entities:
  - entity: sensor.water_time
    name: 'File Reads Time at:'

My initial thought was WTH is Bluelab but I googled it.

I looked at your code, and it seems you write a csv file like

Time,ppm,F,ppm,pH,temperature

I don’t get why you write ppm twice, nor why you write ‘F’?

1 Like

@nickrout guess i should of also mentioned it take EC value and turns it to ppm70 , also converts temp

the attempt was to mimic the output of the original message by Bluelab software. For me this was needed since i had already written an autodoser based off the output off the csv file from that software.

the first ppm700 is just the text where the 2nd is the actual numeric value

output by bluelab 3rd party software looks like this

2022-02-02 13:27:00,ppm500,F,1630,5.7,68
2022-02-02 13:28:00,ppm500,F,1620,5.7,68

output of home assistant node-red addon rip looks like this

04-07-2024  08:30:12,ppm700,F,630,5.95,64
04-07-2024  08:30:32,ppm700,F,630,5.95,65
04-07-2024  08:30:52,ppm700,F,630,5.95,65
04-07-2024  08:31:12,ppm700,F,630,5.95,64
04-07-2024  08:31:32,ppm700,F,630,5.95,65
04-07-2024  08:31:52,ppm700,F,630,5.95,65

Understand now. Thanks.

1 Like