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

[JSONconfig] : defaultSendTo not taking data from native with useNative attribute set to try #2241

Closed
1 task done
DutchmanNL opened this issue Nov 28, 2023 · 6 comments · Fixed by #2245
Closed
1 task done
Labels
bug json config Issues with JsonConfig components.

Comments

@DutchmanNL
Copy link
Contributor

No existing issues.

  • There is no existing issue for my problem.

Describe the bug

I would like to load table content by using a button configured as sendTo, this works as expected.
But I also would like to load this table by default when entering the page, for this purpose attribute "defaultSendTo" is used.

Messages are arriving at the backend and also send back, but not loaded by default using the native attributes

To Reproduce

  1. Create JSON-Config with sendTo button
  2. activate useNative : true
  3. send and handle message on backend
  4. default values returned are not used

Expected behavior

data provided by defaultSendTo should ensure proper message handling, see code at ESPHome:

Screenshots & Logfiles

https://github.com/DrozmotiX/ioBroker.esphome/blob/main/admin/jsonConfig.json5#L239-L254

relates to DrozmotiX/ioBroker.esphome#192

Adapter version

6.12.5

js-controller version

5.0.16

Node version

18

Operating system

Linux/Docker/DevServer

Additional context

No response

@DutchmanNL DutchmanNL added the bug label Nov 28, 2023
@foxriver76
Copy link
Collaborator

From how I understand it, defaultSendTo is a functionality which all config fields can have, to request a default value for the field from the backend.

useNative is a property regarding the sendTo component, it won't be applied for the default send to.
If I get you right, you want, that the sendTo is executed once the config is rendered, is this correct?

@foxriver76 foxriver76 added the json config Issues with JsonConfig components. label Dec 1, 2023
@DutchmanNL
Copy link
Contributor Author

Correct and that's also working with default sendTo, I receive the message and respond back

But the data I provide back is not used

Same functionality with just sendTo works

Example code in esphome, sendTo handles a button request provide data back for tables

This button should execute also a defaultSendTo (so at page load) to handle the data

I would like to automatically load these values without pushing the button

Will add code lines as soon I am back at my desk

@foxriver76
Copy link
Collaborator

Then, I think what we need is a property for the sendTo component like onLoaded: boolean to execute it once initially. So that no one has to perform a action and the sendTo is executed once automatically.

@DutchmanNL
Copy link
Contributor Author

I Thought defaultSendTo is used for that purpose

Please be aware, it works for autocompleteSend bitbthw difference is Here that I proces data Directory and for the other one I Need to use the values returned back as the Button Regress another Attribute (table)

So WhatsApp Happens is, if Oboist the Button the table is Build as expected

But default load Not, so I assumeren the native is Not processen Here weich is different beterend sendTo and defaultSendTo

@foxriver76
Copy link
Collaborator

foxriver76 commented Dec 1, 2023

Yes, for automcompleteSendTo it works, because the purpose of the default is to obtain a default value for this specific component like prefilling a selection, text field etc, but in your scenario you want to have an affect on other components or processing the response by the component itself. So code wise it seems to be strictly separated. However, it won't be a big deal to add an option to achieve what you need.

@DutchmanNL
Copy link
Contributor Author

Yes, for automcompleteSendTo it works, because the purpose of the default is to obtain a default value for this specific component like prefilling a selection, text field etc, but in your scenario you want to have an affect on other components or processing the response by the component itself. So code wise it seems to be strictly separated. However, it won't be a big deal to add an option to achieve what you need.

clear that sounds promising, anything else you need from my side or I can assist in ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug json config Issues with JsonConfig components.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants