Page 1 of 2

Setpoint widget in a floorplan

Posted: Sunday 23 October 2016 16:31
by CarlosDom
Hello.

Many thanks for the great software and the great ideas you share in this forum.

This is my first post on this site. Let me go straight to my question: Does domoticz support accessing a setpoint widget from the floorplan?.

Details on my scenario are:

I am using Dummy thermostat which allows me to access a setpoint widget where I define my target temperature. This is working fine and, by default, Domoticz gives me access to the widget when I click on the thermostat icon (either from Dashboard or from utilities tab).

Domotics is also capable to show the thermostat in the floorplan but the default action when I click it is to show the graph of the setpoint value through time (no other action is possible for that icon in the floorplan). The obvious workaround is to not use floorplan and just use Dashboard or utilities tab but I am planning to have one thermostat per radiator and the number of them is large (takes time to search to get to the right icon). The Main purpose of the floorplan for my scenario was to be able to visually access the right thermostat and switches and change them from there.

Many thanks in advance for your help
Carlos

Re: Setpoint widget in a floorplan

Posted: Saturday 03 December 2016 0:40
by sangve
Same problem here! :O

Re: Setpoint widget in a floorplan

Posted: Saturday 03 December 2016 7:35
by Egregius
Create your own floorplan and create all the freedom of design as you like.


Image

https://egregius.be/2016/php-floorplan- ... reenshots/

Re: Setpoint widget in a floorplan

Posted: Saturday 21 January 2017 1:09
by CarlosDom
Ok. I understand now, Domoticz out of the box does not allow you to access a setpoint widget from the floorplan. :-(

I understand Egregius solution will allow us to build our own floorplan and have any custom widgets we want to fit our needs. This involves coding in php and integrating it into a domoticz instance. If this is really the only way to do it I will have to go for it but it seems too much complexity for my small requirement (I don't need any special widget I just want to access an existing one from the floorplan).

What I mean is that perhaps there is a way to just change the current web link we see in a thermostat "Show Graph" into "setpoint widget". If I could just change that link, then all my requirements will be met.
I will try to explore this but if anybody has any suggestion that would be appreciated.

Thanks
Carlos

Re: Setpoint widget in a floorplan

Posted: Monday 23 January 2017 1:10
by CarlosDom
Just to update on how far I got.

I see the set point widget is available in the dashboard view and I found the following code in the file "DashboardController.js"

Code: Select all

 else if ((item.Type == "Thermostat")&&(item.SubType=="SetPoint")) { 
	xhtm+='override.png" class="lcursor" onclick="ShowSetpointPopup(event, ' + item.idx + ', ShowFavorites, ' + item.Protected + ', ' + item.Data + ');" height="40" width="40"></td>\n'; 
	status=item.Data + '\u00B0 ' + $scope.config.TempSign; 
}
Similarly the set point widget is available in the utilities screen and I found the following code in "UtilityController.js"

Code: Select all

else if (((item.Type == "Thermostat")&&(item.SubType=="SetPoint"))||(item.Type == "Radiator 1")) { 
  xhtm+='override.png" class="lcursor" onclick="ShowSetpointPopup(event, ' + item.idx + ', RefreshUtilities, ' + item.Protected + ', ' + item.Data + ');" height="48" width="48" ></td>\n'; 
  status=item.Data + '\u00B0 ' + $scope.config.TempSign; 
}
On the other hand the set point widget is not available in the floorplan screen and perhaps this could explain why I could not find any similar code in the file "FloorplanController.js"

I am not totally sure I am looking at the right places so if anybody has comments, that would be appreciated.

Many thanks
Carlos

Re: Setpoint widget in a floorplan

Posted: Wednesday 27 September 2017 22:06
by StratosHF
I'm interested in this too, it's more useful to be able to change the thermostat set point from the floorplan icon rather than look at the history.

Re: Setpoint widget in a floorplan

Posted: Saturday 28 October 2017 12:58
by StratosHF
Does anyone have any advice on this? I'm slowly getting familiar with Python and Lua but this is new territory for me.

Re: Setpoint widget in a floorplan

Posted: Wednesday 17 January 2018 22:50
by thibaultlemaitre
Hi everybody,

I'm also interested to be able to change the value of a setpoint from the roomplan view.

I don't know how to help to achieve this improvement, but the code analyzed by CarlosDom in previous post (https://www.domoticz.com/forum/viewtopi ... 28#p115677) seem to be a way to explore.

Thanks for the development of this soft.

Re: Setpoint widget in a floorplan

Posted: Thursday 18 January 2018 15:07
by Dnpwwo
@StratosHF and @thibaultlemaitre,

The code that controls the device in a floorplan is is domoticzdevices.js:

Code: Select all

function SetPoint(item) {
	if (arguments.length != 0) {
		this.parent.constructor(item);
		this.image = "images/override.png";
		if ($.isNumeric(this.data)) this.data += '\u00B0' + $.myglobals.tempsign;
		if ($.isNumeric(this.status)) this.status += '\u00B0' + $.myglobals.tempsign;
		var pattern = new RegExp('\\d\\s' + $.myglobals.tempsign + '\\b');
		while (this.data.search(pattern) > 0) this.data = this.data.setCharAt(this.data.search(pattern) + 1, '\u00B0');
		while (this.status.search(pattern) > 0) this.status = this.status.setCharAt(this.status.search(pattern) + 1, '\u00B0');
	}
}
SetPoint.inheritsFrom(TemperatureSensor);
you probably just need to add a line that overrides the default behavior of TemperatureSensors onClick (which is to show the log). Adding a line like:

Code: Select all

		this.onClick = <put code here>;
after the while statements would do the trick

Re: Setpoint widget in a floorplan

Posted: Thursday 18 January 2018 15:34
by StratosHF
Dnpwwo, thanks for the information, I'll give it a go.

Re: Setpoint widget in a floorplan

Posted: Wednesday 18 April 2018 14:40
by Stanislaw
Hi,
I have the same problem here. I'm doing some changes in the domoticzdevices.js in chrome browser but I can't figure this out...
Maybe someone could help?

Re: Setpoint widget in a floorplan

Posted: Sunday 12 May 2019 12:28
by wewa
[PUMP]

I would need/prefer the same solution as mentioned by CarlosDom.
CarlosDom wrote: Sunday 23 October 2016 16:31 Hello.

Many thanks for the great software and the great ideas you share in this forum.

This is my first post on this site. Let me go straight to my question: Does domoticz support accessing a setpoint widget from the floorplan?.

Details on my scenario are:

I am using Dummy thermostat which allows me to access a setpoint widget where I define my target temperature. This is working fine and, by default, Domoticz gives me access to the widget when I click on the thermostat icon (either from Dashboard or from utilities tab).

Domotics is also capable to show the thermostat in the floorplan but the default action when I click it is to show the graph of the setpoint value through time (no other action is possible for that icon in the floorplan). The obvious workaround is to not use floorplan and just use Dashboard or utilities tab but I am planning to have one thermostat per radiator and the number of them is large (takes time to search to get to the right icon). The Main purpose of the floorplan for my scenario was to be able to visually access the right thermostat and switches and change them from there.

Many thanks in advance for your help
Carlos
Is ther any solution available so far?

Re: Setpoint widget in a floorplan

Posted: Friday 27 September 2019 20:54
by gryzli133
Any progress? Is there a chance to add setpoint widget instead of Log as standard option for thermostat?

Re: Setpoint widget in a floorplan

Posted: Saturday 28 September 2019 6:22
by stlsparky
For sure, as Egregius has stated, the solution is in his pass2php solution. I have been wanting the same ability to modify the floorplan for 2 years, and his solution was the only one that works. But make no mistake, and 2 reloads later, that solution took over a week and I ended up abandoning the whole process. I had new hope as there was a how-to script floating out there, so I gave it another try a few months ago, but it is dated and installed 2 webservers, etc. I am a noob, and the solution is super cool, but sadly, way TOO involved for a non-programmer. I would love for a renewed interest in his project or maybe a step-by-step install script or git, but it appears the process is too personalized for that. As an example, there are over 10 pages of only the install issues from following the latest script. Then you must master things called cron jobs, too, which use different variables, and that's where I gave up on Pass2php! I want soooo much for this to be a usable solution, so it really makes me frustrated. :(

His solution is perfect, since domoticz floorplan isn't so modifiable out-of-the-box. :cry:

If anyone does get this to work, would you please post the process to help us new users who want to take it to the next level?

And Gizmocuz stated in a post that domoticz natively handles php, so does that mean that pass2php isn't fully needed? Is there a way to modify the floorplan using that suggestion? If so, then how? Or when would one need pass2php then? So many questions and so little time!

Thanks for listening to my rant, guys!

Re: Setpoint widget in a floorplan

Posted: Friday 25 December 2020 9:58
by gryzli133
Are there any chances that this feature could be available? With more then 200+ devices I cannot control my smart house other way than from floor plan. It would be even enough to have long click for changing setpoint (like with dimmer).

Re: Setpoint widget in a floorplan

Posted: Wednesday 13 January 2021 21:57
by waltervl
Dnpwwo wrote: Thursday 18 January 2018 15:07 @StratosHF and @thibaultlemaitre,

The code that controls the device in a floorplan is is domoticzdevices.js:

Code: Select all

function SetPoint(item) {
	if (arguments.length != 0) {
		this.parent.constructor(item);
		this.image = "images/override.png";
		if ($.isNumeric(this.data)) this.data += '\u00B0' + $.myglobals.tempsign;
		if ($.isNumeric(this.status)) this.status += '\u00B0' + $.myglobals.tempsign;
		var pattern = new RegExp('\\d\\s' + $.myglobals.tempsign + '\\b');
		while (this.data.search(pattern) > 0) this.data = this.data.setCharAt(this.data.search(pattern) + 1, '\u00B0');
		while (this.status.search(pattern) > 0) this.status = this.status.setCharAt(this.status.search(pattern) + 1, '\u00B0');
	}
}
SetPoint.inheritsFrom(TemperatureSensor);
you probably just need to add a line that overrides the default behavior of TemperatureSensors onClick (which is to show the log). Adding a line like:

Code: Select all

		this.onClick = <put code here>;
after the while statements would do the trick
Yes, I figured it out!
Change above Setpoint function in www/js/domoticzdevices.js in

Code: Select all

function SetPoint(item) {
    if (arguments.length != 0) {
        this.parent.constructor(item);
        this.image = "images/override.png";
        if ($.isNumeric(this.data)) this.data += '\u00B0' + $.myglobals.tempsign;
        if ($.isNumeric(this.status)) this.status += '\u00B0' + $.myglobals.tempsign;
        var pattern = new RegExp('\\d\\s' + $.myglobals.tempsign + '\\b');
        while (this.data.search(pattern) > 0) this.data = this.data.setCharAt(this.data.search(pattern) + 1, '\u00B0');
        while (this.status.search(pattern) > 0) this.status = this.status.setCharAt(this.status.search(pattern) + 1, '\u00B0');
        this.imagetext = "Set Temp";
        this.controlable = true;
        this.onClick = 'ShowSetpointPopup(' + event + ', ' + this.index + ', ' + this.protected + ' , "' + this.data + '");';
    }
}
SetPoint.inheritsFrom(TemperatureSensor);
I only added 3 lines after the while statements

Edit: refresh your browser cache with CTRL-F5.

Edit: Screenshot as proof ;-)
Screenshot from 2021-01-13 22-12-39.png
Screenshot from 2021-01-13 22-12-39.png (80.76 KiB) Viewed 1513 times

Re: Setpoint widget in a floorplan

Posted: Thursday 14 January 2021 11:59
by eleutscher
I added the 3 lines, restarted Domoticz but do not get the Setpoint option in my floorplan. I am on Domoticz 2020.2 (build 12393)
Am I missing something?

Re: Setpoint widget in a floorplan

Posted: Thursday 14 January 2021 12:03
by waltervl
You have to refresh the javascripts in your browser with CTRL-F5.

Re: Setpoint widget in a floorplan

Posted: Thursday 14 January 2021 12:16
by kiddigital
I have tried the suggestion as well and it seems to work, but there are also some small (UI) issues with it when using custom Icons.

At the moment I am trying to fix these issues and I will create a Pull Request on Github for it in the coming day(s).

Re: Setpoint widget in a floorplan

Posted: Thursday 14 January 2021 12:26
by waltervl
kiddigital wrote: Thursday 14 January 2021 12:16 At the moment I am trying to fix these issues and I will create a Pull Request on Github for it in the coming day(s).
Thank you, I was hoping someone would fix this in the source code.