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

[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 this issue Apr 13, 2022 · 10 comments
Assignees
Labels

Comments

@spitfire4all
Copy link

Contact Details

[email protected]

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
Copy link
Owner

Jey-Cee commented Apr 13, 2022

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

@spitfire4all
Copy link
Author

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
Copy link

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
Copy link
Owner

Jey-Cee commented May 3, 2022

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

@delta2308151984
Copy link

delta2308151984 commented May 4, 2022

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
Copy link
Author

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
Copy link
Owner

Jey-Cee commented May 12, 2022

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
Copy link

Stale issue message

@delta2308151984
Copy link

delta2308151984 commented Oct 1, 2022

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
Copy link
Contributor

that could be the problem:
#332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants