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

TypeScript STATE_QUALITY has missing values #2319

Closed
jpawlowski opened this issue Jul 2, 2023 · 2 comments
Closed

TypeScript STATE_QUALITY has missing values #2319

jpawlowski opened this issue Jul 2, 2023 · 2 comments
Assignees
Labels
fixed ✅ type definition update ⌚ Feature requires an update of the type definitions

Comments

@jpawlowski
Copy link
Contributor

jpawlowski commented Jul 2, 2023

The values for STATE_QUALITY in packages/types-dev/index.d.ts seem outdated, for example, one could receive the following TypeScript error:

Type '64' is not assignable to type 'StateQuality | undefined'.

I think the values in

enum STATE_QUALITY {
/** The default value for a state */
GOOD = 0x00,
/** General problem */
BAD = 0x01,
/** The instance cannot establish a connection */
CONNECTION_PROBLEM = 0x02,
/** Substitute value from controller, do not set this in adapters */
SUBSTITUTE_FROM_CONTROLLER = 0x10,
/** Quality for default values */
SUBSTITUTE_INITIAL_VALUE = 0x20,
/** Substitute value from instance or device */
SUBSTITUTE_DEVICE_INSTANCE_VALUE = 0x40,
/** Substitute value from a sensor */
SUBSTITUTE_SENSOR_VALUE = 0x80,
/** General problem by instance */
GENERAL_INSTANCE_PROBLEM = 0x11,
/** General problem by device */
GENERAL_DEVICE_PROBLEM = 0x41,
/** General problem by sensor */
GENERAL_SENSOR_PROBLEM = 0x81,
/** The instance is not connected */
INSTANCE_NOT_CONNECTED = 0x12,
/** The device is not connected */
DEVICE_NOT_CONNECTED = 0x42,
/** The sensor is not connected */
SENSOR_NOT_CONNECTED = 0x82,
/** The device has reported an error */
DEVICE_ERROR_REPORT = 0x44,
/** The sensor has reported an error */
SENSOR_ERROR_REPORT = 0x84
}

shall be updated with values from

https://github.com/ioBroker/ioBroker.docs/blob/6cf3906bc43bd3b31821902c78abd8babe4f93d3/docs/en/dev/objectsschema.md?plain=1#L133-L153

As an example, I had to ignore the TS errors like this jpawlowski/ioBroker.residents@71d2e5d

Edit:
I noticed that the value 0x41 I am using in my adapter is already in there, but it is not available to TypeScript during my development it seems. I had updated js-controller to version 5.0.5, what else is missing here?

@foxriver76
Copy link
Collaborator

Thanks for the report. The types are currently still used from official @types package. During the next days, we will try to publish the types for the new controller version. I will let you know as soon as this is the case.

@foxriver76 foxriver76 self-assigned this Jul 2, 2023
@foxriver76 foxriver76 added fixed ✅ type definition update ⌚ Feature requires an update of the type definitions labels Jul 2, 2023
@foxriver76
Copy link
Collaborator

fixed with @iobroker/adapter-core v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed ✅ type definition update ⌚ Feature requires an update of the type definitions
Projects
None yet
Development

No branches or pull requests

2 participants