jpgorganizer / ioBroker.smartgarden

GARDENA smart system adapter for ioBroker
Other
21 stars 8 forks source link

data types string, not number #60

Closed reutli closed 1 year ago

reutli commented 1 year ago

Hi, while developing some javascript I've noticed that data types in the objects are not correct, i.e. duration_value should be number but is string:

{ "type": "state", "common": { "name": "duration_value", "type": "string", "role": "text", "read": true, "write": true }, "native": "null", "from": "system.adapter.smartgarden.0", "user": "system.user.admin", "ts": 1657723811866, "_id": "smartgarden.0.LOCATION_d43b2af9-2D6121-2D421b-2Db5dc-2Db522e1b414d6.DEVICE_78186d8a-2D4e1e-2D4c23-2Dbdb7-2Db1dfaa08102e.SERVICE_VALVE_78186d8a-2D4e1e-2D4c23-2Dbdb7-2Db1dfaa08102e-3A3.duration_value", "acl": { "object": 1636, "state": 1636, "owner": "system.user.admin", "ownerGroup": "system.group.administrator" } }

There are a lot of false data types.

If you try to fill in numbers to that fields you're getting errors like: `

javascript.0 2023-05-05 08:03:07.990 warn at Object. (script.js.Tests.Beregnung_Süd:11:5)
javascript.0 2023-05-05 08:03:07.990 warn at setState (/opt/iobroker/node_modules/iobroker.javascript/lib/sandbox.js:1719:20)
javascript.0 2023-05-05 08:03:07.989 warn You are assigning a number to the state "alias.0.Aussen.Beregnung.Gruppe3.Ventil T380 Südwest.duration_value" which expects a string. Please fix your code to use a string or change the state type to number. This warning might become an error in future versions.

` or

`

smartgarden.0 2023-05-05 08:03:08.633 error Error: request returned 403 Forbidden
smartgarden.0 2023-05-05 08:03:08.633 info 1/ Valve Set command failure.response.statusCode/Message=403/Forbidden

` Yes, I'm writing to aliases, but they have the same data types like the origin Das

jpgorganizer commented 1 year ago

duration_value hast to be type string see https://github.com/jpgorganizer/ioBroker.smartgarden#for-service_valve