Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example for returning more than 1 value for native #5

Closed
foxthefox opened this issue Nov 1, 2023 · 3 comments
Closed

example for returning more than 1 value for native #5

foxthefox opened this issue Nov 1, 2023 · 3 comments

Comments

@foxthefox
Copy link

can you please add an example for returning more than one value via native?

I have 4 values in the config page to be set by returning them from a function in sendTo.

in jsonUIconfig I have:

		"mqttUserId": {
			"type": "text",
			"label": "mqtt userId",
			"newLine": false
		},
		"mqttUserName": {
			"type": "text",
			"label": "mqtt user name",
			"newLine": false
		},
		"mqttPwd": {
			"type": "text",
			"label": "mqtt pwd",
			"newLine": true
		},
		"mqttClientId": {
			"type": "text",
			"label": "mqttClientId",
			"newLine": false
		},
		"_create": {
			"type": "sendTo",
			"label": "Create Login Data",
			"command": "create",
			"variant": "outlined",
			"useNative": true,
			"jsonData": "{\"user\": \"${data.mqttUserName}\", \"pass\": \"${data.mqttPwd}\"}}"
		}

and in the message portion I have

	const resultFromFunction = {
		native: {
			mqttUserId: '1232445564356',
			mqttUserName: 'login.User',
			mqttPwd: 'login.Password',
			mqttClientId: 'login.clientID'
		}
	};
	this.sendTo(obj.from, obj.command, resultFromFunction, obj.callback);

after returning the message only the last value is modified in the config page of the adapter.
If I reduce it to one value, it is running OK.

@mcm1957
Copy link
Collaborator

mcm1957 commented Nov 1, 2023

I can add it if someone canbzell how it works. I do not even know if its possible.

Note: I did not develop jsonconfig or its components.

@ticaki
Copy link

ticaki commented Nov 1, 2023

I couldn't get this to work either. Its a Admin missing feature/bug imho.

@foxthefox
Copy link
Author

OK, I transfer this to the admin adapter

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

No branches or pull requests

3 participants