SwordFish wrote:mvveelen wrote:With this code, the UP and DOWN disappear in my frontpage, and I can't switch the lights on....?
On my page also and I still get 33, 66 enz?
Is there something I forget to do?
Dear ,
When switched off, the + and - are not there as mention in the comments in the code . This is my personal preference/
this is due to :
var plus = "";
var min = "";
Make sure you have the below mentioned icons or adjust the name to show the + - icons when switched on.
var plus = "<img src=icons/plus.png onclick=ChangeStatus('plus'," + Vdimmerc + "," + item.idx + ","+ Vdimmerc+")>";
var min = "<img src=icons/min.png onclick=ChangeStatus('min'," + Vdimmerc + "," + item.idx + ","+ Vdimmerc+")>"
What do you find in the console.log (in chrome rightclick the page and select inspect element.
In the log shown on the right site of the screen you should see passing the code with the iconname for the %
vdimmericon = Vdimmerc;
var vdimmericon=new String(Vdimmerc).replace( Vdimmerc,"<img src=icons/dimmer"+Vdimmerc+".png width=65 height=60 style='margin-top: 30px;'>");
console.log(vdimmericon);
Switch off and + - action is in the code below done by switchtoggle function and changestatus function :
var hlp = '<span onclick="SwitchToggle('+item.idx+',\'Off\');lightbox_open(\'switch\', '+switch_off_timeout+', '+txt_switch_off+')"; style='+alarmcss+'> '+ vdimmericon +' </span>';
var plus = "<img src=icons/plus.png onclick=ChangeStatus('plus'," + Vdimmerc + "," + item.idx + ","+ Vdimmerc+")>";
var min = "<img src=icons/min.png onclick=ChangeStatus('min'," + Vdimmerc + "," + item.idx + ","+ Vdimmerc+")>";
Switch On is in the code below done by switchtoggle function :
var hlp = '<span onclick="SwitchToggle('+item.idx+',\'On\');lightbox_open(\'switch\', '+switch_on_timeout+', '+txt_switch_on+')"; style='+alarmcss+'> '+ vdata+' </span>';
var plus = "";
var min = "";
Edit : I just remembered something ...
I had some problems in the beginning with vdimmercurrent, so i loaded the vdimmercurrent into vdimmerc.
Maybe you have not filled vdimmerc causing the code to stop and break the function by this. Remember by the swipe module the "Strict mode" is set, so all variable should be declared and filled somehow before using them ....
I did it by this earlier in the code :
for( var ii = 0, len = $.PageArray.length; ii < len; ii++ ) {
if( $.PageArray[ii][0] === item.idx ) { // Domoticz idx number
var vtype= $.PageArray[ii][1]; // Domotitcz type (like Temp, Humidity)
var vlabel= $.PageArray[ii][2]; // cell number from HTML layout
var vdesc= $.PageArray[ii][3]; // description
var lastseen= $.PageArray[ii][4]; // Display lastseen or noT
var vplusmin= $.PageArray[ii][5]; // minplus buttons, or icon on
var vattr= $.PageArray[ii][6]; // extra css attributes
var valarm= $.PageArray[ii][7]; // alarm value to turn text to red
var vdata= item[vtype]; // current value
var vstatus= item["Status"];
var vls= item["LastUpdate"]; // ´Last Seen´
var vdimmercurrent= item["LevelInt"]; // What is the dim level
var Vdimmerc = vdimmercurrent; // something strangs happens along, so recreate new var
For me with KAKU it works like a charm
Complete FrontPage code :
http://www.filedropper.com/frontpagesm = only temp download for 30days
Many personal tweaks done, mainly intiated in FrontPage settings file.
Please consider it as a fork, many things are changed by me for my personal use and code may not be 100% usefull or functional depending on your situation.
Most of it is commented in the code.
For example :
- i have created an option to make a cell protected via the settings file for cells that are not protected in domoticz itself.
- i have changed the dimmer function not to use 33 66 etc but back to 1-16 as this works more reliable on my kaku dimmers. I have currently only kaku installed in my
home.
- When the alarmtimer is triggere background changes to orange. (timer is started for 20 secs after a door is openend to be able to disarm,
With lua the disarm is done by ping my Phone to discover i am home
and alarm is set armed away as soon as my Phone is not at home anymore)
- When alarm is triggered then background changes to red. (= alarm timer is finished and alarm is not disarmed) My smoke detectors will make sound on this.
- When the alarm is triggered a beep wil be played to get notified.
- When abroad ip is detected (VPN) then the FrontPage.html is switched to FrontPage_sm.html with less cameras and lower refresh to reduce bandwith
and many more...
For me all is 100% functional and no bugs so far , my only improvement next will be humidity and temp in shared cell to free up some space for future use.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)