This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Custom Air Condition Widget
#1
Hi,

As I am completly ignorant with css I would like if someone could help with a custom widget.

I want to have the top part of the Thermostat widget and botom-mode selection part of the Air Condition widget.
Fan speed selection as on Thermostat (o=off, 33=Min, 67=Mid, 100=Max) and mode (0=Auto, 1=Heating, 3=Cooling, 9=Fan, 14=Dry)

Thank you in advanve for any help.
George

 
Reply
#2
For this you will need to know JavaScript.
Link the output of this object to a virtual object and depend of the value you get write to your object. The fan speed you can set in widget parameters.
------------------------------
Ctrl+F5
Reply
#3
(24.08.2020, 07:37)Daniel. Wrote: For this you will need to know JavaScript.
Link the output of this object to a virtual object and depend of the value you get write to your object. The fan speed you can set in widget parameters.

Can you please share the script, style sheet from the thermostat widget so i can have a starting point?
Reply
#4
I'm not sure what are the values sent on output of the mode but I guess it is 0,1,2,3,4. Change it accordingly Then the script would looks like that
Code:
value = event.getvalue()

if (value == 0) then
  grp.write('1/1/1', 0)
elseif (value == 1) then
  grp.write('1/1/1', 1)
elseif (value == 2) then
  grp.write('1/1/1', 3) 
elseif (value == 3) then
  grp.write('1/1/1', 9)
elseif (value == 4) then
  grp.write('1/1/1', 13) 
end
------------------------------
Ctrl+F5
Reply
#5
(24.08.2020, 12:23)Daniel. Wrote: I'm not sure what are the values sent on output of the mode but I guess it is 0,1,2,3,4. Change it accordingly Then the script would looks like that
Code:
value = event.getvalue()

if (value == 0) then
  grp.write('1/1/1', 0)
elseif (value == 1) then
  grp.write('1/1/1', 1)
elseif (value == 2) then
  grp.write('1/1/1', 3) 
elseif (value == 3) then
  grp.write('1/1/1', 9)
elseif (value == 4) then
  grp.write('1/1/1', 13) 
end

There is no need to create another script for something that could be done native from the widget.
Reply
#6
This is not that simple as you think. I can send you the source code for this widget if you want.
------------------------------
Ctrl+F5
Reply
#7
(24.08.2020, 12:35)Daniel. Wrote: This is not that simple as you think. I can send you the source code for this widget if you want.

That would be great... after all this project is still on development so no worries if i meshed up  Cool
Reply
#8
Here you go. This widget was done by 3rd party and some of the code is hidden in common js which you can't edit.

Attached Files
.gz   se-thermostat.tar.gz (Size: 14.64 KB / Downloads: 54)
------------------------------
Ctrl+F5
Reply
#9
Sorry about this never ending posting from me... Could you share the latest version of this widget, Daniel? I would like to make a small addition for "Heating message" and "Cooling message"...
Reply
#10
Is it clear to you that custom widgets like this will be only visible locally and not in cloud?
------------------------------
Ctrl+F5
Reply
#11
Yeah, that's no problem Smile

Or maybe Erwin would want to make that change - since also the Schneider controllers implement this... Angel
Reply
#12
here

Attached Files
.zip   se-thermostat.zip (Size: 20.99 KB / Downloads: 7)
------------------------------
Ctrl+F5
Reply
#13
I was really not planning to bother you more with questions about this. I can import the widget just fine from the Extensions box, but it does not show up when I "Add new widget"... Have of course renamed the widget, and also tried other changes.

I also downloaded the test-widget alarm_fire_alert from https://forum.logicmachine.net/showthrea...3#pid18353 - it also imports fine, but does not show up when adding widget...

Am I missing something..?
Reply
#14
Did you change the ID as mentioned in this post?
------------------------------
Ctrl+F5
Reply
#15
(31.10.2024, 08:36)Daniel Wrote: Did you change the ID as mentioned in this post?

Yes I did.

Code:
$(function () {
  Widget.thermostat-new = Widget.extend({
    config: {
      title: $.tr('thermostat-new.ctitle', 'Thermostat-NEW'),
      fields: {
        title: { datatype: 'string', title: $.tr('thermostat-new.title', 'Title123') },
      },
      objects: {
        temperature: { datatype: 9, title: $.tr('thermostat-new.temperature', 'Current temperature') + ' *' },
        setpoint: { datatype: 9, title: $.tr('thermostat-new.setpoint', 'Current setpoint temperature input') },
        'setpoint-status': { datatype: 9, title: $.tr('thermostat-new.setpoint-status', 'Current setpoint temperature output') },
[...]

It imports just fine, but just does not show up when trying to add widget...
Reply
#16
Use underscore instead of dash in the widget id.
Reply
#17
You also need to change it in line 207
WidgetView.thermostat_new = WidgetView.extend({
------------------------------
Ctrl+F5
Reply
#18
(31.10.2024, 09:57)Daniel Wrote: You also need to change it in line 207
WidgetView.thermostat_new = WidgetView.extend({

I did, it won't import if not... (Or maybe it will import, but as they were they had ['thermostat'] as ID, and that did not import... So I did change both...)
Reply
#19
Provide the full code of your widget.
Reply
#20
Attached. I have tried many things, not just what I have attached. I have tried to just change the ID both places, I have changed the Title in line 4, and finally I replaced all "se-thermostat." with "thermostat-new.". (Not sure if that have unexpected caveats I have not yet discovered, but it didn't work before I did that neither...)

All of the different version imports, but none is visible when trying to add the widget.

I have not studied the code yet, and I do understand there are caveats here, but I'm pretty sure I'll figure that out when I can start testing changes...

Attached Files
.js   script.js (Size: 41.29 KB / Downloads: 3)
Reply


Forum Jump: