@pmayer einmal mehr, du bist mein Held!
Es funzt!!! Wenn ich den Max! Fensterkontakt “ECO Switch” betätige, druckt der Kassenbondrucker einen Beleg mit dem Titel!
Bugs:
- Current_Album konnte ich noch nicht integrieren: Wie lese ich den 2. Eingang der Function-Node ein?
- Wenn sich in der SONOS Node der Wert ändert, so lösst dies einen Druck aus, ohne dass der Button betätigt wurde!
- Umlaute werden nicht korekt gedruckt.
Inhalt der Function-Node:
$str = "Titel: ".$message['payload'] .chr(0x0a); // Print Title
$str .= "Album: ".$message['payload'] .chr(0x0a); // Print Album
$str .= chr(0x0A).chr(0x0A); // Linefeed
$str .= chr(0x1D).chr(0x56).chr(0x41); // Fullcut
$str .= chr(0x0A); // Linefeed
$message['payload'] = $str;
return $message;
Komplette Node:
[
{
"id": "f04ff0c2.31d468",
"type": "function",
"namespace": "function",
"z": "90f14a29.01fde8",
"name": "",
"func": "$str = \"Titel: \".$message['payload'] .chr(0x0a); // Print Title\n$str .= \"Album: \".$message['payload'] .chr(0x0a); // Print Album\n$str .= chr(0x0A).chr(0x0A); // Linefeed\n$str .= chr(0x1D).chr(0x56).chr(0x41); // Fullcut\n$str .= chr(0x0A); // Linefeed\n$message['payload'] = $str;\nreturn $message;",
"inputs": "2",
"outputs": 1,
"noerr": 0,
"x": 370,
"y": 340,
"wires": [
[
{
"id": "759dbd53.5521fc",
"port": 0
},
{
"id": "29206ee2.22a3a2",
"port": 0
}
]
]
},
{
"id": "e0f0f8e8.7c1f68",
"type": "variable-in",
"namespace": "variable",
"z": "90f14a29.01fde8",
"variabletype": "device",
"family": "4",
"peername": "Fensterkontakt_01",
"peerid": "36",
"channel": "1",
"variable": "STATE",
"eventsource": "all",
"refractoryperiod": "0",
"outputonstartup": false,
"changes-only": false,
"loopprevention": false,
"looppreventiongroup": "",
"name": "ECO Switch 01: AUTO",
"x": 110,
"y": 120,
"wires": [
[
{
"id": "eda85526.e3ba4",
"port": 0
},
{
"id": "f7e84cee.2556a8",
"port": 0
}
]
]
},
{
"id": "d332d2a8.c976b",
"type": "constant",
"namespace": "variable",
"z": "90f14a29.01fde8",
"name": "",
"payload": "true",
"payloadType": "bool",
"outputonstartup": false,
"x": 140,
"y": 200,
"wires": [
[
{
"id": "eda85526.e3ba4",
"port": 0
},
{
"id": "f7e84cee.2556a8",
"port": 0
}
]
]
},
{
"id": "759dbd53.5521fc",
"type": "serial-out",
"namespace": "serial",
"z": "90f14a29.01fde8",
"name": "",
"serial": "a71140d0.4aa2",
"x": 555,
"y": 310,
"wires": []
},
{
"id": "29206ee2.22a3a2",
"type": "debug",
"namespace": "debug",
"z": "90f14a29.01fde8",
"name": "",
"active": true,
"console": "debtab",
"complete": "true",
"loglevel": "info",
"x": 550,
"y": 360,
"wires": []
},
{
"id": "eda85526.e3ba4",
"type": "variable-in",
"namespace": "variable",
"z": "90f14a29.01fde8",
"variabletype": "device",
"family": "6",
"peername": "Sonos_Kueche",
"peerid": "32",
"channel": "1",
"variable": "CURRENT_TITLE",
"eventsource": "all",
"refractoryperiod": "0",
"outputonstartup": false,
"changes-only": false,
"loopprevention": false,
"looppreventiongroup": "",
"name": "",
"x": 420,
"y": 140,
"wires": [
[
{
"id": "f04ff0c2.31d468",
"port": 0
}
]
]
},
{
"id": "f7e84cee.2556a8",
"type": "variable-in",
"namespace": "variable",
"z": "90f14a29.01fde8",
"variabletype": "device",
"family": "6",
"peername": "Sonos_Kueche",
"peerid": "32",
"channel": "1",
"variable": "CURRENT_ALBUM",
"eventsource": "all",
"refractoryperiod": "0",
"outputonstartup": false,
"changes-only": false,
"loopprevention": false,
"looppreventiongroup": "",
"name": "",
"x": 425,
"y": 180,
"wires": [
[
{
"id": "f04ff0c2.31d468",
"port": 1
}
]
]
},
{
"id": "a71140d0.4aa2",
"type": "serial-port",
"namespace": "serial",
"z": "",
"serialport": "/dev/ttyUSB0",
"serialbaud": "9600",
"databits": "8",
"parity": "none",
"stopbits": "1",
"newline": "\\n",
"bin": "false",
"out": "char",
"addchar": true
}
]