Phono adaption gfw/dirk

This commit is contained in:
Dirk Alders 2025-06-15 15:30:50 +02:00
parent fef006f9c8
commit 461c608686
4 changed files with 178 additions and 15 deletions

View File

@ -17,8 +17,10 @@
} }
}, },
"debug": { "debug": {
"filter": "filterCurrent", "filter": "filterSelected",
"filteredNodes": [], "filteredNodes": [
"8f36fe00cbd87c8b"
],
"clearType": "all" "clearType": "all"
}, },
"menu-menu-item-sidebar": true, "menu-menu-item-sidebar": true,

View File

@ -17,9 +17,12 @@
} }
}, },
"debug": { "debug": {
"filter": "filterCurrent", "filter": "filterSelected",
"filteredNodes": [], "filteredNodes": [
"clearType": "filtered" "9a65295b93ac3155",
"8f36fe00cbd87c8b"
],
"clearType": "all"
}, },
"menu-menu-item-sidebar": true, "menu-menu-item-sidebar": true,
"menu-menu-item-palette": true "menu-menu-item-palette": true

View File

@ -1457,7 +1457,7 @@
"name": "", "name": "",
"group": "8bb63e2d106e61a9", "group": "8bb63e2d106e61a9",
"order": 7, "order": 7,
"width": "4", "width": "2",
"height": "1", "height": "1",
"passthru": false, "passthru": false,
"label": "", "label": "",
@ -2790,11 +2790,11 @@
"type": "function", "type": "function",
"z": "8e9c7f123e3fa72b", "z": "8e9c7f123e3fa72b",
"name": "ButtonCtrl", "name": "ButtonCtrl",
"func": "if (msg.topic != topic_tx_request)\n{\n // Inputs \n if (debug_input) node.warn(\"Topic = \" + msg.topic)\n /*\n * POWER\n */\n if (msg.topic == topic_power)\n {\n if (debug_input) node.warn(\"Received Power signal = \" + msg.payload)\n state_power = msg.payload\n }\n /*\n * SOURCE CD\n */\n if (msg.topic == topic_cd)\n {\n if (debug_input) node.warn(\"Received source to CD\")\n state_changed |= state_source != \"cd\"\n state_source = \"cd\"\n }\n /*\n * SOURCE AG03\n */\n if (msg.topic == topic_ag03)\n {\n if (debug_input) node.warn(\"Received source to AG03\")\n state_changed |= state_source != \"ag03\"\n state_source = \"ag03\"\n }\n /*\n * SOURCE RASPI\n */\n if (msg.topic == topic_raspi)\n {\n if (debug_input) node.warn(\"Received source to RASPI\")\n state_changed |= state_source != \"raspi\"\n state_source = \"raspi\"\n }\n /*\n * SOURCE PHONO\n */\n if (msg.topic == topic_phono)\n {\n if (debug_input) node.warn(\"Received source to PHONO\")\n state_changed |= state_source != \"phono\"\n state_source = \"phono\"\n }\n}\nelse\n{\n /*\n * Enabled\n */\n if (!state_power)\n {\n state_changed |= state_enabled \n state_enabled = false\n tm = null\n }\n else\n {\n if (tm == null)\n {\n tm = msg.payload\n }\n if (msg.payload - tm > 1000)\n {\n state_changed |= !state_enabled \n state_enabled = true\n }\n }\n \n if (state_changed){\n if (debug_tx) node.error(\"State is changed. Sending out messages\")\n if (debug_tx) node.warn(\"Power = \" + state_power)\n if (debug_tx) node.warn(\"Source = \" + state_source)\n state_changed = false\n /*\n * Uncolored Buttons\n */\n var msg_other = { topic: \"other\", enabled: state_enabled };\n /*\n * CD\n */\n if (state_source == \"cd\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_cd = { topic: \"cd\", enabled: state_enabled, background: background };\n /*\n * RASPI\n */\n if (state_source == \"raspi\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_raspi = { topic: \"raspi\", enabled: state_enabled, background: background };\n /*\n * PHONO\n */\n if (state_source == \"phono\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_phono = { topic: \"phono\", enabled: state_enabled, background: background };\n /*\n * AG03\n */\n if (state_source == \"ag03\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_ag03 = { topic: \"ag03\", enabled: state_enabled, background: background };\n //\n return [msg_other, msg_cd, msg_raspi, msg_phono, msg_ag03];\n }\n}", "func": "if (msg.topic != topic_tx_request)\n{\n // Inputs \n if (debug_input) node.warn(\"Topic = \" + msg.topic)\n /*\n * POWER\n */\n if (msg.topic == topic_power)\n {\n if (debug_input) node.warn(\"Received Power signal = \" + msg.payload)\n state_power = msg.payload\n }\n /*\n * SOURCE CD\n */\n if (msg.topic == topic_cd)\n {\n if (debug_input) node.warn(\"Received source to CD\")\n state_changed |= state_source != \"cd\"\n state_source = \"cd\"\n }\n /*\n * SOURCE AG03\n */\n if (msg.topic == topic_ag03)\n {\n if (debug_input) node.warn(\"Received source to AG03\")\n state_changed |= state_source != \"ag03\"\n state_source = \"ag03\"\n }\n /*\n * SOURCE RASPI\n */\n if (msg.topic == topic_raspi)\n {\n if (debug_input) node.warn(\"Received source to RASPI\")\n state_changed |= state_source != \"raspi\"\n state_source = \"raspi\"\n }\n /*\n * SOURCE BT\n */\n if (msg.topic == topic_bt)\n {\n if (debug_input) node.warn(\"Received source to BT\")\n state_changed |= state_source != \"bt\"\n state_source = \"bt\"\n }\n /*\n * SOURCE PHONO\n */\n if (msg.topic == topic_phono)\n {\n if (debug_input) node.warn(\"Received source to PHONO\")\n state_changed |= state_source != \"phono\"\n state_source = \"phono\"\n }\n}\nelse\n{\n /*\n * Enabled\n */\n if (!state_power)\n {\n state_changed |= state_enabled \n state_enabled = false\n tm = null\n }\n else\n {\n if (tm == null)\n {\n tm = msg.payload\n }\n if (msg.payload - tm > 1000)\n {\n state_changed |= !state_enabled \n state_enabled = true\n }\n }\n \n if (state_changed){\n if (debug_tx) node.error(\"State is changed. Sending out messages\")\n if (debug_tx) node.warn(\"Power = \" + state_power)\n if (debug_tx) node.warn(\"Source = \" + state_source)\n state_changed = false\n /*\n * Uncolored Buttons\n */\n var msg_other = { topic: \"other\", enabled: state_enabled };\n /*\n * CD\n */\n if (state_source == \"cd\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_cd = { topic: \"cd\", enabled: state_enabled, background: background };\n /*\n * RASPI\n */\n if (state_source == \"raspi\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_raspi = { topic: \"raspi\", enabled: state_enabled, background: background };\n /*\n * PHONO\n */\n if (state_source == \"bt\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_bt = { topic: \"bt\", enabled: state_enabled, background: background };\n if (state_source == \"phono\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_phono = { topic: \"phono\", enabled: state_enabled, background: background };\n /*\n * AG03\n */\n if (state_source == \"ag03\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_ag03 = { topic: \"ag03\", enabled: state_enabled, background: background };\n //\n return [msg_other, msg_cd, msg_raspi, msg_bt, msg_ag03, msg_phono];\n }\n}",
"outputs": 5, "outputs": 6,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
"initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ndebug_input = false\ndebug_tx = false\n//\ntopic_power = \"my_apps/gfw/dirk/powerplug/output/1\"\ntopic_cd = \"my_apps/gfw/dirk/remote_ctrl/RAS5/CD\"\ntopic_raspi = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE1\"\ntopic_phono = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE2\"\ntopic_ag03 = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE3\"\ntopic_tx_request = \"tx_request\"\n//\nstate_power = false\nstate_enabled = false\nstate_source = \"\"\nstate_changed = true\n//\ntm = null", "initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ndebug_input = false\ndebug_tx = false\n//\ntopic_power = \"my_apps/gfw/dirk/powerplug/output/1\"\ntopic_cd = \"my_apps/gfw/dirk/remote_ctrl/RAS5/CD\"\ntopic_raspi = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE1\"\ntopic_bt = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE2\"\ntopic_phono = \"my_apps/gfw/dirk/remote_ctrl/RAS5/PHONO\"\ntopic_ag03 = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE3\"\ntopic_tx_request = \"tx_request\"\n//\nstate_power = false\nstate_enabled = false\nstate_source = \"\"\nstate_changed = true\n//\ntm = null",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 600, "x": 600,
@ -2811,10 +2811,14 @@
"9e8359b1ca5e794c" "9e8359b1ca5e794c"
], ],
[ [
"fa0a223ba05e771a" "fa0a223ba05e771a",
"9a65295b93ac3155"
], ],
[ [
"a7ee780fe5879b1a" "a7ee780fe5879b1a"
],
[
"f46904eacb6aa8cd"
] ]
] ]
}, },
@ -3002,6 +3006,90 @@
"y": 1160, "y": 1160,
"wires": [] "wires": []
}, },
{
"id": "7766316408fa0521",
"type": "mqtt in",
"z": "8e9c7f123e3fa72b",
"name": "",
"topic": "my_apps/gfw/dirk/remote_ctrl/RAS5/PHONO",
"qos": "2",
"datatype": "json",
"broker": "f6f673e95e75873d",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 210,
"y": 2800,
"wires": [
[
"87fdd7ab519e84b8"
]
]
},
{
"id": "f46904eacb6aa8cd",
"type": "ui_button",
"z": "8e9c7f123e3fa72b",
"name": "",
"group": "8bb63e2d106e61a9",
"order": 4,
"width": "2",
"height": "1",
"passthru": false,
"label": "PHONO",
"tooltip": "",
"color": "",
"bgcolor": "{{msg.background}}",
"className": "",
"icon": "",
"payload": "true",
"payloadType": "bool",
"topic": "topic",
"topicType": "msg",
"x": 1120,
"y": 2800,
"wires": [
[
"44d87762f26fac90"
]
]
},
{
"id": "44d87762f26fac90",
"type": "mqtt out",
"z": "8e9c7f123e3fa72b",
"name": "",
"topic": "my_apps/gfw/dirk/remote_ctrl/RAS5/PHONO",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "f6f673e95e75873d",
"x": 1470,
"y": 2800,
"wires": []
},
{
"id": "9a65295b93ac3155",
"type": "debug",
"z": "8e9c7f123e3fa72b",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 2860,
"wires": []
},
{ {
"id": "3261d3bb95b50d09", "id": "3261d3bb95b50d09",
"type": "comment", "type": "comment",
@ -6308,7 +6396,7 @@
"topicType": "str", "topicType": "str",
"min": 0, "min": 0,
"max": "100", "max": "100",
"step": 1, "step": "5",
"className": "", "className": "",
"x": 660, "x": 660,
"y": 1600, "y": 1600,

View File

@ -1457,7 +1457,7 @@
"name": "", "name": "",
"group": "8bb63e2d106e61a9", "group": "8bb63e2d106e61a9",
"order": 7, "order": 7,
"width": "4", "width": "2",
"height": "1", "height": "1",
"passthru": false, "passthru": false,
"label": "", "label": "",
@ -2790,11 +2790,11 @@
"type": "function", "type": "function",
"z": "8e9c7f123e3fa72b", "z": "8e9c7f123e3fa72b",
"name": "ButtonCtrl", "name": "ButtonCtrl",
"func": "if (msg.topic != topic_tx_request)\n{\n // Inputs \n if (debug_input) node.warn(\"Topic = \" + msg.topic)\n /*\n * POWER\n */\n if (msg.topic == topic_power)\n {\n if (debug_input) node.warn(\"Received Power signal = \" + msg.payload)\n state_power = msg.payload\n }\n /*\n * SOURCE CD\n */\n if (msg.topic == topic_cd)\n {\n if (debug_input) node.warn(\"Received source to CD\")\n state_changed |= state_source != \"cd\"\n state_source = \"cd\"\n }\n /*\n * SOURCE AG03\n */\n if (msg.topic == topic_ag03)\n {\n if (debug_input) node.warn(\"Received source to AG03\")\n state_changed |= state_source != \"ag03\"\n state_source = \"ag03\"\n }\n /*\n * SOURCE RASPI\n */\n if (msg.topic == topic_raspi)\n {\n if (debug_input) node.warn(\"Received source to RASPI\")\n state_changed |= state_source != \"raspi\"\n state_source = \"raspi\"\n }\n /*\n * SOURCE PHONO\n */\n if (msg.topic == topic_phono)\n {\n if (debug_input) node.warn(\"Received source to PHONO\")\n state_changed |= state_source != \"phono\"\n state_source = \"phono\"\n }\n}\nelse\n{\n /*\n * Enabled\n */\n if (!state_power)\n {\n state_changed |= state_enabled \n state_enabled = false\n tm = null\n }\n else\n {\n if (tm == null)\n {\n tm = msg.payload\n }\n if (msg.payload - tm > 1000)\n {\n state_changed |= !state_enabled \n state_enabled = true\n }\n }\n \n if (state_changed){\n if (debug_tx) node.error(\"State is changed. Sending out messages\")\n if (debug_tx) node.warn(\"Power = \" + state_power)\n if (debug_tx) node.warn(\"Source = \" + state_source)\n state_changed = false\n /*\n * Uncolored Buttons\n */\n var msg_other = { topic: \"other\", enabled: state_enabled };\n /*\n * CD\n */\n if (state_source == \"cd\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_cd = { topic: \"cd\", enabled: state_enabled, background: background };\n /*\n * RASPI\n */\n if (state_source == \"raspi\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_raspi = { topic: \"raspi\", enabled: state_enabled, background: background };\n /*\n * PHONO\n */\n if (state_source == \"phono\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_phono = { topic: \"phono\", enabled: state_enabled, background: background };\n /*\n * AG03\n */\n if (state_source == \"ag03\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_ag03 = { topic: \"ag03\", enabled: state_enabled, background: background };\n //\n return [msg_other, msg_cd, msg_raspi, msg_phono, msg_ag03];\n }\n}", "func": "if (msg.topic != topic_tx_request)\n{\n // Inputs \n if (debug_input) node.warn(\"Topic = \" + msg.topic)\n /*\n * POWER\n */\n if (msg.topic == topic_power)\n {\n if (debug_input) node.warn(\"Received Power signal = \" + msg.payload)\n state_power = msg.payload\n }\n /*\n * SOURCE CD\n */\n if (msg.topic == topic_cd)\n {\n if (debug_input) node.warn(\"Received source to CD\")\n state_changed |= state_source != \"cd\"\n state_source = \"cd\"\n }\n /*\n * SOURCE AG03\n */\n if (msg.topic == topic_ag03)\n {\n if (debug_input) node.warn(\"Received source to AG03\")\n state_changed |= state_source != \"ag03\"\n state_source = \"ag03\"\n }\n /*\n * SOURCE RASPI\n */\n if (msg.topic == topic_raspi)\n {\n if (debug_input) node.warn(\"Received source to RASPI\")\n state_changed |= state_source != \"raspi\"\n state_source = \"raspi\"\n }\n /*\n * SOURCE BT\n */\n if (msg.topic == topic_bt)\n {\n if (debug_input) node.warn(\"Received source to BT\")\n state_changed |= state_source != \"bt\"\n state_source = \"bt\"\n }\n /*\n * SOURCE PHONO\n */\n if (msg.topic == topic_phono)\n {\n if (debug_input) node.warn(\"Received source to PHONO\")\n state_changed |= state_source != \"phono\"\n state_source = \"phono\"\n }\n}\nelse\n{\n /*\n * Enabled\n */\n if (!state_power)\n {\n state_changed |= state_enabled \n state_enabled = false\n tm = null\n }\n else\n {\n if (tm == null)\n {\n tm = msg.payload\n }\n if (msg.payload - tm > 1000)\n {\n state_changed |= !state_enabled \n state_enabled = true\n }\n }\n \n if (state_changed){\n if (debug_tx) node.error(\"State is changed. Sending out messages\")\n if (debug_tx) node.warn(\"Power = \" + state_power)\n if (debug_tx) node.warn(\"Source = \" + state_source)\n state_changed = false\n /*\n * Uncolored Buttons\n */\n var msg_other = { topic: \"other\", enabled: state_enabled };\n /*\n * CD\n */\n if (state_source == \"cd\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_cd = { topic: \"cd\", enabled: state_enabled, background: background };\n /*\n * RASPI\n */\n if (state_source == \"raspi\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_raspi = { topic: \"raspi\", enabled: state_enabled, background: background };\n /*\n * PHONO\n */\n if (state_source == \"bt\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_bt = { topic: \"bt\", enabled: state_enabled, background: background };\n if (state_source == \"phono\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_phono = { topic: \"phono\", enabled: state_enabled, background: background };\n /*\n * AG03\n */\n if (state_source == \"ag03\")\n {\n background = \"#257ce0\"\n }\n else\n {\n background = \"#007b6d\"\n \n }\n var msg_ag03 = { topic: \"ag03\", enabled: state_enabled, background: background };\n //\n return [msg_other, msg_cd, msg_raspi, msg_bt, msg_ag03, msg_phono];\n }\n}",
"outputs": 5, "outputs": 6,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
"initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ndebug_input = false\ndebug_tx = false\n//\ntopic_power = \"my_apps/gfw/dirk/powerplug/output/1\"\ntopic_cd = \"my_apps/gfw/dirk/remote_ctrl/RAS5/CD\"\ntopic_raspi = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE1\"\ntopic_phono = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE2\"\ntopic_ag03 = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE3\"\ntopic_tx_request = \"tx_request\"\n//\nstate_power = false\nstate_enabled = false\nstate_source = \"\"\nstate_changed = true\n//\ntm = null", "initialize": "// Der Code hier wird ausgeführt,\n// wenn der Node gestartet wird\ndebug_input = false\ndebug_tx = false\n//\ntopic_power = \"my_apps/gfw/dirk/powerplug/output/1\"\ntopic_cd = \"my_apps/gfw/dirk/remote_ctrl/RAS5/CD\"\ntopic_raspi = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE1\"\ntopic_bt = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE2\"\ntopic_phono = \"my_apps/gfw/dirk/remote_ctrl/RAS5/PHONO\"\ntopic_ag03 = \"my_apps/gfw/dirk/remote_ctrl/RAS5/LINE3\"\ntopic_tx_request = \"tx_request\"\n//\nstate_power = false\nstate_enabled = false\nstate_source = \"\"\nstate_changed = true\n//\ntm = null",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 600, "x": 600,
@ -2815,6 +2815,9 @@
], ],
[ [
"a7ee780fe5879b1a" "a7ee780fe5879b1a"
],
[
"f46904eacb6aa8cd"
] ]
] ]
}, },
@ -3002,6 +3005,73 @@
"y": 1160, "y": 1160,
"wires": [] "wires": []
}, },
{
"id": "7766316408fa0521",
"type": "mqtt in",
"z": "8e9c7f123e3fa72b",
"name": "",
"topic": "my_apps/gfw/dirk/remote_ctrl/RAS5/PHONO",
"qos": "2",
"datatype": "json",
"broker": "f6f673e95e75873d",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 210,
"y": 2800,
"wires": [
[
"87fdd7ab519e84b8"
]
]
},
{
"id": "f46904eacb6aa8cd",
"type": "ui_button",
"z": "8e9c7f123e3fa72b",
"name": "",
"group": "8bb63e2d106e61a9",
"order": 4,
"width": "2",
"height": "1",
"passthru": false,
"label": "PHONO",
"tooltip": "",
"color": "",
"bgcolor": "{{msg.background}}",
"className": "",
"icon": "",
"payload": "true",
"payloadType": "bool",
"topic": "topic",
"topicType": "msg",
"x": 1120,
"y": 2800,
"wires": [
[
"44d87762f26fac90"
]
]
},
{
"id": "44d87762f26fac90",
"type": "mqtt out",
"z": "8e9c7f123e3fa72b",
"name": "",
"topic": "my_apps/gfw/dirk/remote_ctrl/RAS5/PHONO",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "f6f673e95e75873d",
"x": 1470,
"y": 2800,
"wires": []
},
{ {
"id": "3261d3bb95b50d09", "id": "3261d3bb95b50d09",
"type": "comment", "type": "comment",