node-red-contrib-grocy
Version:
Node-RED nodes to interact with the Grocy API
20 lines (17 loc) • 551 B
JavaScript
module.exports = function(RED) {
function GrocyConfigNode(config) {
RED.nodes.createNode(this, config);
this.name = config.name;
this.apiUrl = config.apiUrl;
// Access the API key from credentials
if (this.credentials) {
this.apiKey = this.credentials.apiKey;
}
}
// Register the node with credentials
RED.nodes.registerType("grocy-config", GrocyConfigNode, {
credentials: {
apiKey: { type: "password", required: true }
}
});
};