[Docker / Container] echodevice

Begonnen von Sidey, 12 April 2026, 16:56:20

Vorheriges Thema - Nächstes Thema

FlatTV

Manuell ausgeführt und es geht wieder.
Es sollte doch passen...

HTTPMOD seht auf:
Interval 57600

Echodevice steht auf:
intervallogin  57660
npm_refresh_intervall  60060

Yml steht auf:
REFRESH_MIN_AGE_HOURS: 6
REFRESH_SCHEDULE_HOURS: 24

Raspi4 - Docker mit deconz, openccu, fhem, alexa-fhem, alexa-cookie-service, nginx und AfterTouch. Fhem noch mit CUL, BOSE-ST und Alexa (Connector)

Sidey

Versuche doch mal ein niedrigeres pollDelay:
attr AlexaCookieService get03PollDelay 21600
Nutze: SIGNALDuino, Homematic, Raspberry Pi, MQTT, Alexa, Docker, AlexaFhem,zigbee2mqtt, tasmota

Maintainer von: SIGNALduino, SD_WS*, fhem-docker, alexa-fhem-docker, fhempy-docker, WebAuth, fhem-mcp, midea-mqtt, whatsmeow-mqtt, alexa-cookie-service
https://github.com/sidey79?tab=repositories

FlatTV

Hab ich gemacht, gestern dann nochmal manuell und heute bin ich wieder hier

2026.10.27 14:05:44.574 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:08:44.577 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:09:44.595 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:12:44.584 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:15:44.623 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:17:44.628 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:19:44.641 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:21:44.648 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:25:44.652 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.27 14:26:40.890 3: [AlexaAccount] [echodevice_NPMWaitForCookie] [unbekannt] write new refreshtoken
2026.10.27 14:26:44.540 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 1
2026.10.27 14:26:44.540 3: [AlexaAccount] [echodevice_setState] to connected but loginerror
2026.10.27 14:27:49.505 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 2
2026.10.27 14:27:49.505 3: [AlexaAccount] [echodevice_setState] to connected but loginerror
Raspi4 - Docker mit deconz, openccu, fhem, alexa-fhem, alexa-cookie-service, nginx und AfterTouch. Fhem noch mit CUL, BOSE-ST und Alexa (Connector)

Sidey

Hallo,

das Log sieht danach aus, als würde Amazon das importierte Cookie ablehnen:


Bis 14:25 klappt der Login-Check mit dem alten Cookie (to connected).
Um 14:26:40 schreibt der Import ein neues Cookie (write new refreshtoken).
Vier Sekunden später kommt JSON error = no content. Amazon hat statt JSON vermutlich eine HTML-Loginseite geliefert.
Danach zählt loginerror hoch. Nach 5 Fehlern wechselt echodevice auf disconnected und versucht einen lokalen Login, den es im ACS-Setup nicht gibt.

Der Service exportiert immer den gespeicherten Zustand, auch wenn der letzte Refresh fehlgeschlagen ist. Wahrscheinlich war das Cookie also veraltet oder ungültig.
Bitte prüfe Folgendes:
get AlexaCookieService status: Wie lauten service_ok, cookie_available, refresh_available, service_age_hours, last_error und refresh_code?

Steht im Containerlog rund um 14:26 etwas wie Automatic status refresh failed?
Passt AMAZON_PAGE im Container zur Amazon-Domain im echodevice (z. B. amazon.de)?

Wenn der Refresh fehlschlägt: set AlexaCookieService refresh, danach get AlexaCookieService exportCookie. Hilft das nicht, set AlexaCookieService loginStart und den Amazon-Login neu durchführen.
Zur genaueren Diagnose kurz attr AlexaAccount browser_save_data 1 setzen.
Die Amazon-Antwort liegt dann als HTML unter www/echodevice/results/. Danach das Attribut wieder entfernen.


Unabhängig davon empfehle ich attr AlexaAccount npm_refresh_intervall 2592000 und im HTTPMOD timeout 60. Das behebt diesen Fehler nicht, vermeidet aber zusätzliche Fehler im Log.


Schick mir gern die Readings und das Containerlog, dann sehen wir weiter.

Grüße Sidey
Nutze: SIGNALDuino, Homematic, Raspberry Pi, MQTT, Alexa, Docker, AlexaFhem,zigbee2mqtt, tasmota

