Govee / Dreamcoulour LED Strips

Does anyone know if the minger/Govee/Dreamcolour Wifi enabled LED strips work with openhab?

I really want some individually addressable LEDs that work well with openhab.

Here are some links:

Thanks for any advice on how to tell!

I was told no. I’ve had the Govee strips for some time and just recently setup openhab. I contacted Govee support and was told they don’t have an open API.

That being said if anyone manages to get these to work with openhab I’d love to hear about it as well.
Cheers

Hello,

I bought a dreamcolor led stripe, too.
After some research, I ask the support, if there is an API to control the stripe over a third party app.
They reply with that they do not provide an api currently.

Egold555 tries to reverse engineer the bluetooth part of the dreamcolor.
At the moment, he only provides his findings.

ddxtanx published a python library for the govee.
maybe this can be used for the moment.

if someone has some effort to analyze more, here is discribed how to do it with an Android phone.

You can purchase strip controllers that are 8266 based. With those you could reflash to a firmware of your choice like wled possibly tasmota or esphome.

You have to google around and see what brand controllers are 8266 based, but I know on Ali express they sell generic one made for this task.

Yes , you’re right. There are solutions based on ESPs, which can be integrate into OH.
But it is too late. We bought the govee stripe and they are already installed.
And if you have some kind of devices, you are trying to use them with OH. :slight_smile:

1 Like

Hi there,

I am currently working on a Govee client written in Python.
You can find the first version here: https://github.com/thomasreiser/govee_api/

At the moment, I can only confirm support for H6159 and H6163.

It would be great if you could confirm if your devices also work with the client, and if not, it would be great if you would provide me with the raw data received from Govee (can be extracted/printed out in the example test client) or if you send me a pull request.

If someone wants to create a bridge to openHAB - feel free to do so!

@einherjer - Is this repo still available to view? Looks like it’s private on Github, I’ve got some H6159 coming tomorrow so would love it to give it a go

Because sharing is careing:

simple node js script
you need a bluetooth device on the machine that tries to talk to the strip

Examples:
Discover devices and uuid's
node index.js discover

All values can range from 0 to 255 (max)
Turn your strip red:
node index.js <deviceuuid> color red green blue
node index.js a4c138c9a407 color 255 0 0

Set brightness:
node index.js <deviceuuid> brightness value
node index.js a4c138c9a407 brightness 255

Turn strip on/off
node index.js <deviceuuid> on
node index.js a4c138c9a407 on

node index.js <deviceuuid> off
node index.js a4c138c9a407 off

install nodejs ex: from nodejs.org

create blank directory and in that directory execute
npm init -y
npm install @abandonware/noble lodash

create a new file call it index.js and put in the following:

const noble = require('@abandonware/noble');
const lodash = require('lodash');

const [,, uuid, command, v1, v2, v3 ] = process.argv;

const Commands = {
  On: () => Buffer.from([0x33, 0x01, 0x1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33]),
  Off: () => Buffer.from([0x33, 0x01, 0x0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32]),
  Brightness: (value) => Buffer.from([0x33, 0x04, value, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (0x33 ^ 0x04 ^ value)]),
  Color: (r, g, b) => Buffer.from([0x33, 0x05, 0x02, r, g, b, 0x00, 0xFF, 0xAE, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (0x31 ^ r ^ g ^ b)]),
}

noble.on('stateChange', async (state) => {
  if (state === 'poweredOn') {
    await noble.startScanningAsync();
  }
});

noble.on('discover', async (peripheral) => {
  if (uuid === "discover") {
    console.log(peripheral.advertisement.localName, peripheral.uuid)
  } else {
    if (peripheral.uuid.toLowerCase() === uuid.toLowerCase()) {
      console.log(peripheral.uuid);
      console.log("Found Govee thing");
      peripheral.on('disconnect', () => console.log("Disconnected"))
      await noble.stopScanningAsync();
      await peripheral.connectAsync();
      const result = await peripheral.discoverSomeServicesAndCharacteristicsAsync(['000102030405060708090a0b0c0d1910'], ['000102030405060708090a0b0c0d2b11']);
      
      switch(command) {
        case "on":
          await result.characteristics[0].writeAsync(Commands.On(), false);
          break;
        case "off":
          await result.characteristics[0].writeAsync(Commands.Off(), false);
          break;
        case "color":
          await result.characteristics[0].writeAsync(Commands.Color(lodash.clamp(parseInt(v1), 0, 255), lodash.clamp(parseInt(v2), 0, 255), lodash.clamp(parseInt(v3), 0, 255)), false);
          break;
        case "brightness":
          await result.characteristics[0].writeAsync(Commands.Brightness(lodash.clamp(parseInt(v1), 0, 255)), false);
          break;
        default:
          await result.characteristics[0].writeAsync(Commands.On(), false);
      }
      await peripheral.disconnectAsync();
      process.exit(0);
    }
  }
});

use the commands from the beginning in the specific directory you created the index.js
have fun.

1 Like

Ahh super cool! Thank you for sharing!

Do you have any tips for how to get the UUID of the govee strips? I’m seeing lots and lots of devices appear…

Did update the cover to include a discover command (not tested dont have my ble dongle with me)
if you found your device just Ctrl+C out of the thing.

Iam working on a small nodejs server that can be run on a raspy and controlled via simple http rest calls

Yeah thats exactly what I’m planning also! Thanks for your help, im not around the strip lights atm but will give it a shot and report back. Would be interested in setting up a repo eventually to share any code. Will eventually need one if cloning on to a Pi

I don’t know if the following is applicable but I have heard of people using this to eliminate the GOVEE app to access the GOVee thermometers.

