Custom Component: Juwel HeliaLux Smart Controller

I’ve recently bought a Juwel HeliaLux Smart Controller (and the overly expensive LED lights that go with it) for my fish tank and wanted to monitor the LED settings with Home Assistant.

A few hours later and a basic custom component is born.

Installation is easy, copy the juwel_helialux folder from my GitHub repo to your custom_components folder.

Add the following to your config file:

sensor:
    - platform: juwel_helialux
      host: 1.2.3.4
      name: "Your Tank Name"

Change host to the ip address of your Juwel HeliaLux Smart Controller and change name to the name of your tank (you can call it whatever you want).

Restart Home Assistant and you should find the following sensors available…

  • tankname_blue
  • tankname_green
  • tankname_red
  • tankname_white
  • tankname_current_profile

sensors

It’s a very basic component at the moment, very little error checking but as most things I do, it’s a WIP.

You can download it from GitHub.

jakerol on github has pointed out that you need to have at least v2 of the firmware for this to work, please make sure you have updated your firmware to at least v2.1 before installing this custom component.

4 Likes

Awesome - I was looking exactly for something like this.
Hopefully in the future you will also be able to implement channels control and manual simulations.

I am not good with coding - I cannot really help you there, but happy to land a hand for testing :slight_smile:

1 Like

I am planning to do that at some point, I’m not a python programmer though so I’m learning as I go :smiley:

1 Like

Did you manage to also control the lights?

I’m using the command line to control the light, but prefer to use a default component:

image

Nope, life got in the way!

1 Like

Thanks for your work on this @Sleeps!

Will follow closely to see if you find the time to enhance this with control within HA.

How do you control via the command line?? do you have any reference I could look at?
Thanks a lot!

Hi,

sure, let me add the config files and the love-lace layout:

I have the following 3 config files:

If you’re able to improve it please do share. It took me a lot of frustration and ages to get this working… :crazy_face:

1st file:

switch:
  - platform: command_line
    switches:
      aquariumledmanual:
       friendly_name: Handmatige LED bediening
       command_off: 'curl -X POST -k -H "Content-Type: application/x-www-form-urlencoded" -d "action=14cswi=false" http://10.0.76.2/stat'

shell_command:
  aquariumled: 'curl -X POST -k -H "Content-Type: application/x-www-form-urlencoded" -d "action=3&ch1={{ (states("input_number.aquarium_slider_wit") | round(0)) }}&ch2={{ (states("input_number.aquarium_slider_blauw") | round(0)) }}&ch3={{ (states("input_number.aquarium_slider_groen") | round(0)) }}&ch4={{ (states("input_number.aquarium_slider_rood") | round(0)) }}" http://10.0.76.2/stat'
  aquariumledstate: 'curl -X POST -k -H "Content-Type: application/x-www-form-urlencoded" -d "action=14&ch5=843&tswi=false&ttime=01:00&cswi=true&ctime={{ (states("input_datetime.aquarium_led_timer")[:5]) }}" http://10.0.76.2/stat'
 
automation:
- alias: Helialux - control
  trigger:
    - platform: state
      entity_id:
        - input_number.aquarium_slider_wit
        - input_number.aquarium_slider_rood
        - input_number.aquarium_slider_groen
        - input_number.aquarium_slider_blauw
  action:
    service: shell_command.aquariumled
    
- alias: Helialux - manual
  trigger:
    - platform: state
      entity_id:
        - switch.aquariumledmanual
      from: 'off'
      to: 'on'
  action:
    service: shell_command.aquariumledstate

- alias: Helialux - sync
  trigger:
    - platform: state
      entity_id:
        - sensor.helialux_wit
        - sensor.helialux_rood
        - sensor.helialux_groen
        - sensor.helialux_blauw
  action:
    - service: input_number.set_value
      data_template:
        entity_id: input_number.aquarium_slider_wit
        value: '{{ states(''sensor.helialux_wit'') }}'
    - service: input_number.set_value
      data_template:
        entity_id: input_number.aquarium_slider_groen
        value: '{{ states(''sensor.helialux_groen'') }}'
    - service: input_number.set_value
      data_template:
        entity_id: input_number.aquarium_slider_blauw
        value: '{{ states(''sensor.helialux_blauw'') }}'
    - service: input_number.set_value
      data_template:
        entity_id: input_number.aquarium_slider_rood
        value: '{{ states(''sensor.helialux_rood'') }}'

2nd file:

input_number:
  aquarium_slider_wit:
    name: "Aquarium - Wit"
    min: 0
    max: 100
    step: 1
    mode: slider
   # icon: mdi:timer
  aquarium_slider_rood:
    name: "Aquarium - Rood"
    min: 0
    max: 100
    step: 1
    mode: slider
  aquarium_slider_groen:
    name: "Aquarium - Groen"
    min: 0
    max: 100
    step: 1
    mode: slider
  aquarium_slider_blauw:
    name: "Aquarium - Blauw"
    min: 0
    max: 100
    step: 1
    mode: slider

input_datetime:
  aquarium_led_timer:
    name: "Led Timer"
    has_date: false
    has_time: true
    icon: mdi:av-timer
    initial: 05:00

3rd file:

sensor:
  - platform: rest
    resource: http://10.0.76.2/statusvars.js
    method: POST
    scan_interval: 300
    name: HeliaLux
    payload: '{ "helialux" }'

template:
  - sensor:
      - name: "helialux_profile"
        state: >
          {{ (states('sensor.helialux').split(';')[3]).split('=')[1] |replace('\'', '')  }}
      - name: "helialux_wit"
        state: >
          {{ ((states('sensor.helialux').split(';')[7]).split('=')[1].split(',')[0]) | replace('[', '') | replace(']', '')   }}
      - name: "helialux_rood"
        state: >
          {{ ((states('sensor.helialux').split(';')[7]).split('=')[1].split(',')[3]) | replace('[', '') | replace(']', '')   }}
      - name: "helialux_groen"
        state: >
          {{ ((states('sensor.helialux').split(';')[7]).split('=')[1].split(',')[2]) | replace('[', '') | replace(']', '')   }}
      - name: "helialux_blauw"
        state: >
          {{ ((states('sensor.helialux').split(';')[7]).split('=')[1].split(',')[1]) | replace('[', '') | replace(']', '')   }}

Love-lace card:

square: false
columns: 1
type: grid
cards:
  - type: entities
    entities:
      - entity: sensor.helialux_profile
        name: Licht schema
      - entity: switch.aquariumledmanual
        icon: mdi:fishbowl-outline
        name: Aquarium Handmatig
      - entity: input_datetime.aquarium_led_timer
      - entity: input_number.aquarium_slider_wit
      - entity: input_number.aquarium_slider_rood
      - entity: input_number.aquarium_slider_groen
      - entity: input_number.aquarium_slider_blauw
  - type: custom:mini-graph-card
    name: HeliaLux
    entities:
      - entity: sensor.helialux_wit
        name: Wit
        color: white
        show_state: false
        show_graph: true
      - entity: sensor.helialux_rood
        name: Rood
        color: '#ff3333'
        show_state: false
        show_graph: true
      - entity: sensor.helialux_groen
        name: Groen
        color: '#99ff99'
        show_state: false
        show_graph: true
      - entity: sensor.helialux_blauw
        name: Blauw
        color: '#0099ff'
        show_state: false
        show_graph: true
    hours_to_show: 12
    points_per_hour: 4
    show:
      name: true
      legend: false
      icon: false
      labels: false
      state: false
    hour24: true
    height: 200
    state_map:
      - value: ' 90'
        label: Clear
      - value: 'on'
        label: Detected
1 Like

this is awesome!!! thanks a lot.

