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

[bug]: jsonConfig: jsonData - instanceObj is undefined #2824

Open
1 task done
Scrounger opened this issue Nov 21, 2024 · 3 comments
Open
1 task done

[bug]: jsonConfig: jsonData - instanceObj is undefined #2824

Scrounger opened this issue Nov 21, 2024 · 3 comments

Comments

@Scrounger
Copy link

No existing issues.

  • There is no existing issue for my problem.

Describe the bug

i have a table with autocompleteSendTo and try to send the instance (number) to the adapter.
But the instanceObj is undefined. I tried all that are documented here:
https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/adapterjsonconfig.md#js-functions

but only globalData and data working

To Reproduce

...

Expected behavior

should send the data

Screenshots & Logfiles

table item with autocompleteSendTo

"deviceBlackList": {
					"newLine": true,
					"type": "table",
					"sm": 12,
					"md": 6,
					"disabled": "!data.devicesEnabled",
					"confirm": {
						"condition": "!_alive",
						"title": "Attention!",
						"text": "This selection is only possible with a running instance!",
						"ok": "Got it!",
						"cancel": "cancel",
						"type": "warning"
					},
					"items": [
						{
							"type": "autocompleteSendTo",
							"title": "Choose which device should be excluded",
							"attr": "mac",
							"filter": true,
							"sort": true,
							"jsonData": "${instanceObj}",
							"command": "deviceList",
							"width": "60%"
						},
						{
							"type": "checkbox",
							"title": "Ignor in notifications",
							"attr": "blacklisted",
							"width": "15%"
						}
					]
				}

the message i retrieve:

[onMessage]: {"command":"deviceList","message":null,"from":"system.adapter.admin.0","callback":{"message":null,"id":225,"ack":false,"time":1732192474754},"_id":88445533}

Browser error log:
Cannot parse json data: undefined

Adapter version

7.4.1

js-controller version

7.0.3

Node version

18.x

Operating system

Ubuntu 22.04 LTS

Additional context

No response

@Scrounger Scrounger added the bug label Nov 21, 2024
@mcm1957
Copy link
Contributor

mcm1957 commented Nov 21, 2024

According to the docu you referred to theres only _instance as a varible. I do not see instanceObj documented. Where did you read that instanceObject should be defined?

@Scrounger
Copy link
Author

I tried all that are documented here: https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/adapterjsonconfig.md#js-functions

but only globalData and data working

as i wrote, i tried all from the documentation.

with _instance i get the following:

table item with autocompleteSendTo

				"deviceBlackList": {
					"newLine": true,
					"type": "table",
					"sm": 12,
					"md": 6,
					"disabled": "!data.devicesEnabled",
					"confirm": {
						"condition": "!_alive",
						"title": "Attention!",
						"text": "This selection is only possible with a running instance!",
						"ok": "Got it!",
						"cancel": "cancel",
						"type": "warning"
					},
					"items": [
						{
							"type": "autocompleteSendTo",
							"title": "Choose which device should be excluded",
							"attr": "mac",
							"filter": true,
							"sort": true,
							"jsonData": "${_instance}",
							"command": "deviceList",
							"width": "60%"
						},
						{
							"type": "checkbox",
							"title": "Ignor in notifications",
							"attr": "blacklisted",
							"width": "15%"
						}
					]
				}

the message i retrieve:

[onMessage]: {"command":"deviceList","message":null,"from":"system.adapter.admin.0","callback":{"message":null,"id":243,"ack":false,"time":1732199814887},"_id":88445551}

Browser console error:
image

instanceObj is defined in the code and in #1323

@Scrounger
Copy link
Author

Thanks for fixing this, but i tested it with v7.4.2 and it is still not working.

I tried both instanceObj and _instance. Get the follwing browser console error:
image

and the messages for both looks like this:

[onMessage]: {"command":"deviceList","message":null,"from":"system.adapter.admin.0","callback":{"message":null,"id":491,"ack":false,"time":1732620141351},"_id":56710972}

[onMessage]: {"command":"deviceStateList","message":{"instanceID":"${_instance}","adapter":"${globalData}"},"from":"system.adapter.admin.0","callback":{"message":{"instanceID":"${_instance}","adapter":"${globalData}"},"id":492,"ack":false,"time":1732620141352},"_id":56710973}

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

No branches or pull requests

3 participants