ioBroker.js-controller icon indicating copy to clipboard operation
ioBroker.js-controller copied to clipboard

js-controller 3.3 Adapter comaptibility

Open Apollon77 opened this issue 3 years ago • 11 comments

With js-controller 3.2 and js-controller 3.3 some additional checks were added to make sure that created objects match to the specifications and also written state values match to the object definition.

If something is not correct this is logged as "warning" log.

Please take the time to verify your adapter by ideally starting with a fresh instance and do some actions and verify the log. If you see a warn log there from these checks please adjust the adapter and fix the relevant cases.

This thread is for tracking purposes and allows questions and discussions

Apollon77 avatar Apr 30 '21 08:04 Apollon77

I think the log-message is missleading, e.g. .serialNo" has wrong type "string" but has to be "number" This state is currently defined as number, so the message should be has wrong type "number" but has to be "string" isn't it?

HGlab01 avatar Apr 30 '21 14:04 HGlab01

read full message :)

State value to set for "${id}" has wrong type "${typeof state.val}" but has to be "${obj.common.type}"

"State value to set" means the value that someone wants to write

Apollon77 avatar Apr 30 '21 15:04 Apollon77

I am with HGlab01 on this.. my first interpretation was my states are wrongly defined. But it seems my adapter is setting wrong values rather. This could be more explicit.

phifogg avatar May 01 '21 11:05 phifogg

Ok then please propse a better log message :-) In my eyes when reading the full message it should be clear :-)

Apollon77 avatar May 01 '21 11:05 Apollon77

With js-controller 3.2 and js-controller 3.3 some additional checks were added

do you have a list of that changes? which have been in 3.2 and which in 3.3?

I cannot see the message State value to set for "xxx" has to be type "string" but received type "number" with js-controller 3.2, but I've seen it in another log, but don't know which js-c version is running there.

How can I update to js-c v3.3? I've v 3.2.16 installed and this seems to be the actual version. At least my installations do say that. Sorry, even I'm an adapter developer, I'm not very familiar with core ioBroker things :-)

Edit: Do you have a time schedule for that changes?

jpgorganizer avatar May 05 '21 20:05 jpgorganizer

The changelog should give you all infos ;-)) Especially check the Developer sections https://github.com/ioBroker/ioBroker.js-controller/blob/master/CHANGELOG.md

"State value to set ..." error are new in js.controller 3.3.

js-controller 3.3 instructions and test thread in forum https://forum.iobroker.net/topic/44624/js-controller-3-3-jetzt-im-latest

What you mean with "Time schedule"? We work in an agile way and use GitHub projects where plans can be seen as tickets, also the upcomig 3.4 is listed there ... but from time to time we add new stuff, so monitoring js.contrller PRs is the best way to go if you want to know what will come i advance

Apollon77 avatar May 05 '21 21:05 Apollon77

Ok then please propse a better log message :-) In my eyes when reading the full message it should be clear :-)

The issue you are trying to solve for is lazy programmers (like me) relying on javascripts automatic type cast. I would assume that most folks have set the state properties correctly but don't care when setting values.

Reading it again a few times your message does make sense %/ Maybe make it a bit more explicit:

State value to set for "${id}" has wrong type "${typeof state.val}" but state is defined to be "${obj.common.type}"

Or

Setting state value for "${id}" called with wrong type "${typeof state.val}", expected "${obj.common.type}"

phifogg avatar May 06 '21 07:05 phifogg

We adjusted in js.controller 3.3.8 alreayd when I remember correctly ...

Apollon77 avatar May 06 '21 21:05 Apollon77

I already made PR for tankerkoenig, unifi and weatherunderground. But there are so many :( Unfortunately not all adapters are well supported by there authors. And sometimes the Problem is more complex like in sonoff or unifi. For example unifi: The API responds some number values as string??? So we have to check and convert the values back to numbers...

anwa avatar May 07 '21 08:05 anwa

Thank you for our support here and yes some are easy, some requires deeper checks. We can only work on them one after the other :-(

Any PR is highly appreciated!

Apollon77 avatar May 07 '21 09:05 Apollon77

Can we close this issue now? ;-)

foxriver76 avatar Sep 03 '22 00:09 foxriver76