Maintainer von: SIGNALduino, SD_WS*, fhem-docker, alexa-fhem-docker, fhempy-docker, WebAuth, fhem-mcp, midea-mqtt, whatsmeow-mqtt, alexa-cookie-service
https://github.com/sidey79?tab=repositories

FlatTV

Guten Abend,
also bei mir haut es nicht mehr hin.

Heute Morgen um ca. 5:30 ein Host Neustart und AlexaAccount ist connected.
Im Log dann um 19:38 wird ein neuer Cookie abgerufen, aber noch nicht in AlexaAccount eingelesen.

AlexaCookieService Log
[2026-10-30T19:36:11,315 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:18:36:11 +0000] "GET /healthz HTTP/1.1" 200 4466 "-" "-"
[2026-10-30T19:36:41,407 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:18:36:41 +0000] "GET /healthz HTTP/1.1" 200 4465 "-" "-"
[2026-10-30T19:37:11,501 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:18:37:11 +0000] "GET /healthz HTTP/1.1" 200 4465 "-" "-"
[2026-10-30T19:37:41,596 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:18:37:41 +0000] "GET /healthz HTTP/1.1" 200 4466 "-" "-"
[2026-10-30T19:38:08,868 Europe/Berlin] [INFO] Starting refresh (scheduled)
[2026-10-30T19:38:08,868 Europe/Berlin] [INFO] Alexa-Cookie: <redacted>
......
[2026-10-30T19:38:10,579 Europe/Berlin] [INFO] Alexa-Cookie: <redacted>
[2026-10-30T19:38:10,580 Europe/Berlin] [INFO] Refresh finished (scheduled) in 1712 ms
[2026-10-30T19:38:10,580 Europe/Berlin] [INFO] Scheduled refresh completed
[2026-10-30T19:38:11,686 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:18:38:11 +0000] "GET /healthz HTTP/1.1" 200 4465 "-" "-"
[2026-10-30T19:38:41,788 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:18:38:41 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
Fhem Log
2026.10.30 19:06:58.292 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:08:58.308 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:16:58.362 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:18:58.383 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:20:58.371 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:26:58.408 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:36:58.448 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:38:58.451 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:40:58.472 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:42:58.508 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 19:52:58.563 3: [AlexaAccount] [echodevice_setState] to connected

Dann um 21:30 das Update vom AlexaCookieService und der AlexaAccount geht auf ,,connected but loginerror".
2026.10.30 21:21:59.090 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 21:25:59.091 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 21:30:15.726 4: AlexaCookieService: GetUpdate called (update)
2026.10.30 21:30:15.726 4: AlexaCookieService: UpdateTimer called from GetUpdate with cmd next sets timer to call update function in 57600.0 sec at 13:30:15.726, interval 57600
2026.10.30 21:30:15.728 4: AlexaCookieService: HandleSendQueue sends update with timeout 60 to https://alexa-cookie-service:58080/api/status, No Data,
header: x-auth-token: ...
Content-Type: application/json
2026.10.30 21:30:15.728 4: AlexaCookieService: GetUpdate will request exportCookie
2026.10.30 21:30:15.735 4: AlexaCookieService: Read callback: request type was update retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 4468
ETag: W/"1174-gzYnJ/8cyz+JqIqnIXWxLaECj68"
Date: Fri, 30 Oct 2026 20:30:15 GMT
Connection: close, body length 4468
2026.10.30 21:30:15.735 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 21:30:15.735 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 21:30:15.735 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 21:30:15.735 4: AlexaCookieService: no redirects to handle
2026.10.30 21:30:15.737 4: AlexaCookieService: Read response matched 6, unmatch 7 Reading(s)
2026.10.30 21:30:16.744 4: AlexaCookieService: HandleSendQueue sends get03 with timeout 60 to https://alexa-cookie-service:58080/api/cookie, No Data,
header: x-auth-token: ...
2026.10.30 21:30:16.750 4: AlexaCookieService: Read callback: request type was get03 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 12732
ETag: W/"31bc-hTi04rbhcZoGvcQi/pCCbEJ4kfU"
Date: Fri, 30 Oct 2026 20:30:16 GMT
Connection: close, body length 12732
2026.10.30 21:30:16.750 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 21:30:16.751 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 21:30:16.751 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 21:30:16.751 4: AlexaCookieService: no redirects to handle
2026.10.30 21:30:16.752 4: AlexaCookieService: Read response matched 1, unmatch 12 Reading(s)
2026.10.30 21:30:16.763 3: [AlexaAccount] [echodevice_NPMWaitForCookie] [unbekannt] write new refreshtoken
2026.10.30 21:30:16.766 4: AlexaCookieService: cookie export written and imported
2026.10.30 21:30:58.975 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 1
2026.10.30 21:30:58.976 3: [AlexaAccount] [echodevice_setState] to connected but loginerror
2026.10.30 21:31:25.887 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 2
2026.10.30 21:31:25.887 3: [AlexaAccount] [echodevice_setState] to connected but loginerror

Dann mache ich das ganze 3 x manuell im AlexaCookieService (Status/ Cookie Export) und ohne neuen Cookie ist es dann erfolgreich.
[2026-10-30T21:59:38,229 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:20:59:38 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:00:08,324 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:00:08 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:00:38,422 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:00:38 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:01:06,749 Europe/Berlin] [INFO] 172.27.0.6 - - [30/Oct/2026:21:01:06 +0000] "GET /api/status HTTP/1.0" 200 4468 "-" "fhem"
[2026-10-30T22:01:08,513 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:01:08 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:01:24,581 Europe/Berlin] [INFO] 172.27.0.6 - - [30/Oct/2026:21:01:24 +0000] "GET /api/cookie HTTP/1.0" 200 12732 "-" "fhem"
[2026-10-30T22:01:38,607 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:01:38 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:02:08,704 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:02:08 +0000] "GET /healthz HTTP/1.1" 200 4467 "-" "-"
[2026-10-30T22:02:23,872 Europe/Berlin] [INFO] 172.27.0.6 - - [30/Oct/2026:21:02:23 +0000] "GET /api/status HTTP/1.0" 200 4467 "-" "fhem"
[2026-10-30T22:02:32,847 Europe/Berlin] [INFO] 172.27.0.6 - - [30/Oct/2026:21:02:32 +0000] "GET /api/cookie HTTP/1.0" 200 12732 "-" "fhem"
[2026-10-30T22:02:38,803 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:02:38 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:03:08,894 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:03:08 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:03:38,984 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:03:38 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:04:09,077 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:04:09 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:04:39,172 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:04:39 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:05:09,263 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:05:09 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:05:16,431 Europe/Berlin] [INFO] 172.27.0.6 - - [30/Oct/2026:21:05:16 +0000] "GET /api/status HTTP/1.0" 200 4468 "-" "fhem"
[2026-10-30T22:05:22,279 Europe/Berlin] [INFO] 172.27.0.6 - - [30/Oct/2026:21:05:22 +0000] "GET /api/cookie HTTP/1.0" 200 12732 "-" "fhem"
[2026-10-30T22:05:39,350 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:05:39 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:06:09,440 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:06:09 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"
[2026-10-30T22:06:39,532 Europe/Berlin] [INFO] 127.0.0.1 - - [30/Oct/2026:21:06:39 +0000] "GET /healthz HTTP/1.1" 200 4468 "-" "-"

2026.10.30 22:01:06.742 4: AlexaCookieService: get will now request status, no optional value
2026.10.30 22:01:06.743 4: AlexaCookieService: HandleSendQueue sends get01 with timeout 60 to https://alexa-cookie-service:58080/api/status, No Data,
header: x-auth-token: ...
2026.10.30 22:01:06.749 4: AlexaCookieService: Read callback: request type was get01 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 4468
ETag: W/"1174-Ro4H7GF//cuHdGASz7ZQE9wNYjY"
Date: Fri, 30 Oct 2026 21:01:06 GMT
Connection: close, body length 4468
2026.10.30 22:01:06.750 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 22:01:06.750 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 22:01:06.750 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 22:01:06.751 4: AlexaCookieService: no redirects to handle
2026.10.30 22:01:06.752 4: AlexaCookieService: Read response matched 6, unmatch 7 Reading(s)
2026.10.30 22:01:24.573 4: AlexaCookieService: get will now request exportCookie, no optional value
2026.10.30 22:01:24.576 4: AlexaCookieService: HandleSendQueue sends get03 with timeout 60 to https://alexa-cookie-service:58080/api/cookie, No Data,
header: x-auth-token: ...
2026.10.30 22:01:24.582 4: AlexaCookieService: Read callback: request type was get03 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 12732
ETag: W/"31bc-hTi04rbhcZoGvcQi/pCCbEJ4kfU"
Date: Fri, 30 Oct 2026 21:01:24 GMT
Connection: close, body length 12732
2026.10.30 22:01:24.582 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 22:01:24.583 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 22:01:24.583 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 22:01:24.583 4: AlexaCookieService: no redirects to handle
2026.10.30 22:01:24.584 4: AlexaCookieService: Read response matched 1, unmatch 12 Reading(s)
2026.10.30 22:01:24.595 3: [AlexaAccount] [echodevice_NPMWaitForCookie] [unbekannt] write new refreshtoken
2026.10.30 22:01:24.597 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 22:01:24.606 4: AlexaCookieService: cookie export written and imported
2026.10.30 22:01:59.088 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 3
2026.10.30 22:01:59.088 3: [AlexaAccount] [echodevice_setState] to connected but loginerror
2026.10.30 22:02:23.864 4: AlexaCookieService: get will now request status, no optional value
2026.10.30 22:02:23.866 4: AlexaCookieService: HandleSendQueue sends get01 with timeout 60 to https://alexa-cookie-service:58080/api/status, No Data,
header: x-auth-token: ...
2026.10.30 22:02:23.873 4: AlexaCookieService: Read callback: request type was get01 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 4467
ETag: W/"1173-gxflU04ZT29mBtfUy3wB0lk2eWE"
Date: Fri, 30 Oct 2026 21:02:23 GMT
Connection: close, body length 4467
2026.10.30 22:02:23.873 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 22:02:23.873 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 22:02:23.874 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 22:02:23.874 4: AlexaCookieService: no redirects to handle
2026.10.30 22:02:23.875 4: AlexaCookieService: Read response matched 6, unmatch 7 Reading(s)
2026.10.30 22:02:32.839 4: AlexaCookieService: get will now request exportCookie, no optional value
2026.10.30 22:02:32.841 4: AlexaCookieService: HandleSendQueue sends get03 with timeout 60 to https://alexa-cookie-service:58080/api/cookie, No Data,
header: x-auth-token: ...
2026.10.30 22:02:32.847 4: AlexaCookieService: Read callback: request type was get03 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 12732
ETag: W/"31bc-hTi04rbhcZoGvcQi/pCCbEJ4kfU"
Date: Fri, 30 Oct 2026 21:02:32 GMT
Connection: close, body length 12732
2026.10.30 22:02:32.848 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 22:02:32.848 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 22:02:32.848 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 22:02:32.849 4: AlexaCookieService: no redirects to handle
2026.10.30 22:02:32.850 4: AlexaCookieService: Read response matched 1, unmatch 12 Reading(s)
2026.10.30 22:02:32.860 3: [AlexaAccount] [echodevice_NPMWaitForCookie] [unbekannt] write new refreshtoken
2026.10.30 22:02:32.863 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 22:02:32.871 4: AlexaCookieService: cookie export written and imported
2026.10.30 22:02:59.137 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 4
2026.10.30 22:02:59.137 3: [AlexaAccount] [echodevice_setState] to connected but loginerror
2026.10.30 22:05:02.188 3: AlexaCookieService: Defined with URL %%ACS_BASEURL%%/api/status and interval 57600 featurelevel 6.5
2026.10.30 22:05:02.188 4: AlexaCookieService: UpdateTimer called from DefineFn with cmd start sets timer to call update function in 55513.5 sec at 13:30:15.726, interval 57600
2026.10.30 22:05:16.423 4: AlexaCookieService: get will now request status, no optional value
2026.10.30 22:05:16.425 4: AlexaCookieService: HandleSendQueue sends get01 with timeout 60 to https://alexa-cookie-service:58080/api/status, No Data,
header: x-auth-token: edde9d6bc89032430581637bdb11accd0d449f73bf88388da1af0a8027534038
2026.10.30 22:05:16.431 4: AlexaCookieService: Read callback: request type was get01 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 4468
ETag: W/"1174-QClJ8T53BXcH8X0WDzhW0Bdxunk"
Date: Fri, 30 Oct 2026 21:05:16 GMT
Connection: close, body length 4468
2026.10.30 22:05:16.432 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 22:05:16.432 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 22:05:16.433 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 22:05:16.433 4: AlexaCookieService: no redirects to handle
2026.10.30 22:05:16.434 4: AlexaCookieService: Read response matched 6, unmatch 7 Reading(s)
2026.10.30 22:05:22.271 4: AlexaCookieService: get will now request exportCookie, no optional value
2026.10.30 22:05:22.273 4: AlexaCookieService: HandleSendQueue sends get03 with timeout 60 to https://alexa-cookie-service:58080/api/cookie, No Data,
header: x-auth-token: ...
2026.10.30 22:05:22.279 4: AlexaCookieService: Read callback: request type was get03 retry 0,
header: HTTP/1.1 200 OK
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
Content-Type: application/json; charset=utf-8
Content-Length: 12732
ETag: W/"31bc-hTi04rbhcZoGvcQi/pCCbEJ4kfU"
Date: Fri, 30 Oct 2026 21:05:22 GMT
Connection: close, body length 12732
2026.10.30 22:05:22.279 4: AlexaCookieService: BodyDecode is not decoding the response body (charset utf-8, bodyDecode defaults to none)
2026.10.30 22:05:22.280 4: AlexaCookieService: extracted JSON values to internal
2026.10.30 22:05:22.280 4: AlexaCookieService: checking for redirects, code=200, ignore=0
2026.10.30 22:05:22.280 4: AlexaCookieService: no redirects to handle
2026.10.30 22:05:22.281 4: AlexaCookieService: Read response matched 1, unmatch 12 Reading(s)
2026.10.30 22:05:22.291 3: [AlexaAccount] [echodevice_NPMWaitForCookie] [unbekannt] write new refreshtoken
2026.10.30 22:05:22.293 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 22:05:22.301 4: AlexaCookieService: cookie export written and imported
2026.10.30 22:05:59.310 3: [AlexaAccount] [echodevice_ParseAuth] reset loginerror from 4 to 0
2026.10.30 22:05:59.310 3: [AlexaAccount] [echodevice_setState] to connected
2026.10.30 22:07:59.245 3: [AlexaAccount] [echodevice_setState] to connected
Raspi4 - Docker mit deconz, openccu, fhem, alexa-fhem, alexa-cookie-service, nginx und AfterTouch. Fhem noch mit CUL, BOSE-ST und Alexa (Connector)

Sidey

Ich vermute, dass Amazon eine Antwort sendet die in AlexaAccount den folgenden Fehler protokolliert:

2026.10.30 22:01:59.088 3: [AlexaAccount] [echodevice_LostConnect] JSON error = no content / set loginerror to 3
Was da zurück kommt, kannst aber nur Du in den gespeicherten Antwortdatein finden.
(attr AlexaAccount browser_save_data 1)

Grüße Sidey
Nutze: SIGNALDuino, Homematic, Raspberry Pi, MQTT, Alexa, Docker, AlexaFhem,zigbee2mqtt, tasmota

Maintainer von: SIGNALduino, SD_WS*, fhem-docker, alexa-fhem-docker, fhempy-docker, WebAuth, fhem-mcp, midea-mqtt, whatsmeow-mqtt, alexa-cookie-service
https://github.com/sidey79?tab=repositories

Sidey

@FlatTV:

Mach doch ab ca. 8 Uhr bitte ein FHEM Update.
Ich habe herausgefunden, dass das echodevice Modul das json mit dem cookie, nicht als JSON auswertet, sondern als String.
Wenn die Reihenfolge der Inhalte nicht, wie vom Modul angenommen, stimmen kommt es zu dem login error.


Grüße Sidey
Nutze: SIGNALDuino, Homematic, Raspberry Pi, MQTT, Alexa, Docker, AlexaFhem,zigbee2mqtt, tasmota

Maintainer von: SIGNALduino, SD_WS*, fhem-docker, alexa-fhem-docker, fhempy-docker, WebAuth, fhem-mcp, midea-mqtt, whatsmeow-mqtt, alexa-cookie-service
https://github.com/sidey79?tab=repositories

FlatTV

@Sidey:

Du hattest eine lange Nacht  :o
Das tut mir wirklich leid.

Ich bin jetzt mit Container und FHEM auf dem aktuellen Stand.
Mein letzter Cookie ist noch der aus dem Log oben, ich lasse das jetzt rennen.
amazon_refreshtoken vorhanden 2026-10-30 22:05:22
Raspi4 - Docker mit deconz, openccu, fhem, alexa-fhem, alexa-cookie-service, nginx und AfterTouch. Fhem noch mit CUL, BOSE-ST und Alexa (Connector)

JudgeDredd

Hallo Sidey,

vom Prinzip her, finde ich es ja ganz charmant, die Alexa-Cookie Verwaltung zu dezentralisieren.
Allerdings komme ich nicht so recht weiter und die Anleitung auf GitHub lässt bei mir viele Fragen offen.

Meine Umgebung sieht grob so aus:
- FHEM-Produktion (Host A im Netzwerk A)
- FHEM-Integration (Host B im Netzwerk B)
- Docker-Host (Netzwerk C)
- Docker-Container (Netzwerk D)
- eigene PKI
- eigener DNS

Der erste Schritt wäre den Container zum laufen zu bringen ...
- welche Maschine verbirgt sich denn hinter "PROXY_PUBLIC_HOST" und wird dieser in meinem Fall benötigt ?
- wozu wird der Key für die rootCA benötigt ?
  die ServerCerts sind ja vom Zwischenzertifikat ausgestellt und nicht von der rootCA
  Es ist die Rede davon, der rootCA zu vertrauen. Aber einer CA wird ja nicht vertraut, sondern beschreibt ja nur das
  Ende einer Zertifikatskette.

Vielleicht kannst Du mich ja etwas erhellen 😊
Ich würde gerne das zentrale Cookie (aus Deinem container) in unterschiedlichen FHEM Installationen verwenden. Das sollte doch möglich sein, oder ?

Gruß,
JudgeDredd
Router: Eigenbau (pfSense)
FHEM: Proxmox (DELL R720) | Debian 12 (VM)

Sidey

Hallo JudgeDredd,

danke für die ausführliche Beschreibung, das hilft. Ich gehe deine Punkte der Reihe nach durch.

1. PROXY_PUBLIC_HOST

Der Container hat zwei Ports:

58080 ist die REST-API, die FHEM (HTTPMOD) abfragt.
58090 ist der Login-Proxy, den nur dein Browser beim einmaligen Amazon-Login öffnet.
PROXY_PUBLIC_HOST ist der Hostname oder die IP, unter der dein Browser Port 58090 erreicht. Daraus baut der Service die Login-URL http://<PROXY_PUBLIC_HOST>:58090/, die dann im Reading proxyUrl landet. In deinem Aufbau ist das also der Docker-Host (Netz C) bzw. sein DNS-Name, nicht die Container-IP aus Netz D und auch keiner der FHEM-Hosts.

Brauchst du ihn? Ja. Ist er leer, schreibt der Service beim Start eine Warnung ins Log und die Login-URL enthält HOSTNAME_MISSING. Der Login-Proxy läuft übrigens derzeit bewusst über HTTP, nicht HTTPS.

2. Wozu der Key der CA?

Du hast recht: "der CA vertrauen" heißt bei TLS konkret, dass FHEM das CA-Zertifikat als Vertrauensanker bekommt (sslArgs SSL_ca_file=...). Dafür braucht FHEM nur das öffentliche Zertifikat, niemals einen Key.

Den privaten CA-Key braucht ausschließlich der Container, und zwar nur im Standardmodus (TLS_SERVER_CERT_MODE=managed). In diesem Modus stellt sich der Service sein Serverzertifikat selbst aus: Ist keine CA vorhanden, erzeugt er eine eigene unter /data/tls, signiert damit das Serverzertifikat und erneuert es beim Containerstart automatisch, wenn es fehlt, in 30 Tagen abläuft oder nicht mehr zum Servernamen passt. Ohne Key kann er nicht signieren. Das ist für Leute ohne eigene PKI gedacht.

Für dich mit eigener PKI passt eine dieser Varianten besser:

a) Eigenes Serverzertifikat, kein CA-Key im Container (meine Empfehlung für dich)

environment:
  AUTH_TOKEN: <zufälliges Token>
  TLS_ENABLED: "true"
  TLS_SERVER_CERT_MODE: external
  TLS_SERVER_NAME: acs.deine-domain.example    # genau der Name, den FHEM in baseUrl nutzt
  TLS_SERVER_KEY_FILE: /data/tls/server.key
  TLS_SERVER_CERT_FILE: /data/tls/server.crt
  TLS_CA_CERT_FILE: /data/tls/ca-chain.crt     # nur für den internen Healthcheck
  PROXY_PUBLIC_HOST: dockerhost.deine-domain.example
volumes:
  - ./data:/data
  - ./pki/server.key:/data/tls/server.key:ro
  - ./pki/server.crt:/data/tls/server.crt:ro
  - ./pki/ca-chain.crt:/data/tls/ca-chain.crt:ro

Das TLS Zertifikat stellst du ganz normal aus deinem Zwischenzertifikat aus. In diesem Modus erzeugt der Service keine CA und stellt nichts selbst aus. Er prüft beim Start nur, ob Key und Zertifikat zusammenpassen und ob das Zertifikat auf TLS_SERVER_NAME passt. Wenn nicht, startet er nicht. Die Erneuerung liegt dann bei dir, automatisch passiert hier nichts.

Zur Kette: Der Service liefert genau das aus, was in server.crt steht. Legst du dort Serverzertifikat plus Zwischenzertifikat ab (in dieser Reihenfolge), reicht FHEM die Root als SSL_ca_file. Steht in server.crt nur das Serverzertifikat, muss die Datei auf FHEM-Seite Zwischen- und Root-Zertifikat enthalten.

b) Zwischenzertifikat an den Container geben

