Skip to content

Commit b2a1cd7

Browse files
author
Tom Lasswell
committed
fix: Add required headers to Govee login request to resolve app version error
The Govee API now enforces a minimum app version requirement on the login endpoint, rejecting requests that don't include appVersion, clientId, clientType, iotVersion, and timestamp headers.
1 parent 4d8c8f2 commit b2a1cd7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

custom_components/govee/api/auth.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import base64
1212
import logging
13+
import time
1314
import uuid
1415
from dataclasses import dataclass
1516
from typing import Any
@@ -74,6 +75,8 @@ def _sanitize_response_for_logging(data: Any) -> Any:
7475
GOVEE_IOT_KEY_URL = "https://app2.govee.com/app/v1/account/iot/key"
7576
GOVEE_DEVICE_LIST_URL = "https://app2.govee.com/device/rest/devices/v1/list"
7677
GOVEE_CLIENT_TYPE = "1" # Android client type
78+
GOVEE_APP_VERSION = "6.5.02"
79+
GOVEE_IOT_VERSION = "0"
7780

7881

7982
def _extract_p12_credentials(
@@ -400,9 +403,15 @@ async def login(
400403
"clientType": GOVEE_CLIENT_TYPE,
401404
}
402405

406+
timestamp_ms = str(int(time.time() * 1000))
403407
headers = {
404408
"Content-Type": "application/json",
405409
"Accept": "application/json",
410+
"appVersion": GOVEE_APP_VERSION,
411+
"clientId": client_id,
412+
"clientType": GOVEE_CLIENT_TYPE,
413+
"iotVersion": GOVEE_IOT_VERSION,
414+
"timestamp": timestamp_ms,
406415
}
407416

408417
_LOGGER.debug("Attempting Govee account login")

0 commit comments

Comments
 (0)