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

Validation error: state is not a string #900

Open
TimMayle opened this issue Mar 23, 2023 · 0 comments
Open

Validation error: state is not a string #900

TimMayle opened this issue Mar 23, 2023 · 0 comments
Labels
bug Something isn't working node:sensor

Comments

@TimMayle
Copy link

Describe the bug

Hello guys !

Fist, thank you so much for the effort and time you put into HA and NodeRed. These are such a great tools !!

Some early description can be found here.
The sensor node should, based on the error message, accept strings, numbers and boolean.
ValidationError: "state" must be one of [string, boolean, number]
This object arrives at the sensor:
image
And the sensor is configured like this:
image
Regardless of what I do (change node, etc.) to be sure to have a string attribute, I still get this error.
As a workaround, I copy the object and use "state" as boolean.

Btw, I also tried to set another attribute as boolean, but it seems to only consider msg.payload.state

I hope his description is precise enough.

Thank you in advance for you support.

Tim

To Reproduce

  1. Create an object with at least one string and one boolean object
  2. Pass the information to a sensor node
  3. Configure 'state' on the string attribute.
  4. Run the flow.

Expected behavior

String should be accepted on the sensor node and not generate and error such as ValidationError: "state" must be one of [string, boolean, number]

Screenshots

image
image
image

Example Flow

My flow is very messy. Not sure it would help in that shape.

This package's version (not the Home Assistant add-on version)

0.49.0

Is Node-RED running in Docker?

No

Node-RED version

3.0.2

Node.js version

don't know

Additional context

No response

@zachowj zachowj added the bug Something isn't working label Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node:sensor
Projects
None yet
Development

No branches or pull requests

2 participants