Closed dannybloe closed 4 years ago
I'm not the original creator of Dashticz and got involved approx 1 year ago. Dashticz almost completely runs in the browser with only some very limited server functionality. As far as I know Domoticz doesn't offer a native websocket interface, meaning we need to do some http polling anyway. In fact I was considering to switch to a js based server solution and transfer functionality from client to server. However, that would be quite some work with limited added value.
The idea is interesting and exactly why I wanted to start a new separate project for it (unfortunately I didn’t have any time yet)
Just like @lokonli mentioned, the code is heavily written for browser usage (and refresh)
As far as I know, domoticz doesn’t have websocket connection?
Although it’s possible to simple write a small nodejs server that listens to MQTT and push the changes to websocket. Domoticz already pushes changes to MQTT if you configure the server.
But that requires you to run a nodejs server and a mqtt server AND this also requires the code to support both HTTP and websocket changes, so a lot of code changes
Domoticz does support native websockets for updating the gui. Check the network tab in chrome and look for the json request. Works like a charm.
Interesting. I started preparing an update to move all Domoticz network request to a dedicated module, including some kind of subscription mechanism to prevent that all blocks get updated when Dashticz refreshes the Domoticz info. If should then also be relatively easy to switch from http to ws.
I'll do some experiments ...
Sounds good. I was about to make something myself using nodejs, react+redux, sass and typescript but unfortunately I lack the time to actually do it. Creating dzVents already took so much time in the past. So then I saw this project and started experimenting with it to see if it was good enough for my needs 🙂
@lokonli are you on domoticz slack? If not, send me a pm and I'll add you to it.
@dannybloe isn't there already something similar? https://github.com/domoticz/Reacticz Although it isn't maintained for a long time and not sure how much devices they support
@lokonli sounds really good the code separation! Maybe you can commit it to a separate branch and me (and also other) can have look/help?
First I'll finish and clean up the evohome integration, then I can prepare the code separation branch.
@dannybloe: checking the network tab in the Domoticz UI: Seems to be just polling with http every 5 seconds. Only devices with changed values are reported back by setting the lastupdate parameter in the json request.
This is interesting for Dashticz as well...
Well, I'm using 4.11590 and that one is clearly using websockets. Maybe, when it cannot upgrade the connection to a socket, it falls back to json polling.
Hmm, I'm on 4.10717. build date May 2019 Checking the commits in Domoticz it seems that the Dashboard uses websockets since August '19.
Your version should contain a websocket channel.
The changelog mentions the following:
Version 4.10658 (May 5th 2019)
- Implemented: [BleBox] Add support for airSensor and use the newest api for shutterBox
- Implemented: Alecto WS5500 implemented (pTypeWeather)
- Implemented: Anna Thermostat Added ability to select presets on the Anna via selector switch. Added ability to update the state of the proximity switch in the Anna thermostat.
- Implemented: Better graph display for thermostat devices
- Implemented: Blinds T14/R15/T16 to lights.html
- Implemented: CayenneLPP, added initial support for LPP_UNIXTIME
- Implemented: Cereal Proxy
- Implemented: Custom icons for: Contact Door Contact Push On Push Off Door Lock Door Lock Inverted
- Implemented: Devices Tab, Scene/Group log icon added
- Implemented: EnOcean3 implemented EPP D2-03-0A
- Implemented: EventSystem logging name when issuing thermostat SetPoint/Mode/Fan command
- Implemented: EvoHome radiator Valve Value to Pushers InfluxDB worker
- --->Implemented: Experimental support for WebSockets protocol
Implemented in beta 3.4.0
Howdee folks,
Have you considered using the websocket channel for device updates instead of polling for changes. This greatly reduces network traffic and updates are instant.
Cheers,
Danny.