NEWS
[gelöst] You are assigning a undefined to the
-
Tut mir leid, ich muss nochmal fragen,
ich verstehe es nicht.Volume kann ich fehlerfrei abfragen, bei artist ( oder ähnlichem ) meckert er.
Volume ist ne Zahl, artist ein String.
Aber zum Zeitpunkt der Abfrage ist artist auch nicht NULL oderso,
aber ich kann die Fehlermeldung nicht richtig einordnen.var value = obj.state.val; var oldValue = obj.oldState.val; var tablet; var wohnl; try { require("request")('http://192.168.178.56:5005/tablet/state/', function (error, response, result) { tablet = JSON.parse(result); setState("javascript.0.sonos.tabletvol", tablet.volume); setState("javascript.0.sonos.artist", tablet.artist); }).on("error", function (e) {console.error(e);}); } catch (e) { console.error(e); }
im Log
You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined. This warning might become an
da kommen die Daten her :

-
Tut mir leid, ich muss nochmal fragen,
ich verstehe es nicht.Volume kann ich fehlerfrei abfragen, bei artist ( oder ähnlichem ) meckert er.
Volume ist ne Zahl, artist ein String.
Aber zum Zeitpunkt der Abfrage ist artist auch nicht NULL oderso,
aber ich kann die Fehlermeldung nicht richtig einordnen.var value = obj.state.val; var oldValue = obj.oldState.val; var tablet; var wohnl; try { require("request")('http://192.168.178.56:5005/tablet/state/', function (error, response, result) { tablet = JSON.parse(result); setState("javascript.0.sonos.tabletvol", tablet.volume); setState("javascript.0.sonos.artist", tablet.artist); }).on("error", function (e) {console.error(e);}); } catch (e) { console.error(e); }
im Log
You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined. This warning might become an
da kommen die Daten her :

-
@skokarl Bist du sicher das Artist im JSON ein String ist ?
Setz doch mal den State nicht mit tablet.artist sondern mit JSON.stringify(Tablet.
A.
das ist ja ne coole Idee, hab ich gar nicht dran gedacht.
Probiere ich sobald ich wieder zu Hause bin.Aber wenn kein String was könnte es sonst sein ??
-
das ist ja ne coole Idee, hab ich gar nicht dran gedacht.
Probiere ich sobald ich wieder zu Hause bin.Aber wenn kein String was könnte es sonst sein ??
-
@skokarl meine Vermutung: ein Array, für den Fall das ein Musikstück von 2 Künstlern zusammen gespielt wird.
A.
-
-
@skokarl
Da fehlt eine ) am Ende.setState("javascript.0.sonos.artist", JSON.stringify(tablet.artist));A.
Wie blöd, Sorry.
Ne, geht trotzdem nicht. Ich werd weich.
setState("javascript.0.sonos.artist", JSON.stringify(tablet.artist));14:43:33.136 warn javascript.0 at Request._callback (script.js.sonos.sonos_state:28:15)LOG :
javascript.0 2019-08-25 14:43:33.131 warn at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:185:22) javascript.0 2019-08-25 14:43:33.131 warn at Request._callback (script.js.sonos.sonos_state:28:15) javascript.0 2019-08-25 14:43:33.131 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1276:20) javascript.0 2019-08-25 14:43:33.130 warn You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined. -
Wie blöd, Sorry.
Ne, geht trotzdem nicht. Ich werd weich.
setState("javascript.0.sonos.artist", JSON.stringify(tablet.artist));14:43:33.136 warn javascript.0 at Request._callback (script.js.sonos.sonos_state:28:15)LOG :
javascript.0 2019-08-25 14:43:33.131 warn at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:185:22) javascript.0 2019-08-25 14:43:33.131 warn at Request._callback (script.js.sonos.sonos_state:28:15) javascript.0 2019-08-25 14:43:33.131 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1276:20) javascript.0 2019-08-25 14:43:33.130 warn You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined. -
Wie blöd, Sorry.
Ne, geht trotzdem nicht. Ich werd weich.
setState("javascript.0.sonos.artist", JSON.stringify(tablet.artist));14:43:33.136 warn javascript.0 at Request._callback (script.js.sonos.sonos_state:28:15)LOG :
javascript.0 2019-08-25 14:43:33.131 warn at Request.self.callback (/opt/iobroker/node_modules/iobroker.javascript/node_modules/request/request.js:185:22) javascript.0 2019-08-25 14:43:33.131 warn at Request._callback (script.js.sonos.sonos_state:28:15) javascript.0 2019-08-25 14:43:33.131 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1276:20) javascript.0 2019-08-25 14:43:33.130 warn You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined. -
Tut mir leid, ich muss nochmal fragen,
ich verstehe es nicht.Volume kann ich fehlerfrei abfragen, bei artist ( oder ähnlichem ) meckert er.
Volume ist ne Zahl, artist ein String.
Aber zum Zeitpunkt der Abfrage ist artist auch nicht NULL oderso,
aber ich kann die Fehlermeldung nicht richtig einordnen.var value = obj.state.val; var oldValue = obj.oldState.val; var tablet; var wohnl; try { require("request")('http://192.168.178.56:5005/tablet/state/', function (error, response, result) { tablet = JSON.parse(result); setState("javascript.0.sonos.tabletvol", tablet.volume); setState("javascript.0.sonos.artist", tablet.artist); }).on("error", function (e) {console.error(e);}); } catch (e) { console.error(e); }
im Log
You are assigning a undefined to the state "javascript.0.sonos.artist" which expects a string. Please fix your code to use a string or change the state type to undefined. This warning might become an
da kommen die Daten her :

-
Hallo Paul, meine Frau fragt gerade ob Du eigentlich manchmal denkst was für Vollpfosten hier fragen ....

Ich war eben noch am schreiben als Deine Antwort kam,
und wollte Dich fragen ob es sowas wie Untervariablen in Javascript gibt.Ich hatte mir die Daten nochmal mit der http Adresse angesehen und da ist mir auch
aufgefallen das Volume in der "root" ist, artist oder stationName aber nicht...Geht. Vielen lieben Dank.
Hey! Du scheinst an dieser Unterhaltung interessiert zu sein, hast aber noch kein Konto.
Hast du es satt, bei jedem Besuch durch die gleichen Beiträge zu scrollen? Wenn du dich für ein Konto anmeldest, kommst du immer genau dorthin zurück, wo du zuvor warst, und kannst dich über neue Antworten benachrichtigen lassen (entweder per E-Mail oder Push-Benachrichtigung). Du kannst auch Lesezeichen speichern und Beiträge positiv bewerten, um anderen Community-Mitgliedern deine Wertschätzung zu zeigen.
Mit deinem Input könnte dieser Beitrag noch besser werden 💗
Registrieren Anmelden