Willst du die automatische Erneuerung behalten, kannst du über TLS_CA_KEY_FILE / TLS_CA_CERT_FILE statt der Root auch ein (eigenes, gern dafür angelegtes) Zwischenzertifikat mitgeben. Dann bleibt der Root-Key außerhalb des Containers. Die README spricht an der Stelle zwar von "Root-CA", gemeint ist aber einfach die CA, die das Serverzertifikat signieren soll. Ehrlicherweise: Diese Variante mit Zwischenzertifikat ist bisher nicht durch Tests abgedeckt, und nach dem Code sollte die CA-Datei dann Zwischenzertifikat und Root enthalten (Zwischenzertifikat zuerst).
Wenn du das ausprobierst, freue ich mich über Rückmeldung.

Wichtig für beide Varianten: TLS_SERVER_NAME steht per Default auf alexa-cookie-service, das passt nur, wenn FHEM im selben Docker-Netz läuft. Bei dir muss dort der DNS-Name stehen, unter dem Host A und Host B den Service ansprechen, und genau dieser Name gehört in attr AlexaCookieService baseUrl https://<name>:58080.

3. Ein zentrales Cookie für mehrere FHEM-Installationen

Ja, das geht. Der Service hält genau einen Login-Zustand und liefert ihn über GET /api/cookie an jeden Client aus, der das AUTH_TOKEN mitschickt. Eine Bindung an eine bestimmte FHEM-Instanz gibt es nicht. Der Refresh passiert zentral im Container (zeitgesteuert bzw. beim Statusabruf, wenn der Stand älter als die Mindestgrenze ist), gleichzeitige Anfragen lösen nur einen Refresh aus.

Pro FHEM-Installation brauchst du:

ein eigenes HTTPMOD-Device aus scripts/example_fhem_httpmod_package.cfg
baseUrl auf den Service, dasselbe Token per storeKeyValue
die CA-Datei für sslArgs
Port 58080 muss von Netz A und Netz B aus erreichbar sein (Firewall/Routing)
Den Login (set AlexaCookieService loginStart) machst du nur einmal von einer Instanz aus.
Es läuft immer nur ein Login-Flow, ein neuer Start beendet einen laufenden.

Was ich dir nicht sicher beantworten kann: Wie sich echodevice auf beiden Instanzen verhält, wenn es mit demselben Cookie arbeitet, und ob Amazon nach einem Refresh das alte Cookie sofort ungültig macht, bis die andere Instanz beim nächsten Abruf das neue holt. Beides liegt außerhalb des Containers. Bitte achte darauf, dass npm_refresh_intervall im echodevice größer ist als der Refresh-Zyklus des Containers (so steht es auch in der Anleitung), und gib Bescheid, wenn eine Instanz zwischendurch rausfliegt.

Grüße Sidey
Nutze: SIGNALDuino, Homematic, Raspberry Pi, MQTT, Alexa, Docker, AlexaFhem,zigbee2mqtt, tasmota

Maintainer von: SIGNALduino, SD_WS*, fhem-docker, alexa-fhem-docker, fhempy-docker, WebAuth, fhem-mcp, midea-mqtt, whatsmeow-mqtt, alexa-cookie-service
https://github.com/sidey79?tab=repositories