Jey-Cee / ioBroker.deconz

Connects to deConz software developed by dresden-elektronik. This software aims to be a universal ZigBee Gateway solution, using hardware from dresden-elektronik the ConBee USB stick and RaspBee a modul for the Raspberry Pi.
Apache License 2.0
55 stars 35 forks source link

[Bug]: Code 400: Bad request set light state 3: [{"error":{"address":"/lights/3/state","description":"body contains invalid JSON","type":2}}] #302

Open spitfire4all opened 2 years ago

spitfire4all commented 2 years ago

Contact Details

moethrath@gmail.com

What happened?

in the past my hue wake up ligt script work well. But now it does not work, i see one log entry that maybe cause my problem:

Code 400: Bad request set light state 3: [{"error":{"address":"/lights/3/state","description":"body contains invalid JSON","type":2}}]

Adapter Version

1.3.20

deConz (Phoscon) Version

unknown

JS-Controller Version

4.0.15

Node JS Version

14.9.0

NPM Version

6.14.16

Operating System

Debian

Relevant log output

Code 400: Bad request set light state 3: [{"error":{"address":"/lights/3/state","description":"body contains invalid JSON","type":2}}]

Anything else?

No response

Jey-Cee commented 2 years ago

Yepp you are right, this is your problem. So what have you changed? updates?

spitfire4all commented 2 years ago

Good question, with update to JS-Controller Version 4.0.15 I do a lot of Adapter Updates. Today I updated Phoscon Software from 2.12.06 / 19.8.2021 to 2.14.01 / 6.2.2022 maybe it helps.

delta2308151984 commented 2 years ago

Hi, i have the same problem. After updating to v 1.3.20 i can not change the temperature settings on my Eurotronic heating thermostat Model SPZB0001. The log shows: Code 400: Bad request set sensor parameters: [{"error":{"address":"/sensors/config","description":"body contains invalid JSON","type":2}}]

Thanks for your great work

Jey-Cee commented 2 years ago

Please show me the data you set when the error is happening.

delta2308151984 commented 2 years ago

on({id: 'deconz.0.Sensors.32.open', change: "ne"}, async function (obj) { var value = obj.state.val; var oldValue = obj.oldState.val; if (getState("0_userdata.0.eigene_datenpunkte.heizplan.heizbetrieb").val == true) { if (getState("deconz.0.Sensors.32.open").val == true) { setState("deconz.0.Sensors.31.mode"/Thermostat Wohnzimmer mode/, 'off'); setState("deconz.0.Sensors.30.mode"/Thermostat Esszimmer mode/, 'off'); } if (getState("deconz.0.Sensors.32.open").val == false) { setState("deconz.0.Sensors.31.mode"/Thermostat Wohnzimmer mode/, 'auto'); setState("deconz.0.Sensors.30.mode"/Thermostat Esszimmer mode/, 'auto'); } } });

spitfire4all commented 2 years ago

var Farbe, timeout, Helligkeit, dimmIntervalle, Intervall;

// Lichtwecker mit Hue Lampe im Schlafzimmer. // // Dimm intervall auf 10 gestellt, 10 x 3 gleich 30 Minuten. // Leuchte aus nach 35 Minuten. // // https://forum.iobroker.net/topic/17236/tint-leuchtmittel-einbinden/9 // // https://farbtabellen.org/cie-lab-farben/ // // Farben können auch in Deconz eingestellt werden. // // Rolle im Iobroker: // // level.color.temperature Farbtemperatur 380 für Warmweiss // Color.cie koordinaten für CIE Farbsysstem x/y Koordinaten // level.brightness 0-254 oder 0-100% unter Name: undefined level // // Warmweiss: 0.4657,0.4115 ct 380 // Grün: 02.06 // Hellblau: 0.1277,0.1277 // Pink: 0.3,0.1277 // Orange: 0.5,0.4 // rot: 0.6,0.3 // // // // Doku by HDM schedule("0 6 1-5", async function () { console.warn('Lichtwecker wude gestartet'); // Grün ist gleich 0.2,0.6 Farbe = '0.5,0.4'; setState("deconz.0.Lights.3.level"/Schlafzimmer Nachttisch Lampe level/, 5); console.warn((['Anfangs level sollte 5 sein','\n','Anfangs level Tint Lampe ist wirklich',getState("deconz.0.Lights.3.level").val].join(''))); setState("deconz.0.Lights.3.on"/Schlafzimmer Nachttisch Lampe on/, true); timeout = setTimeout(async function () { setState("deconz.0.Lights.3.xy"/Schlafzimmer Nachttisch Lampe xy/, Farbe); Helligkeit = 5; setState("deconz.0.Lights.3.level"/Schlafzimmer Nachttisch Lampe level/, Helligkeit); dimmIntervalle = 0; Intervall = setInterval(async function () { Helligkeit = (typeof Helligkeit == 'number' ? Helligkeit : 0) + 5; setState("deconz.0.Lights.3.level"/Schlafzimmer Nachttisch Lampe level/, Helligkeit); dimmIntervalle = (typeof dimmIntervalle == 'number' ? dimmIntervalle : 0) + 1; if (dimmIntervalle == 10) { (function () {if (Intervall) {clearInterval(Intervall); Intervall = null;}})(); } }, 180000); setStateDelayed("deconz.0.Lights.3.level"/Schlafzimmer Nachttisch Lampe level/, 0, 2100000, false); console.warn('Lichtwecker wurde ausgeschaltet'); }, 5000); }); // Samstag war noch aktiviert. Zeitplan geändert. // 10.10.2020 // Licht wollte nicht ausgehen. undefined on raus undefined level rein. // // 12.10.2020 // Dimm intervall auf 10 gestellt, 10 x 3 gleich 30 Minuten. // Leuchte aus nach 35 Minuten. // // 13.10.2020 // Anpassung auf die Tint Lampe. // // 18.10.2020

Jey-Cee commented 2 years ago

Im actual on it, but not sure whats happening. @danieltrapp i see that the problem is the mode datapoint. This is defined as a string and the handling is consistent. I think there was a change at deConz how they handle it. I have to figure out what they changed.

@spitfire4all it seems that you have to change Farbe from '0.5,0.4' to '[0.5,0.4]'

github-actions[bot] commented 2 years ago

Stale issue message

delta2308151984 commented 2 years ago

Hi, still get the same error in version 1.3.20 and 1.3.21 / ConBee II fw: 26720700 / deConz 2.18.01

Code 400: Bad request set sensor parameters: [{"error":{"address":"/sensors/config","description":"body contains invalid JSON","type":2}}]

script is still the same: on({id: [].concat(['deconz.0.Sensors.32.open']), change: "ne"}, async function (obj) { var value = obj.state.val; var oldValue = obj.oldState.val; if (getState("0_userdata.0.eigene_datenpunkte.heizplan.heizbetrieb").val == true) { if (getState("deconz.0.Sensors.32.open").val == true) { setState("deconz.0.Sensors.31.mode"/Thermostat Wohnzimmer mode/, 'off'); setState("deconz.0.Sensors.30.mode"/Thermostat Esszimmer mode/, 'off'); } if (getState("deconz.0.Sensors.32.open").val == false) { setState("deconz.0.Sensors.31.mode"/Thermostat Wohnzimmer mode/, 'auto'); setState("deconz.0.Sensors.30.mode"/Thermostat Esszimmer mode/, 'auto'); } } });

Siggi0904 commented 1 year ago

that could be the problem: https://github.com/Jey-Cee/ioBroker.deconz/issues/332