Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[govee] New Govee LAN-API Binding #15696

Merged
merged 36 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
af97edb
Nanoleaf codeowners change
stefan-hoehn May 1, 2023
270a60b
Merge branch 'openhab:main' into main
stefan-hoehn Jul 29, 2023
eaf4c93
Merge branch 'openhab:main' into main
stefan-hoehn Sep 17, 2023
2c427f7
Merge branch 'openhab:main' into main
stefan-hoehn Sep 23, 2023
2f346d0
Merge branch 'openhab:main' into main
stefan-hoehn Sep 27, 2023
25fb8d8
Merge branch 'openhab:main' into main
stefan-hoehn Oct 1, 2023
3f5c073
[govee lan api] initial contribution
stefan-hoehn Oct 3, 2023
e5b2d52
fix getting thing config
stefan-hoehn Oct 4, 2023
012d278
add binding to main pom, remove gson from own pom
stefan-hoehn Oct 4, 2023
d9abaee
Lots of review comment fixes
stefan-hoehn Oct 6, 2023
b8b4119
more review changes and refactorings
stefan-hoehn Oct 7, 2023
c78a406
small config fix
stefan-hoehn Oct 7, 2023
115d33b
power brignnhtness channel, last gson messages implemented
stefan-hoehn Oct 8, 2023
9443370
add missing changed files
stefan-hoehn Oct 8, 2023
ee7d3a8
change thing to thing-type:goveelan:govee-light
stefan-hoehn Oct 8, 2023
5353e77
further review changes
stefan-hoehn Oct 8, 2023
354f55b
spotless issues
stefan-hoehn Oct 8, 2023
00740a6
rename from goveelan to govee
stefan-hoehn Oct 8, 2023
3e0ec51
add color-percentage, fix color msg, refactor model names
stefan-hoehn Oct 12, 2023
6aa51c8
Refactor thread, rework on rest of feedback
stefan-hoehn Nov 1, 2023
0e499d9
fix thread condition
stefan-hoehn Nov 4, 2023
5760d02
WIP: Non-Working tripple channel-id support
stefan-hoehn Nov 18, 2023
f110a9a
refactor channel handling with local caching
stefan-hoehn Nov 22, 2023
04f4829
working channel implementation, add more thing props
stefan-hoehn Nov 25, 2023
a4400d3
fix Readme image links
stefan-hoehn Nov 25, 2023
dcc8e88
Christmas String Lights confirmed to work
stefan-hoehn Nov 26, 2023
01561c9
review changes
stefan-hoehn Nov 26, 2023
d0b2080
fix thread warning, lower log level
stefan-hoehn Nov 26, 2023
403983d
further review changes
stefan-hoehn Dec 2, 2023
039d6bc
param/props change, status update noise reduction
stefan-hoehn Dec 12, 2023
b97574b
new threadsafe implementation
stefan-hoehn Dec 16, 2023
70a5eaf
adapt text review comments
stefan-hoehn Dec 17, 2023
8e04f55
Change CommunicationManager to a service
kaikreuzer Dec 17, 2023
5130593
Merge pull request #1 from kaikreuzer/goveeservice
stefan-hoehn Dec 17, 2023
96dc9e9
Make constructor public
kaikreuzer Dec 17, 2023
b50da33
Merge pull request #2 from kaikreuzer/goveeservice
stefan-hoehn Dec 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
/bundles/org.openhab.binding.generacmobilelink/ @digitaldan
/bundles/org.openhab.binding.globalcache/ @mhilbush
/bundles/org.openhab.binding.goecharger/ @SamuelBrucksch
/bundles/org.openhab.binding.govee/ @stefan-hoehn
/bundles/org.openhab.binding.gpio/ @nils-bauer
/bundles/org.openhab.binding.gpstracker/ @gbicskei
/bundles/org.openhab.binding.gree/ @markus7017
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@
<artifactId>org.openhab.binding.goecharger</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.govee</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.gpio</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.govee/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
170 changes: 170 additions & 0 deletions bundles/org.openhab.binding.govee/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Govee Lan-API Binding

