According to https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s there's no support for week ranges any more (pretty sure there was before so presumably that was removed recently) so requests will fail with an error.
That said /json.htm?type=graph&sensor=temp&idx=IDX&range=day will return week results (yeah go figure why) so the fix is pretty simple in my opinion, just change to
if (duration <= 172800) {
range = "day";
} else if (duration < 1209600) {
range = "day";
} else if (duration < 5270400) {
range = "month";
} else {
range = "year";
}
According to https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s there's no support for week ranges any more (pretty sure there was before so presumably that was removed recently) so requests will fail with an error.
That said /json.htm?type=graph&sensor=temp&idx=IDX&range=day will return week results (yeah go figure why) so the fix is pretty simple in my opinion, just change to
for now.