Skip to content

Conversation

@NW-Lab
Copy link
Contributor

@NW-Lab NW-Lab commented Mar 10, 2024

Hello

sorry. I've recreated my repository, so I'll post it again.

#123

This is a pull request that retrieves data from the manifest.

sample flows.json

[
    {
        "id": "2850f35f75df23f3",
        "type": "tab",
        "label": "フロー 1",
        "disabled": false,
        "info": "",
        "env": [],
        "_mcu": {
            "mcu": true
        }
    },
    {
        "id": "6f25147b3fbdcb14",
        "type": "ui_button",
        "z": "2850f35f75df23f3",
        "name": "",
        "group": "e6c51ee3d8c53c19",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "ボタンA",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "A",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "_mcu": {
            "mcu": true
        },
        "x": 200,
        "y": 100,
        "wires": [
            [
                "e21165264019e11a"
            ]
        ]
    },
    {
        "id": "e21165264019e11a",
        "type": "ui_text",
        "z": "2850f35f75df23f3",
        "group": "e6c51ee3d8c53c19",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "className": "",
        "_mcu": {
            "mcu": true
        },
        "x": 370,
        "y": 140,
        "wires": []
    },
    {
        "id": "0847560dfe136935",
        "type": "ui_button",
        "z": "2850f35f75df23f3",
        "name": "",
        "group": "e6c51ee3d8c53c19",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "ボタンB",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "B",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "_mcu": {
            "mcu": true
        },
        "x": 200,
        "y": 140,
        "wires": [
            [
                "e21165264019e11a"
            ]
        ]
    },
    {
        "id": "ae4ee17869ca773b",
        "type": "comment",
        "z": "2850f35f75df23f3",
        "name": "moddable_manifest",
        "info": "{\n  \"resources\": {\n    \"*-mask\": [\"c:\\\\tmp\\\\mcu\\\\*\"]\n  },\n  \"config\": {\n    \"DASHBOARD_FONT\": \"Noto\"\n  }\n}\n",
        "_mcu": {
            "mcu": true
        },
        "x": 230,
        "y": 40,
        "wires": []
    },
    {
        "id": "e6c51ee3d8c53c19",
        "type": "ui_group",
        "name": "デフォルト",
        "tab": "9d37bb202717d924",
        "order": 1,
        "disp": false,
        "width": "6",
        "collapse": false,
        "className": "",
        "_mcu": {
            "mcu": false
        }
    },
    {
        "id": "9d37bb202717d924",
        "type": "ui_tab",
        "name": "ホーム",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false,
        "_mcu": {
            "mcu": false
        }
    }
]

Sorry for the Japanese article.
https://qiita.com/NWLab/private/c50766ff7dbb5b122425

Thank you.

@phoddie
Copy link
Owner

phoddie commented Mar 10, 2024

@NW-Lab – this looks reasonable. Before merging, would you consider the suggestion here? Thank you.

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Mar 10, 2024

@phoddie san
I saw Suggestion. This is OK.
I thought about it myself. This part runs on the MCU, but I couldn't understand it because I didn't know how to set the environment variables inside the MCU. Will the PC's environment variables be inherited?

Thank you.

@phoddie
Copy link
Owner

phoddie commented Mar 10, 2024

because I didn't know how to set the environment variables inside the MCU. Will the PC's environment variables be inherited?

The PC's environment won't work reliably on the MCU. But, each Node-RED flow has environment variables. They are available on the MCU (nodered2mcu includes them in the generated JavaScript). Here's an example of setting an environment variable in the Node-RED Editor.

flow.environment.variable.mov

(You can also use Groups in the Node-RED Editor to set environment variables for a set of nodes, but that isn't useful for this case....)

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Mar 10, 2024

@phoddie
Thank you for teaching me how to set environment variables.
This is the first time I learned that it can be set for each Flow.

thank you.

@phoddie phoddie merged commit 72d4b7b into phoddie:main Mar 11, 2024
@phoddie
Copy link
Owner

phoddie commented Mar 11, 2024

Merged. Please close this PR. Thank you,

@NW-Lab
Copy link
Contributor Author

NW-Lab commented Mar 11, 2024

Thank you for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants