wez / govee2mqtt

Govee2MQTT: Connect Govee lights and devices to Home Assistant
MIT License
435 stars 26 forks source link

H61A8 will not work via LAN API #82

Closed andyblac closed 8 months ago

andyblac commented 8 months ago

Govee Device SKU

H61A8

Govee2MQTT Version

2024.01.17-5df26edb

Describe the issue

this device will not allow local LAN connection. only via remote API it seems.

Startup Diagnostics

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
GOVEE_API_KEY=REDACTED
GOVEE_MQTT_HOST=core-mosquitto
GOVEE_TEMPERATURE_SCALE=C
GOVEE_EMAIL=REDACTED
GOVEE_PASSWORD=REDACTED
GOVEE_MQTT_PASSWORD=REDACTED
GOVEE_MQTT_USER=addons
GOVEE_MQTT_PORT=1883
++ cd /app
++ exec /app/govee serve
[2024-01-18T14:07:51 INFO  govee::commands::serve] Starting service. version 2024.01.17-5df26edb
[2024-01-18T14:07:51 INFO  govee::commands::serve] Querying platform API for device list
[2024-01-18T14:07:51 INFO  govee::commands::serve] Querying undocumented API for device + room list
[2024-01-18T14:07:52 INFO  govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted.
[2024-01-18T14:07:52 INFO  govee::commands::serve] Starting LAN discovery
[2024-01-18T14:07:52 INFO  govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted.
[2024-01-18T14:07:52 INFO  govee::commands::serve] Waiting 10 seconds for LAN API discovery
[2024-01-18T14:08:02 INFO  govee::commands::serve] Devices returned from Govee's APIs
[2024-01-18T14:08:02 INFO  govee::commands::serve] Back Garden Neon Rope (11:CB:36:35:30:0B:77:FF H61A8)
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Platform API: devices.types.light. supports_rgb=true supports_brightness=true
[2024-01-18T14:08:02 INFO  govee::commands::serve]                 color_temp=Some((2000, 9000)) segment_rgb=Some(0..15)
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Undoc: room=None supports_iot=true ble_only=false
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Quirk { sku: "H61A8", icon: "mdi:led-strip-variant", supports_rgb: true, supports_brightness: true, color_temp_range: Some((2000, 9000)), avoid_platform_api: false, ble_only: false, lan_api_capable: true, device_type: Light, platform_temperature_sensor_units: None, platform_humidity_sensor_units: None, iot_api_supported: true, show_as_preset_buttons: None }
[2024-01-18T14:08:02 WARN  govee::commands::serve]   This device should be available via the LAN API, but didn't respond to probing yet. Possible causes:
[2024-01-18T14:08:02 WARN  govee::commands::serve]   1) LAN API needs to be enabled in the Govee Home App.
[2024-01-18T14:08:02 WARN  govee::commands::serve]   2) The device is offline.
[2024-01-18T14:08:02 WARN  govee::commands::serve]   3) A network configuration issue is preventing communication.
[2024-01-18T14:08:02 INFO  govee::commands::serve] 
[2024-01-18T14:08:02 INFO  govee::commands::serve] H5075_4D3D (4D:C8:A4:C1:38:EA:4D:3D H5075)
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Undoc: room=None supports_iot=false ble_only=true
[2024-01-18T14:08:02 WARN  govee::commands::serve]   Unknown device type. Cannot map to Home Assistant.
[2024-01-18T14:08:02 INFO  govee::commands::serve] 
[2024-01-18T14:08:02 INFO  govee::service::http] http server addr is 0.0.0.0:8056
[2024-01-18T14:08:08 INFO  govee::service::hass] Wait 1.1s for hass to settle on 22 entity configs
[2024-01-18T14:08:10 INFO  govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted.

Additional Logs

No response

Home Assistant Logs

[2024-01-18T14:07:51 INFO  govee::commands::serve] Starting service. version 2024.01.17-5df26edb
[2024-01-18T14:07:51 INFO  govee::commands::serve] Querying platform API for device list
[2024-01-18T14:07:51 INFO  govee::commands::serve] Querying undocumented API for device + room list
[2024-01-18T14:07:52 INFO  govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted.
[2024-01-18T14:07:52 INFO  govee::commands::serve] Starting LAN discovery
[2024-01-18T14:07:52 INFO  govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted.
[2024-01-18T14:07:52 INFO  govee::commands::serve] Waiting 10 seconds for LAN API discovery
[2024-01-18T14:08:02 INFO  govee::commands::serve] Devices returned from Govee's APIs
[2024-01-18T14:08:02 INFO  govee::commands::serve] Back Garden Neon Rope (11:CB:36:35:30:0B:77:FF H61A8)
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Platform API: devices.types.light. supports_rgb=true supports_brightness=true
[2024-01-18T14:08:02 INFO  govee::commands::serve]                 color_temp=Some((2000, 9000)) segment_rgb=Some(0..15)
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Undoc: room=None supports_iot=true ble_only=false
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Quirk { sku: "H61A8", icon: "mdi:led-strip-variant", supports_rgb: true, supports_brightness: true, color_temp_range: Some((2000, 9000)), avoid_platform_api: false, ble_only: false, lan_api_capable: true, device_type: Light, platform_temperature_sensor_units: None, platform_humidity_sensor_units: None, iot_api_supported: true, show_as_preset_buttons: None }
[2024-01-18T14:08:02 WARN  govee::commands::serve]   This device should be available via the LAN API, but didn't respond to probing yet. Possible causes:
[2024-01-18T14:08:02 WARN  govee::commands::serve]   1) LAN API needs to be enabled in the Govee Home App.
[2024-01-18T14:08:02 WARN  govee::commands::serve]   2) The device is offline.
[2024-01-18T14:08:02 WARN  govee::commands::serve]   3) A network configuration issue is preventing communication.
[2024-01-18T14:08:02 INFO  govee::commands::serve] 
[2024-01-18T14:08:02 INFO  govee::commands::serve] H5075_4D3D (4D:C8:A4:C1:38:EA:4D:3D H5075)
[2024-01-18T14:08:02 INFO  govee::commands::serve]   Undoc: room=None supports_iot=false ble_only=true
[2024-01-18T14:08:02 WARN  govee::commands::serve]   Unknown device type. Cannot map to Home Assistant.
[2024-01-18T14:08:02 INFO  govee::commands::serve] 
[2024-01-18T14:08:02 INFO  govee::service::http] http server addr is 0.0.0.0:8056
[2024-01-18T14:08:08 INFO  govee::service::hass] Wait 1.1s for hass to settle on 22 entity configs
[2024-01-18T14:08:10 INFO  govee::service::hass] MQTT connected with status=CONNACK code 0: Connection Accepted.