the only addition I have made is in the “Helialux - manual” automation.
I have added a rest.reload when the manual simulation is deactivated so to have the input slider immediately aligned back to the “auto” value

alias: Helialux - manual
trigger:
  - platform: state
    entity_id:
      - switch.aquariumledmanual
    from: 'off'
    to: 'on'
    id: attiva
  - platform: state
    entity_id:
      - switch.aquariumledmanual
    id: disattiva
    from: 'on'
    to: 'off'
action:
  - choose:
      - conditions:
          - condition: trigger
            id: attiva
        sequence:
          - service: shell_command.aquariumledstate
            data: {}
      - conditions:
          - condition: trigger
            id: disattiva
        sequence:
          - service: rest.reload
            data: {}
    default: []

Hello, I would like to ask for help.
What should be done with the 3 files for the integration to work?

Hi, sorry for the late response. Maybe you got it working already.
But if you add these 3 files to your HA or paste the content in your configuration.yaml file and adjust the IP to the one from your Helialux controller it should work

It works, but it’s not perfect my solution.

Hi, please give me a more detailed description of how to insert it, I’m a newbie and I don’t understand what and how. Thank you

I didnt got this working, so i’ve recreated fetching the values using dirty shell command:

  - platform: command_line
    name: Helialux Profile
    unique_id: helialux_profile
    command: curl http://192.168.99.197/statusvars.js | awk -F \; '{print $6}' | cut -d '=' -f2 | sed "s@'@@g"

  - platform: command_line
    name: Helialux White
    unique_id: helialux_white
    unit_of_measurement: "%"
    command: curl http://192.168.99.197/statusvars.js | awk -F \; '{print $10}' | cut -d '=' -f2 | cut -d ',' -f1 | sed "s@\[@@g" | sed "s@\]@@g"
  
  - platform: command_line
    name: Helialux Red
    unique_id: helialux_red
    unit_of_measurement: "%"
    command: curl http://192.168.99.197/statusvars.js | awk -F \; '{print $10}' | cut -d '=' -f2 | cut -d ',' -f4 | sed "s@\[@@g" | sed "s@\]@@g"
  
  - platform: command_line
    name: Helialux Green
    unique_id: helialux_green
    unit_of_measurement: "%"
    command: curl http://192.168.99.197/statusvars.js | awk -F \; '{print $10}' | cut -d '=' -f2 | cut -d ',' -f3 | sed "s@\[@@g" | sed "s@\]@@g"
  
  - platform: command_line
    name: Helialux Blue
    unique_id: helialux_blue
    unit_of_measurement: "%"
    command: curl http://192.168.99.197/statusvars.js | awk -F \; '{print $10}' | cut -d '=' -f2 | cut -d ',' -f2 | sed "s@\[@@g" | sed "s@\]@@g"

Feel free to optimize :slight_smile:

Have updated the component to (potentially) fix an error (Something broke: ‘str’ object does not support item assignment) that I think is caused by not being able to connect to the Juwel controller (i.e. it’s offline)… I can’t reproduce the error so I’m shooting in the dark with the potential fix.

Available in HACS or from the GitHub Repo

Edit: Now has unique_id so you can edit away in the HA UI…

Install the custom component? Install it via HACS, takes all the hassle out of it.

If you want to do it manually, download from github, unzip in to the custom components directory on your HA install, add the required sensor stuff to your configuration (all in the readme) and reboot HA.

Thank you for the reply, I have of course tested your component and it is great, I just miss the option to set the profile from HA. If I understood the script from m1c correctly it works for him. Well I will have to break down your python.

I want to modify your module if it succeeds:

You’ll need to use the light and switch domains if you are heading down that route.

Thanks so much for sharing this! Really appreciate it! :slight_smile:

I saw that some people weren’t able to use this. I think this is because of one small error. In the command_off it has to be action=14&cswi=false instead of action=14cswi=false.

Also you are using a custom card which can be downloaded with HACS: mini-graph-card

2 Likes