node-red-contrib-home-assistant-websocket icon indicating copy to clipboard operation
node-red-contrib-home-assistant-websocket copied to clipboard

Validation error: state is not a string

Open TimMayle opened this issue 2 years ago • 0 comments

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

TimMayle avatar Mar 23 '23 08:03 TimMayle