Anything else?

The MAC address in the log does not match the MAC address of the WiFi connection. LAN option is enabled n device settings.

wez commented 8 months ago

As the logs suggest: there are 3 likely causes:

1) LAN API needs to be enabled in the Govee Home App. 2) The device is offline. 3) A network configuration issue is preventing communication.

These are all things you need to check for your device. Sometimes you just need to power cycle a govee device for it to work properly.

Some users employ VLANs or other network security techniques that prevent the LAN API from working. Some users have network configurations that don't work with the LAN discovery protocol.

https://github.com/wez/govee2mqtt/blob/main/docs/LAN.md has more information about the LAN API.

The MAC address in the log does not match the MAC address of the WiFi connection.

Govee device IDs are not network MAC addresses. For some devices the device ID is a superset of the BLE MAC for the device, but if you look carefully you'll see that the device ID is too large to be a MAC.

wez commented 8 months ago

One other thing to note: that warning can be shown if the device is just really slow at responding to the LAN API. On startup we wait 10 seconds for the devices to respond, which should be plenty long enough for a local device.

You can check the state a little later by visiting the "Status" entity for the device and expanding the Attributes shown there; if we have subsequently received data from the LAN API there will be a Lan section shown:

image

andyblac commented 8 months ago
Screenshot 2024-01-18 at 14 27 03
andyblac commented 8 months ago

multicast is working fine for my Shelly devices, so why not this add-on ?

andyblac commented 8 months ago

after a reboot

Screenshot 2024-01-18 at 14 35 27
wez commented 8 months ago

It's not the add-on, it's Govee's protocol and how it interacts with your network environment.

andyblac commented 8 months ago

ok, so could you help identify what I need to do ?

andyblac commented 8 months ago

think I got it working by enabling Send discovery to each network interface

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
GOVEE_API_KEY=REDACTED
GOVEE_MQTT_HOST=core-mosquitto
GOVEE_TEMPERATURE_SCALE=C
GOVEE_EMAIL=REDACTED
GOVEE_PASSWORD=REDACTED
++ cd /app
GOVEE_MQTT_PASSWORD=REDACTED
GOVEE_LAN_BROADCAST_ALL=true
++ exec /app/govee serve
GOVEE_MQTT_USER=addons
GOVEE_MQTT_PORT=1883
[2024-01-18T14:39:44 INFO  govee::commands::serve] Starting service. version 2024.01.17-5df26edb
[2024-01-18T14:39:44 INFO  govee::commands::serve] Querying platform API for device list
[2024-01-18T14:39:45 INFO  govee::commands::serve] Querying undocumented API for device + room list
[2024-01-18T14:39:46 INFO  govee::service::iot] Connected to IoT: CONNACK code 0: Connection Accepted.
[2024-01-18T14:39:46 INFO  govee::commands::serve] Starting LAN discovery
[2024-01-18T14:39:46 INFO  govee::service::iot] IoT (re)connected with status CONNACK code 0: Connection Accepted.
[2024-01-18T14:39:46 INFO  govee::commands::serve] Waiting 10 seconds for LAN API discovery
[2024-01-18T14:39:56 INFO  govee::commands::serve] Devices returned from Govee's APIs
[2024-01-18T14:39:56 INFO  govee::commands::serve] H5075_4D3D (4D:C8:A4:C1:38:EA:4D:3D H5075)
[2024-01-18T14:39:56 INFO  govee::commands::serve]   Undoc: room=None supports_iot=false ble_only=true
[2024-01-18T14:39:56 WARN  govee::commands::serve]   Unknown device type. Cannot map to Home Assistant.
[2024-01-18T14:39:56 INFO  govee::commands::serve] 
[2024-01-18T14:39:56 INFO  govee::commands::serve] Back Garden Neon Rope (11:CB:36:35:30:0B:77:FF H61A8)
[2024-01-18T14:39:56 INFO  govee::commands::serve]   LAN API: ip=192.168.3.27
[2024-01-18T14:39:56 INFO  govee::commands::serve]   Platform API: devices.types.light. supports_rgb=true supports_brightness=true
[2024-01-18T14:39:56 INFO  govee::commands::serve]                 color_temp=Some((2000, 9000)) segment_rgb=Some(0..15)
[2024-01-18T14:39:56 INFO  govee::commands::serve]   Undoc: room=None supports_iot=true ble_only=false
[2024-01-18T14:39:56 INFO  govee::commands::serve]   Quirk { sku: "H61A8", icon: "mdi:led-strip-variant", supports_rgb: true, supports_brightness: true, color_temp_range: Some((2000, 9000)), avoid_platform_api: false, ble_only: false, lan_api_capable: true, device_type: Light, platform_temperature_sensor_units: None, platform_humidity_sensor_units: None, iot_api_supported: true, show_as_preset_buttons: None }
[2024-01-18T14:39:56 INFO  govee::commands::serve] 
[2024-01-18T14:39:56 INFO  govee::service::http] http server addr is 0.0.0.0:8056
Screenshot 2024-01-18 at 14 42 16
wez commented 8 months ago

Yep, that looks good!