i just blocked outbound traffic for the strip leaving only Bluetooth to connect

Did you saw https://drive.google.com/file/d/1MNQOxvOlieT_MAUt9N9YDaI6PJz-Sd7h/view

The easiest choice is to connect the LED strip to Alexa and than use the Amazon Echo Control BINDING.
This works quite well but you need one Echo DOT.

Hi, this is a very interresting code and I’m learning a lot from this, so thank you.
I want to use it and improve it to command my strips in real time, like playing scenes and it works, so thank you,
I’m still wondering how you managed to know what are the caracteristics you needed to write to ? I scanned all characteristics, and yes they have uuids, but no more information, no name, no explanation nothing…
Also, same shing to know what are the commands buffer code… I’m very interested about how you made to know the codes to send ? Did you do retroengineering like sniffing bluetooth traffic? Or any other technique ? Thanks in advance

i have the H6199 tv backlight strip and trying to incorporate into my openhab just to turn on and off,I have found this and i guess this will allow to send PUT requests from a rule binded to an item…but i dont have the skill to find the right syntax.Any ideas?

i want to use this with a rule to turn on or off my strip.

Request URL: https://developer-api.govee.com/v1/devices/control
Request Method: PUT
Request Header:
Content-Type : application/json
Govee-API-Key : 00000000-729c-4b82-b536-000000000
Request body
{
"device": "34:20:03:15:82:ae",
"model": "H6089",
"cmd": {
"name": "turn",
"value": "on"
}
}

I wanted to summarize a solution for the govee light strips (H6163 in my case) that works in OH3 on openhabian/rpi4, pulled from a number of past posts. There are a few steps but nothing crazy.

  1. Using the govee app request a developer api key.

  2. Run an HTTP Get request using your new api key to obtain the device id’s and model numbers for your govee devices. If on rpi/openhabian just run it from a terminal session.
    curl --location --request GET ‘https://developer-api.govee.com/v1/devices’ --header ‘Govee-API-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’
    Keep note of the device ID returned as well as model number.

  3. Create a text file to house the api put call that you’ll use to action your govee device. Name the file .sh and place in /etc/openhab/scripts. The file should contain the following shell command…
    #!/bin/bash
    curl --location --request PUT ‘https://developer-api.govee.com/v1/devices/control’ --header ‘Govee-API-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’ --header ‘Content-Type: application/json’ --data-raw ‘{“device”: “xx:xx:xx:xx:xx:xx:xx:xx”,“model”: “H6163”,“cmd”: {“name”: “turn”, “value”: “on”}}’
    Replace the x’s with your api key and device id. Don’t forget to update the model as well to your model returned in step 2. The value field specifies ON or OFF. You’ll need 2 files, one for OFF and another for ON actions.

  4. Create a new item in the OH3 gui of type switch. This is a virtual switch item, you’ll use it to trigger rules to turn the light strip on and off.

  5. You’ll need 2 rules, one for ON and one for OFF. The rule will be standard OH3 gui stuff with a when clause triggered by the state of the virtual switch item you’ve created in step 4. The then clause will run a rule DSL script. The script text will execute the .sh file you’ve created with your shell command from step 3. The script text should be as follows…
    var results = executeCommandLine(Duration.ofSeconds(20),“sh”,"/etc/openhab/scripts/.sh")
    logInfo(“exec”, “exec result - {}”, results)

Note that this is the ON rule calling .sh, you’ll need another calling .sh as well, and that’s it. You should now have a virtual switch with on and off states that triggers a rule that calls the shell script to execute the HTTP put command to turn your govee strip lights on or off.

If I’ve missed anything let me know.
Cheers

Hi and thanks for the summary.

With the 1st script I got errors on cmd line, but with postman I got the device ID and making a standard GET I got the deviceID.

I can also control it through postman with the APIkey and this in the body.

{
“device”: “79:XX:XX:38:XX:35:98”,
“model”: “H6159”,
“cmd”: {
“name”: “turn”,
“value”: “off”
}
}

But the PUT script won’t work neither in cmd line. I checked it multiple times, but to no avail. AFAIK and found is that there is no need for another binding to get this to work.

#!/bin/bash
curl --location --request PUT ‘https://developer-api.govee.com/v1/devices/control’ --header ‘Govee-API-Key: xxxxxxxx-eb24-4873-8fc4-xxxxxxxx’ --header ‘Content-Type: application/json’ --data-raw ‘{“device”: “79:XX:XX:38:XX:35:98”,“model”: “H6159”,”cmd": {“name”: “turn”, “value”: “on”}}’

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: LedstripAron
      command: ON
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: var results =
        executeCommandLine(Duration.ofSeconds(20),“sh”,"/etc/openhab/scripts/ledstrip_aron_on.sh")
        logInfo(“exec”, “exec result - {}”, results)
    type: script.ScriptAction

2022-01-08 16:06:04.203 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID '1065260291' failed: var results = executeCommandLine(Duration.ofSeconds(20),“sh”,"/etc/openhab/scripts/ledstrip_aron_on.sh") logInfo(“exec”, “exec result - null”, results)

This however works from the command line, but when I try to run it from openhab it does not work either…

curl -XPUT -H ‘Govee-API-Key: xxxxxxxx-eb24-4873-8fc4-xxxxxxxxxx’ -H “Content-type: application/json” -d ‘{“device”: “79:XX:XX:XX:38:XX:XX:98”,“model”: “H6159”,“cmd”: {“name”: “turn”,“value”: “on”}}’ ‘https://developer-api.govee.com/v1/devices/control

I wonder too if it’s possible to go the MQTT/nodered way? Wouldn’t that be easier?