![govee](doc/govee-lights.png)

This binding integrates Light devices from [Govee](https://www.govee.com/).
Even though these devices are widely used, they are usually only accessable via the Cloud.
Another option is using Bluetooth which, due to its limitation only allows to control devices within a small range.
The Bluetooth approach is supported by the openHAB Govee Binding while this binding covers the LAN interface.

Fortunately, there is a [LAN API](https://app-h5.govee.com/user-manual/wlan-guide) that allows to control the devices within your own network without accessing the Cloud.
Note, though, that is somehow limited to a number of devices listed in the aforementioned manual.
The binding is aware of all the devices that are listed in that document and even provides a product description during discovery.

Note: By intent the Cloud API has not been implemented (so far) as it makes controlling Govee devices dependent by Govee service itself.

## Supported Things

The things that are supported are all lights.
While Govee provides probably more than a hundred different lights, only the following are supported officially by the LAN API, even though others might works as well.

Here is a list of the supported devices (the ones marked with * have been tested by the author)

- H619Z RGBIC Pro LED Strip Lights
- H6046 RGBIC TV Light Bars
- H6047 RGBIC Gaming Light Bars with Smart Controller
- H6061 Glide Hexa LED Panels (*)
- H6062 Glide Wall Light
- H6065 Glide RGBIC Y Lights
- H6066 Glide Hexa Pro LED Panel
- H6067 Glide Triangle Light Panels (*)
- H6072 RGBICWW Corner Floor Lamp
- H6076 RGBICW Smart Corner Floor Lamp (*)
- H6073 LED Floor Lamp
- H6078 Cylinder Floor Lamp
- H6087 RGBIC Smart Wall Sconces
- H6173 RGBIC Outdoor Strip Lights
- H619A RGBIC Strip Lights With Protective Coating 5M
- H619B RGBIC LED Strip Lights With Protective Coating
- H619C LED Strip Lights With Protective Coating
- H619D RGBIC PRO LED Strip Lights
- H619E RGBIC LED Strip Lights With Protective Coating
- H61A0 RGBIC Neon Rope Light 1M
- H61A1 RGBIC Neon Rope Light 2M
- H61A2 RGBIC Neon Rope Light 5M
- H61A3 RGBIC Neon Rope Light
- H61A5 Neon LED Strip Light 10
- H61A8Neon Neon Rope Light 10
- H618A RGBIC Basic LED Strip Lights 5M
- H618C RGBIC Basic LED Strip Lights 5M
- H6117 Dream Color LED Strip Light 10M
- H6159 RGB Light Strip (*)
- H615E LED Strip Lights 30M
- H6163 Dreamcolor LED Strip Light 5M
- H610A Glide Lively Wall Lights
- H610B Music Wall Lights
- H6172 Outdoor LED Strip 10m
- H61B2 RGBIC Neon TV Backlight
- H61E1 LED Strip Light M1
- H7012 Warm White Outdoor String Lights
- H7013 Warm White Outdoor String Lights
- H7021 RGBIC Warm White Smart Outdoor String
- H7028 Lynx Dream LED-Bulb String
- H7041 LED Outdoor Bulb String Lights
- H7042 LED Outdoor Bulb String Lights
- H705A Permanent Outdoor Lights 30M
- H705B Permanent Outdoor Lights 15M
- H7050 Outdoor Ground Lights 11M
- H7051 Outdoor Ground Lights 15M
- H7055 Pathway Light
- H7060 LED Flood Lights (2-Pack)
- H7061 LED Flood Lights (4-Pack)
- H7062 LED Flood Lights (6-Pack)
- H7065 Outdoor Spot Lights
- H70C1 Govee Christmas String Lights 10m (*)
- H70C2 Govee Christmas String Lights 20m (*)
- H6051 Aura - Smart Table Lamp
- H6056 H6056 Flow Plus
- H6059 RGBWW Night Light for Kids
- H618F RGBIC LED Strip Lights
- H618E LED Strip Lights 22m
- H6168 TV LED Backlight

## Discovery

Discovery is done by scanning the devices in the Thing section.

The devices _do not_ support the LAN API support out-of-the-box.
To be able to use the device with the LAN API, the following needs to be done (also see the "Preparations for LAN API Control" section in the [Goveee LAN API Manual](https://app-h5.govee.com/user-manual/wlan-guide)):

- Start the Govee APP and add / discover the device (via Bluetooth) as described by the vendor manual
Go to the settings page of the device
![govee device settings](doc/device-settings.png)
- Note that it may take several(!) minutes until this setting comes up.
- Switch on the LAN Control setting.
- Now the device can be used with openHAB.
- The easiest way is then to scan the devices via the SCAN button in the thing section of that binding

## Thing Configuration

Even though binding configuration is supported via a thing file it should be noted that the IP address is required and there is no easy way to find out the IP address of the device.
One possibility is to look for the MAC address in the Govee app and then looking the IP address up via:

```shell
arp -a | grep "MAC_ADDRESS"
```

### `govee-light` Thing Configuration

| Name | Type | Description | Default | Required | Advanced |
|-----------------|---------|---------------------------------------|---------|----------|----------|
| hostname | text | Hostname or IP address of the device | N/A | yes | no |
| macAddress | text | MAC address of the device | N/A | yes | no |
| deviceType | text | The product number of the device | N/A | yes | no |
| refreshInterval | integer | Interval the device is polled in sec. | 5 | no | yes |

## Channels

| Channel | Type | Description | Read/Write | Description |
|-----------------------|--------|---------------------------------|------------|----------------------|
| color | Switch | On / Off | RW | Power On / OFF |
| | Color | HSB (Hue Saturation Brightness) | RW | |
| | Dimmer | Brightness Percentage | RW | |
| color-temperature | Dimmer | Color Temperature Percentage | RW | |
| color-temperature-abs | Dimmer | Color Temperature Absolute | RW | in 2000-9000 Kelvin |

Note: you may want to set Unit metadata to "K" when creating a color-temperature-abs item.

## UI Example for one device

![ui-example.png](doc/ui-example.png)

Thing channel setup:

![channel-setup1.png](doc/channel-setup1.png)
![channel-setup2.png](doc/channel-setup2.png)
![channel-setup3.png](doc/channel-setup3.png)

```java
UID: govee:govee-light:33_5F_60_74_F4_08_77_21
label: Govee H6159 RGB Light Strip H6159 (192.168.178.173)
thingTypeUID: govee:govee-light
configuration:
deviceType: H6159
wifiSoftwareVersion: 1.02.11
hostname: 192.168.162.233
macAddress: 33:5F:60:74:F4:08:66:21
wifiHardwareVersion: 1.00.10
refreshInterval: 5
productName: H6159 RGB Light Strip
channels:
- id: color
channelTypeUID: system:color
label: Color
description: Controls the color of the light
configuration: {}
- id: color-temperature
channelTypeUID: system:color-temperature
label: Color Temperature
description: Controls the color temperature of the light from 0 (cold) to 100 (warm)
configuration: {}
- id: color-temperature-abs
channelTypeUID: govee:color-temperature-abs
label: Absolute Color Temperature
description: Controls the color temperature of the light in Kelvin
configuration: {}
```

## Additional Information

Please provide any feedback regarding unlisted devices that even though not mentioned herein do work.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.govee/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.govee</artifactId>

<name>openHAB Add-ons :: Bundles :: Govee Binding</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.govee-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-govee" description="Govee Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.govee/${project.version}</bundle>
</feature>
</features>
Loading