Automate the Litra Beam

I recently automated my Litra Beam and wanted to share the results. So this is a semi-complicated process, so I’ll break it down into 4 Parts IoTLink, Downloading and installing hidapitester, Creating the buttons and input number stuff, and creating the automations. I’ll loosely go over everything, but if you have any questions, let me know.

IotLink Setup (Download Here)

Getting IoTLink setup is pretty easy if you know what you’re doing. But you’ll have to setup the MQTT Config to get it going. Just make sure you have the “Commands” option checked when you install it. Open the configuration by searching “Edit Configuration File” in the start menu. Put in your username and pass and a client ID and Home Assistant should auto-discover a bunch a stuff. This part is done.

Getting hidapitester

This program is the thing that will interface with the Litra Beam. Download it from here. Copy the .exe to C:\hidapitester. Optionally, you can add it to the “PATH” if needed, but we really won’t need to.

Creating the Buttons

Creating the buttons is kinda easy. You can find the config below:


mqtt:

  button:

    - unique_id: litra_beam_on

      name: "Turn On Litra Beam"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x1D,0x01", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_off

      name: "Turn Off Litra Beam"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x1D,0x00", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_20_percent

      name: "Set Litra Beam to 20%"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x4F,0x00,0x38", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_40_percent

      name: "Set Litra Beam to 40%"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x4F,0x00,0x38", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_60_percent

      name: "Set Litra Beam to 60%"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x4F,0x00,0x54", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_80_percent

      name: "Set Litra Beam to 80%"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x4F,0x00,0x94", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_100_percent

      name: "Set Litra Beam to 100%"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x4F,0x00,0xFA", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_cool

      name: "Set Litra Beam Temperature to Cool"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x9D,0x19,0x64", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_medium_cool
      name: "Set Litra Beam Temperature to Medium Cool"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x9D,0x13,0x88", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_neutral

      name: "Set Litra Beam Temperature to Neutral"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x9D,0x11,0x30", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_medium_warm

      name: "Set Litra Beam Temperature to Medium Warm"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x9D,0x0D,0x48", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

    - unique_id: litra_beam_warm

      name: "Set Litra Beam Temperature to Warm"

      command_topic: "iotlink/workgroup/clientId/commands/run"

      command_template: '{ "command": "C:\\hidapitester\\hidapitester.exe", "args": " --vidpid 046D/B901 --usagePage ff43 --open --send-output 0x11,0xFF,0x04,0x9D,0x0A,0x8C", "path": "C:\\hidapitester\\", "user": "", "visible": false, "fallback": true }'

Paste this config in your configuration.yaml File. If you already have something like this there, you’ll need just paste the items under mqtt->buttons. Make sure you replace clientId With your machine’s client ID.

Next we need to create the input numbers. You can create those by heading to Settings > Devices & Services > Helpers > Create Helper. You’ll need to create two helpers

  • Create a input number helper called “Litra Beam Brightness” (or whatever you prefer) and make the input min amount 0, and the input max amount 255. The step size should be 1.

  • Create a input number helper called “Litra Beam Temperature” (or whatever you prefer) and make the input min amount 150, and the input max amount 500. The step size should be .1.

We Also need to create a few switches. The code for that is below (This is used for the initial on/off state and remembering the state):


switch:    

  - platform: template

    switches:

      litra_beam:

        unique_id: litra_beam

        friendly_name: "Litra Beam"

        turn_on:

          service: button.press

          target:

            entity_id: button.turn_on_litra_beam

        turn_off:

          service: button.press

          target:

            entity_id: button.turn_off_litra_beam

      desk_key_light:

        unique_id: desk_key_light

        friendly_name: "Desk Key Light"

        value_template: "{{ is_state('switch.litra_beam', 'on') }}"

        turn_on:

          service: switch.turn_on

          target:

            entity_id: switch.litra_beam

        turn_off:

          service: switch.turn_off

          target:

            entity_id: switch.litra_beam

Lastly, We need to create the light. You can do that be using the light template below


light:

  - platform: template

    lights:

      desk_key_light:

        unique_id: desk_key_light

        friendly_name: "Desk Key Light"

        value_template: "{{ is_state('switch.litra_beam', 'on') }}"

        level_template: "{{states('input_number.desk_key_light_brightness') | int}}"

        temperature_template: "{{states('input_number.desk_key_light_temperature') | int}}"

        turn_on:

          service: switch.turn_on

          target:

            entity_id: switch.litra_beam

        turn_off:

          service: switch.turn_off

          target:

            entity_id: switch.litra_beam

        set_level:

          service: input_number.set_value

          data_template:

            entity_id: input_number.desk_key_light_brightness

            value: "{{ brightness }}"

        set_temperature:

          service: input_number.set_value

          data_template:

            entity_id: input_number.desk_key_light_temperature

            value: "{{ color_temp }}"

           

Creating the Automation

Creating the automation is a bit straightforward. You just need to press the button if any of the input number values are between a certain amount (this is due to the Litra Beam’s Non granular brightness control. You can find the automation code below:

Brightness:


description: ""

trigger:

  - platform: state

    entity_id:

      - input_number.desk_key_light_brightness

condition: []

action:

  - choose:

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_brightness

            above: -0.1

            below: 51

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_to_20

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_brightness

            above: 51

            below: 102

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_to_40

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_brightness

            above: 102

            below: 153

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_to_60

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_brightness

            above: 153

            below: 204

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_to_80

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_brightness

            above: 204

            below: 256

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_to_100

mode: single

Temperature:


alias: Update Litra Beam Temperature

description: ""

trigger:

  - platform: state

    entity_id:

      - input_number.desk_key_light_temperature

condition: []

action:

  - choose:

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_temperature

            above: 149

            below: 220

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_temperature_to_cool

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_temperature

            above: 220

            below: 290

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_temperature_to_medium_cool

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_temperature

            above: 290

            below: 360

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_temperature_to_neutral

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_temperature

            above: 360

            below: 430

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_temperature_to_medium_warm

      - conditions:

          - condition: numeric_state

            entity_id: input_number.desk_key_light_temperature

            above: 430

            below: 501

        sequence:

          - service: button.press

            data: {}

            target:

              entity_id: button.set_litra_beam_temperature_to_warm

mode: single

That’s pretty much it after that, Should just work! if you choose to change the names in there, make sure you change them in other places as well.

1 Like

Is this work with Logitech G Logitech Litra Beam LX for the RGB light too? I’m thinkign to buy two of them and i want it to make them smart as my yeelight lights. Thanks!

To use this with the LX you can send the output 0x11,0xFF,0x06,0x1F,0x01 for on, and 0x11,0xFF,0x06,0x1F,0x00 for off. This is for the main light. I might continue working on getting the rest of the payloads but no guarantees

Toggling the rear light:
On 0x11,0xFF,0x0A,0x4F,0x01
Off 0x11,0xFF,0x0A,0x4F,0x00

Great one Devin. I’ve been looking for a solution to use my spare Litra Beam. Thanks to you, I had something to start with. Since my home server is on Debian, I installed hidapitester for Linux and then I made a bash script which listens to specific mqtt topic. Once message is received it runs hidapitester command to control the light.

One thing which I noticed - for hidapitester to work in my setup –length parameter was required. Without this command had no effect whatsoever.

So instead of:

./hidapitester --vidpid 046D/B901 --usagePage FF43 --open --send-output 0x11,0xff,0x04,0x1d,0x01

I used

./hidapitester --vidpid 046D/B901 --usagePage FF43 --length 20 --open --send-output 0x11,0xff,0x04,0x1d,0x01

Works like a charm.