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 : Scenes are not returned by Domoticz.getAllDevices() as v<idx> like expected #1159

Open
JRB202 opened this issue Feb 9, 2024 · 6 comments

Comments

@JRB202
Copy link

JRB202 commented Feb 9, 2024

BUG : Scenes are not returned by Domoticz.getAllDevices(), only devices are returned

Demonstrated using custom.js :

function afterGetDevices(){
$.each(Domoticz.getAllDevices(), function (idx, device) {
console.log('DEBUG : idx = ' + idx + ' = ' + device.Name);
})
}
All existing Devices are well displayed
BUT ==> Existing scenes are not returned in this list.

I checked that syntax used in dashticz/js/domoticz-api.js is OK to query domoticz V2024.4 about scenes :
/json.htm?type=command&param=getscenes

@JRB202
Copy link
Author

JRB202 commented Feb 9, 2024

And as consequence this syntax in CONFIG.js do not work (When suggested by Documentation)
blocks['s1'] = {
title: 'My group 1'
}

The object generates a block containing :
Getting device s1

Even when s1 correspond to existing scene with idx = 1

@JRB202
Copy link
Author

JRB202 commented Feb 9, 2024

This problem is probably linked to : domoticz-api.js line 404 to 412 :
where I can se that logic is different when Web Socket are used or not :
function refreshAll() {
if (cfg.refresh_method || !useWS) {
return requestAllVariables().then(function () {
return requestAllDevices();
});
} else {
return requestAllVariables().then(requestAllScenes);
}
}

And currently with version Domoticz V2024.4, web sockets are not connecting anymore
See #1158

@lokonli
Copy link
Collaborator

lokonli commented Feb 12, 2024

It's working on my system, both with websockets as without.

The code above is correct:
requestAllDevices() also return all scenes. (Domoticz returns this in the JSO api call)

When using the websocket connection, then no update on the scenes state is received. So for that reason there is an additional call to get the scenes state.

@JRB202
Copy link
Author

JRB202 commented Feb 12, 2024

I confirm that problem with scenes is linked to websockets usage.

  1. If Adding config['enable_websocket'] = true;
    and websockets are really connecting OK
    then Scenes are correctely returned in s

  2. If Adding config['enable_websocket'] = false;
    then then Scenes are NOT returned in s

This is probably linked to domoticz-api.js code in line 404 to 412

@lokonli
Copy link
Collaborator

lokonli commented Feb 12, 2024

Also with config['enable_websocket'] = false; it should work.
(it is on my system ...)

It's a bit difficult to pinpoint what's causing the issue you have. Do you see other unexpected behavior?
Do you see other warnings/errors in DevTools console tab?

Do you make use of a room_plan?
Which Dashticz version are you using?
Can you try latest beta?

@JRB202
Copy link
Author

JRB202 commented Feb 12, 2024 via email

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

No branches or pull requests

2 participants