Node-Red Flow für Govee W-LAN Geräte

Dein Gerät ist aber controllable?

Hatte heut nun endlich Zeit mich damit weiter zu beschäftigen, alles prima geklappt. Den fehlenden Node Typ über die Palette installiert und dann im Flow noch den Api Key eingefügt. Danke! :cowboy_hat_face:

Hi, nun habe ich ein zweites, gleiches Govee Gerät…wo im Flow kann ich eigentlich einstellen welches angesprochen wird? :thinking:

@Dante und @Micha ,ihr habt doch da bestimmt ne Lösung :cowboy_hat_face:

Hatte mich das damals bei ersten schon gefragt…aber erfolgreich verdrängt :see_no_evil:

VG
Andi

Wenn du deine Devices abfragst dann gibt es dort ein Array mit den Geräten, diese musst du dann natürlich noch zuordnen.

Wenn du da nicht weiter kommst dann melde dich ruhig per PN und wir schauen drüber.

1 „Gefällt mir“

Perfekt, Danke für den Wink :+1: Schönen ersten Advent noch! :evergreen_tree:

VG
Andi

@Micha hatte die Lösung, bei mehreren Geräten müssen

image
und
image
bearbeitet werden.

Gerät 1

Gerät 2

Tausend Dank @Micha :blush: :muscle:

1 „Gefällt mir“

Das war für deinen Fall die schnellste und einfachste Lösung.
Es geht auch ordentlich in einem FlowKontext in dem man das Device Array speichert.
Da ich aber das selber nicht nutze, habe ich das auf die Schnelle nicht umgesetzt.

1 „Gefällt mir“

Hallo zusammen,

ich habe meinen Govee LED-Streifen H6143 mit dem Flow zum Laufen gebracht, danke Dante!
Nun kann ich mit meinem Homee die vier Attribute steuern: An/Aus, Dimmung, Farbe, Farbtemperatur. Jetzt habe ich zwei Probleme:

  1. Im Browser klappt das steuern. In der Android App, wenn ich zur Geräteübersicht wechsle (ohne die Leiste auch nur auszuwählen), sendet die App plötzlich unglaublich schnell ganz viele Anfragen an die LED-Leiste, sodass diese dann alle weiteren Anfragen erst einmal ablehnt (max. 100 Anfragen je Minute laut Hersteller). Kennt jemand eine Lösung dafür?
  2. Wenn ich im Browser z.B. die Farbe der Leiste verstelle, geht diese an. Der Status des Gerätes bleibt auf „Aus“. Kennt auch dafür jemand eine Lösung?

Probier mal diese rbe nodes in deinem Flow bevor die Anfrage vom homee an deine Govee schickst.

Also so wie ich die Node eingebunden habe, hat es nichts gebracht :smiley: bin allerdings absoluter Node-Red Neuling und habe vielleicht grobe Fehler drin?

Das sieht auch sehr verwirrend aus :see_no_evil:
Stell doch mal den Flow als Code ein.
Dann kann man dir evt. helfen.
Ich würde mal einen Debug vor das jeweilige http node hängen und schauen an welche Stelle da sinnlos getriggert wird und was diese Triggerung auslöst.
VG

Seh ich den Wald vor lauter Bäumen nicht oder muß ich das selber per Mail anfragen?

Ja, selber über die App. Ist zum Beispiel hier beschrieben, wie man das anfordert:

2 „Gefällt mir“

Hier erstmal der Code. Danke schonmal fürs Helfen :slight_smile: Debug wie von dir beschrieben werde ich noch prüfen.

