# State value to set for "s7.1.DBs.DB1.\_2\_0" has to be type "boolean" but received type "string"

**URL:** <https://discourse.nodered.org/t/state-value-to-set-for-s7-1-dbs-db1-2-0-has-to-be-type-boolean-but-received-type-string/100089>\
**Category:** General\
**Tags:** function-node\
**Created:** [5 January 2026 10:56 UTC](https://discourse.nodered.org/t/state-value-to-set-for-s7-1-dbs-db1-2-0-has-to-be-type-boolean-but-received-type-string/100089 "2026-01-05T10:56:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [5 January 2026 10:56 UTC](https://discourse.nodered.org/t/state-value-to-set-for-s7-1-dbs-db1-2-0-has-to-be-type-boolean-but-received-type-string/100089/1 "2026-01-05T10:56:54Z")

</div>

Hi everyone,

I’m sending an initialization from Node-RED to ioBroker for a Siemens LOGO. The initialization is sent, but I keep getting this error:  
State value to set for "s7.1.DBs.DB1.\_2\_0" has to be type "boolean" but received type "string"  
In my Node-RED function I map the incoming command (`"auto"`, `"off"`, `"on"`) to the corresponding S7 state and then force the payload to a boolean:

```auto
if (msg.payload == "auto") {
  msg.topic = "s7.1.DBs.DB1._2_1";
}
if (msg.payload == "off") {
  msg.topic = "s7.1.DBs.DB1._2_0";
}
if (msg.payload == "on") {
  msg.topic = "s7.1.DBs.DB1._2_2";
}
msg.payload = true;
return msg;

```

My debug output (from Node-RED) shows something like this, which looks like a boolean to me:

```auto
object
topic: "s7.1.DBs.DB1._2_0"
payload: true
acknowledged: true
timestamp: 1767583290889
lastchange: 1767583290889
from: "system.adapter.s7.1"
_msgid: "70db13186a9f010f"

```

So I assume I’m sending a boolean, but ioBroker still claims it received a string.

Is there anything I should improve in the function to ensure the value is always treated as a boolean?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [5 January 2026 11:12 UTC](https://discourse.nodered.org/t/state-value-to-set-for-s7-1-dbs-db1-2-0-has-to-be-type-boolean-but-received-type-string/100089/2 "2026-01-05T11:12:06Z")

</div>

Exactly which node are you sending that value to? Check in manage palette for the node package name.

---

<div class="post-metadata">

**Author:** ![edstobi](https://avatars.discourse-cdn.com/v4/letter/e/aca169/32.png) [@edstobi](https://discourse.nodered.org/u/edstobi)\
**Post date:** [5 January 2026 22:12 UTC](https://discourse.nodered.org/t/state-value-to-set-for-s7-1-dbs-db1-2-0-has-to-be-type-boolean-but-received-type-string/100089/3 "2026-01-05T22:12:29Z")

</div>

I’m sending and receiving data using node-red-contrib-iobroker 1.2.0.

In the meantime I changed the datapoint type in ioBroker and Node Red from boolean to string, and now I no longer get any error entries in the log. Because of that, I don’t think this is a pure Node-RED issue — it seems more likely that the ioBroker adapter handles this differently (maybe a type conversion or feedback/ack behavior).

I’m going to try to discuss this with one of the adapter’s architects/developers.

What I still don’t understand: why should I use a string (or even the length of a string) for a purely digital signal where only true or false makes sense?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/ad3d3a779afe7c0f1877aa2dece777d9de472761.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 April 2026 22:13 UTC](https://discourse.nodered.org/t/state-value-to-set-for-s7-1-dbs-db1-2-0-has-to-be-type-boolean-but-received-type-string/100089/4 "2026-04-05T22:13:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