[
{
„id“: „f03f70ccf00004db“,
„type“: „tab“,
„label“: „Flurleiste_v2“,
„disabled“: false,
„info“: „“,
„env“: []
},
{
„id“: „43e35fb99903c6b8“,
„type“: „homeeDevice“,
„z“: „f03f70ccf00004db“,
„virtual-homee“: „“,
„name“: „Flurleiste“,
„nodeId“: „3010“,
„showNodeId“: true,
„profile“: „1002“,
„icon“: „default“,
„attributes“: [
{
„type“: 1,
„state“: 1,
„instance“: 0,
„minimum“: 0,
„maximum“: 1,
„current_value“: 0,
„target_value“: 0,
„last_value“: 0,
„data“: „“,
„name“: „“,
„unit“: „“,
„step_value“: 1,
„editable“: 1,
„last_changed“: 1629185262,
„changed_by“: 1,
„changed_by_id“: 0,
„based_on“: 1,
„options“: [],
„id“: „3010“,
„node_id“: „3010“
},
{
„type“: 2,
„state“: 1,
„instance“: 0,
„minimum“: 10,
„maximum“: 100,
„current_value“: 0,
„target_value“: 0,
„last_value“: 0,
„data“: „“,
„name“: „“,
„unit“: „“,
„step_value“: 10,
„editable“: 1,
„last_changed“: 1629185270,
„changed_by“: 1,
„changed_by_id“: 0,
„based_on“: 1,
„options“: [],
„id“: „3011“,
„node_id“: „3010“
},
{
„type“: 23,
„state“: 1,
„instance“: 0,
„minimum“: 0,
„maximum“: 16777215,
„current_value“: 0,
„target_value“: 0,
„last_value“: 0,
„data“: „“,
„name“: „“,
„unit“: „“,
„step_value“: 1,
„editable“: 1,
„last_changed“: 1641726143,
„changed_by“: 1,
„changed_by_id“: 0,
„based_on“: 1,
„options“: [],
„id“: „3012“,
„node_id“: „3010“
},
{
„type“: 42,
„state“: 1,
„instance“: 0,
„minimum“: 2000,
„maximum“: 9000,
„current_value“: 0,
„target_value“: 0,
„last_value“: 0,
„data“: „“,
„name“: „“,
„unit“: „K“,
„step_value“: 500,
„editable“: 1,
„last_changed“: 1641742603,
„changed_by“: 1,
„changed_by_id“: 0,
„based_on“: 1,
„options“: [],
„id“: „3013“,
„node_id“: „3010“
}
],
„statusTemplate“: „“,
„x“: 140,
„y“: 120,
„wires“: [
[
„e6bc3b5fa17a1cb9“,
„0238cdff87610fbe“
]
]
},
{
„id“: „003806a7590f2a77“,
„type“: „homeeApi“,
„z“: „f03f70ccf00004db“,
„homee“: „“,
„name“: „homeeApi“,
„messageTypeFilter“: [],
„nodeFilter“: „“,
„attributeFilter“: „“,
„x“: 80,
„y“: 40,
„wires“: [
[]
]
},
{
„id“: „513ab3e790d8b0d7“,
„type“: „http request“,
„z“: „f03f70ccf00004db“,
„name“: „GET Devices“,
„method“: „GET“,
„ret“: „txt“,
„paytoqs“: „ignore“,
„url“: „https://developer-api.govee.com/v1/devices“,
„tls“: „c0d5cbd90049e294“,
„persist“: false,
„proxy“: „“,
„authType“: „“,
„x“: 730,
„y“: 240,
„wires“: [
[
„c66fdf5c6b0f41de“,
„2f5379126ad4a66f“
]
],
„info“: „Govee-API-Key: XXX“
},
{
„id“: „fe9bea8e7e097b32“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Delete“,
„rules“: [
{
„t“: „delete“,
„p“: „payload“,
„pt“: „msg“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 510,
„y“: 160,
„wires“: [
[
„a1fd592341579ec2“
]
]
},
{
„id“: „a1fd592341579ec2“,
„type“: „credentials“,
„z“: „f03f70ccf00004db“,
„name“: „API hier eingeben“,
„props“: [
{
„value“: „payload.API“,
„type“: „msg“
}
],
„x“: 670,
„y“: 160,
„wires“: [
[
„27e9a375f86c9882“
]
]
},
{
„id“: „27e9a375f86c9882“,
„type“: „function“,
„z“: „f03f70ccf00004db“,
„name“: „Set API“,
„func“: „var Govee;\n\nGovee = {\n// „Govee-API-Key“ : msg.API,\n „headers“ : {\n „ContentType“ : „application/json; charset=utf-8“,\n// „Accept“ : „application/json“,\n// „Culture“ : „en“,\n „Govee-API-Key“ : msg.payload.API\n }\n };\n\n//flow.set(„Govee“,Govee);\nmsg.Govee = Govee;\nmsg.headers = Govee.headers;\n\nreturn msg;“,
„outputs“: 1,
„noerr“: 0,
„initialize“: „“,
„finalize“: „“,
„libs“: [],
„x“: 840,
„y“: 160,
„wires“: [
[
„513ab3e790d8b0d7“
]
]
},
{
„id“: „c66fdf5c6b0f41de“,
„type“: „json“,
„z“: „f03f70ccf00004db“,
„name“: „“,
„property“: „payload“,
„action“: „“,
„pretty“: false,
„x“: 870,
„y“: 240,
„wires“: [
[
„6e4853ee497cd2c5“
]
]
},
{
„id“: „41dec79d5a6fa3c6“,
„type“: „http request“,
„z“: „f03f70ccf00004db“,
„name“: „Control“,
„method“: „PUT“,
„ret“: „txt“,
„paytoqs“: „ignore“,
„url“: „https://developer-api.govee.com/v1/devices/control“,
„tls“: „c0d5cbd90049e294“,
„persist“: false,
„proxy“: „“,
„authType“: „“,
„x“: 1160,
„y“: 600,
„wires“: [
[]
]
},
{
„id“: „6e4853ee497cd2c5“,
„type“: „function“,
„z“: „f03f70ccf00004db“,
„name“: „Setze Device/Model“,
„func“: „var Govee = msg.Govee;\n\nif(msg.statusCode == 200 && msg.payload.data.devices[0].device && msg.payload.data.devices[0].model) {\n Govee.device = msg.payload.data.devices[0].device,\n Govee.model = msg.payload.data.devices[0].model\n\n flow.set(„Govee“, Govee);\n msg.payload = Govee;\n msg.headers = msg.Govee.headers;\n msg.payload={};\n\n return msg;\n} else {\n return null;\n}“,
„outputs“: 1,
„noerr“: 0,
„initialize“: „“,
„finalize“: „“,
„libs“: [],
„x“: 1060,
„y“: 240,
„wires“: [
[]
]
},
{
„id“: „61b19f785646960a“,
„type“: „function“,
„z“: „f03f70ccf00004db“,
„name“: „Hole Device/Model“,
„func“: „var Govee = flow.get(„Govee“);\nvar RequestBody;\n\nRequestBody = {\n „device“ : 1,\n „model“ : 1,\n „cmd“ : {\n „name“ : msg.topic,\n „value“ : msg.payload\n }\n };\n\n\nif(Govee && Govee.device && Govee.model) {\n msg.Govee = Govee;\n msg.headers = Govee.headers;\n msg.payload = RequestBody;\n return msg;\n} else {\n return null;\n}\n“,
„outputs“: 1,
„noerr“: 0,
„initialize“: „“,
„finalize“: „“,
„libs“: [],
„x“: 850,
„y“: 600,
„wires“: [
[
„54d7e1bbf7562207“
]
]
},
{
„id“: „54d7e1bbf7562207“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Setze Device/Model“,
„rules“: [
{
„t“: „move“,
„p“: „Govee.device“,
„pt“: „msg“,
„to“: „payload.device“,
„tot“: „msg“
},
{
„t“: „move“,
„p“: „Govee.model“,
„pt“: „msg“,
„to“: „payload.model“,
„tot“: „msg“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 940,
„y“: 700,
„wires“: [
[
„41dec79d5a6fa3c6“,
„6dcd439a307ef793“
]
]
},
{
„id“: „c4db07586119c203“,
„type“: „switch“,
„z“: „f03f70ccf00004db“,
„name“: „“,
„property“: „payload.attributeId“,
„propertyType“: „msg“,
„rules“: [
{
„t“: „eq“,
„v“: „3010“,
„vt“: „str“
},
{
„t“: „eq“,
„v“: „3011“,
„vt“: „str“
},
{
„t“: „eq“,
„v“: „3012“,
„vt“: „str“
},
{
„t“: „eq“,
„v“: „3013“,
„vt“: „str“
}
],
„checkall“: „true“,
„repair“: false,
„outputs“: 4,
„x“: 170,
„y“: 420,
„wires“: [
[
„b5bd80659c6f1f1c“
],
[
„90c531680471dd17“
],
[
„ac7af7862fd13cf0“
],
[
„c94ef1ba765d49fe“
]
]
},
{
„id“: „b5bd80659c6f1f1c“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Topic=Turn“,
„rules“: [
{
„t“: „set“,
„p“: „topic“,
„pt“: „msg“,
„to“: „turn“,
„tot“: „str“
},
{
„t“: „change“,
„p“: „payload.targetValue“,
„pt“: „msg“,
„from“: „0“,
„fromt“: „num“,
„to“: „off“,
„tot“: „str“
},
{
„t“: „change“,
„p“: „payload.targetValue“,
„pt“: „msg“,
„from“: „1“,
„fromt“: „num“,
„to“: „on“,
„tot“: „str“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 350,
„y“: 360,
„wires“: [
[
„2fa10c51a0e2259a“
]
]
},
{
„id“: „90c531680471dd17“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Topic=Brightness“,
„rules“: [
{
„t“: „set“,
„p“: „topic“,
„pt“: „msg“,
„to“: „brightness“,
„tot“: „str“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 370,
„y“: 400,
„wires“: [
[
„2fa10c51a0e2259a“
]
]
},
{
„id“: „2fa10c51a0e2259a“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Setze Value“,
„rules“: [
{
„t“: „move“,
„p“: „payload.targetValue“,
„pt“: „msg“,
„to“: „payload“,
„tot“: „msg“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 670,
„y“: 420,
„wires“: [
[
„61b19f785646960a“
]
]
},
{
„id“: „c94ef1ba765d49fe“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Topic=colorTem“,
„rules“: [
{
„t“: „set“,
„p“: „topic“,
„pt“: „msg“,
„to“: „colorTem“,
„tot“: „str“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 380,
„y“: 900,
„wires“: [
[
„2fa10c51a0e2259a“
]
]
},
{
„id“: „e6bc3b5fa17a1cb9“,
„type“: „debug“,
„z“: „f03f70ccf00004db“,
„name“: „“,
„active“: false,
„tosidebar“: true,
„console“: false,
„tostatus“: false,
„complete“: „true“,
„targetType“: „full“,
„statusVal“: „“,
„statusType“: „auto“,
„x“: 510,
„y“: 80,
„wires“: []
},
{
„id“: „ac7af7862fd13cf0“,
„type“: „function“,
„z“: „f03f70ccf00004db“,
„name“: „Decimal_to_Hex“,
„func“: „if (msg.payload.attributeId === 3012){\nvar zahl= msg.payload.targetValue;\nvar ausgabe =“";\nrest(i = zahl%16);\nzahl6 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl5 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl4 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl3 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl%16);\nzahl2 = ausgabe;\nzahl = Math.floor(zahl/16);\nrest(i = zahl);\nzahl1 = ausgabe;\n\nausgabe2 = zahl1+zahl2+zahl3+zahl4+zahl5+zahl6;\n node.send({payload:{„hex“:ausgabe2}});\n}\n\nfunction rest(){\n switch(i)\n\t\t{\n\t\t \n\t\tcase 1: ausgabe =„1“;break;\n\t\tcase 2: ausgabe =„2“;break;\n\t\tcase 3: ausgabe = „3“;break;\n\t\tcase 4: ausgabe= „4“;break;\n\t\tcase 5: ausgabe= „5“;break;\n\t\tcase 6: ausgabe = „6“;break;\n\t\tcase 7: ausgabe =„7“;break; \n\t\tcase 8: ausgabe = „8“;break;\n\t\tcase 9: ausgabe = „9“;break;\n\t\tcase 10: ausgabe =„A“; break;\n\t\tcase 11: ausgabe = „B“; break;\n\t\tcase 12: ausgabe = „C“; break;\n\t\tcase 13: ausgabe =„D“; break;\n\t\tcase 14: ausgabe =„E“; break;\n\t\tcase 15: ausgabe =„F“; break;\n}}",
„outputs“: 1,
„noerr“: 0,
„initialize“: „“,
„finalize“: „“,
„libs“: [],
„x“: 360,
„y“: 460,
„wires“: [
[
„2071cca8e1e8c82d“
]
]
},
{
„id“: „6dcd439a307ef793“,
„type“: „debug“,
„z“: „f03f70ccf00004db“,
„name“: „roh“,
„active“: true,
„tosidebar“: true,
„console“: false,
„tostatus“: false,
„complete“: „payload“,
„targetType“: „msg“,
„statusVal“: „“,
„statusType“: „auto“,
„x“: 1090,
„y“: 380,
„wires“: []
},
{
„id“: „c45792cc3ee03e04“,
„type“: „color-convert“,
„z“: „f03f70ccf00004db“,
„input“: „hex“,
„output“: „rgb“,
„outputType“: „object“,
„scaleInput“: false,
„x“: 370,
„y“: 580,
„wires“: [
[
„aae48fe76625d1fe“
]
]
},
{
„id“: „880564b3a7a1b5be“,
„type“: „debug“,
„z“: „f03f70ccf00004db“,
„name“: „RGB“,
„active“: false,
„tosidebar“: true,
„console“: false,
„tostatus“: false,
„complete“: „payload“,
„targetType“: „msg“,
„statusVal“: „“,
„statusType“: „auto“,
„x“: 410,
„y“: 780,
„wires“: []
},
{
„id“: „2071cca8e1e8c82d“,
„type“: „function“,
„z“: „f03f70ccf00004db“,
„name“: „toString“,
„func“: „msg.payload = „#“ + msg.payload.hex;\nreturn msg;“,
„outputs“: 1,
„noerr“: 0,
„initialize“: „“,
„finalize“: „“,
„libs“: [],
„x“: 360,
„y“: 520,
„wires“: [
[
„c45792cc3ee03e04“
]
]
},
{
„id“: „b2b095151804708d“,
„type“: „change“,
„z“: „f03f70ccf00004db“,
„name“: „Topic=color“,
„rules“: [
{
„t“: „set“,
„p“: „topic“,
„pt“: „msg“,
„to“: „color“,
„tot“: „str“
}
],
„action“: „“,
„property“: „“,
„from“: „“,
„to“: „“,
„reg“: false,
„x“: 370,
„y“: 720,
„wires“: [
[
„880564b3a7a1b5be“,
„61b19f785646960a“
]
]
},
{
„id“: „aae48fe76625d1fe“,
„type“: „function“,
„z“: „f03f70ccf00004db“,
„name“: „“,
„func“: „var names = [„r“,„g“,„b“];// list of names\nvar hold_obj = {};// `temp object\nnames.forEach ((v,i) => hold_obj[v] = msg.payload[i]) //loop through names and add to object\nmsg.payload = hold_obj; // move back to payload\nreturn msg;“,
„outputs“: 1,
„noerr“: 0,
„initialize“: „“,
„finalize“: „“,
„libs“: [],
„x“: 360,
„y“: 640,
„wires“: [
[
„b2b095151804708d“
]
]
},
{
„id“: „2f5379126ad4a66f“,
„type“: „debug“,
„z“: „f03f70ccf00004db“,
„name“: „debug“,
„active“: false,
„tosidebar“: true,
„console“: false,
„tostatus“: false,
„complete“: „payload“,
„targetType“: „msg“,
„statusVal“: „“,
„statusType“: „auto“,
„x“: 850,
„y“: 300,
„wires“: []
},
{
„id“: „0238cdff87610fbe“,
„type“: „rbe“,
„z“: „f03f70ccf00004db“,
„name“: „Blocker“,
„func“: „rbe“,
„gap“: „“,
„start“: „“,
„inout“: „out“,
„septopics“: true,
„property“: „payload“,
„topi“: „topic“,
„x“: 320,
„y“: 160,
„wires“: [
[
„c4db07586119c203“,
„fe9bea8e7e097b32“
]
]
},
{
„id“: „c0d5cbd90049e294“,
„type“: „tls-config“,
„name“: „TLS Config Generic“,
„cert“: „“,
„key“: „“,
„ca“: „“,
„certname“: „“,
„keyname“: „“,
„caname“: „“,
„servername“: „“,
„verifyservercert“: true
}
]

Sehr versteckt… danke…

Ich stell morgen mal den von @Micha optimierten Flow ein, eventuell hilft es ja :slight_smile:
VG Andi :cowboy_hat_face:

2 „Gefällt mir“

Bitte formatiere den Code mit dem </> Button.

So ist das echt unübersichtlich🙈

Ähhhh, kann es sein, das die API nur mit Internet funktioniert? :frowning:

Ja das war wohl so. Bin mir da aber jetzt nicht 100%ig sicher.

1 „Gefällt mir“

Schade, dann bin ich da raus :frowning:
Aber trotzdem toller Flow… :+1: