Page 97 of 184
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 22:38
by Wheeling
htilburgs wrote:Wheeling wrote:htilburgs wrote:
Hi @htilburgs
Nice Dash
Can you share the iPhone script with us
I've been looking for it for a long time, but do not get it to work.
Thx
Bennie
Just send you a PM....
Thx man
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 22:39
by Derik
you forgot the / after v2
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 22:40
by Trigun
EdKo66 wrote:Trigun wrote:Hi All,
first of all, what a great dashboard!
Allthough it looks amazing, I am not able to get it working and I can't see where it goed wrong.
I changed the CONFIG-DEFAULT.js with my IP adress and saved it as CONFIG.js after putting all the files in www/dashticzv2 folder.
tried to open
http://192.168.1.94:8080/dashticzv2 but get an 404 error.
Am I overlooking something??
thanks in advance!
Perhaps you can share your CONFIG.js here. Are you sure the address is correct?
Hi EdKo66,
thnks for your reply.
the code of the CONFIG.js file is as follows:
Code: Select all
var _LANGUAGE = 'nl_NL'; //or: en_US, fr_FR, hu_HU
var _HOST_DOMOTICZ = 'http://192.168.1.94:8080';
var _DOMOTICZ_REFRESH = 5; //in seconds
var _DASHTICZ_REFRESH = 30; //in minutes
/*
IF YOU HAVE A MEDIABOX FROM ZIGGO (HORIZON), COPY SWITCH_HORIZON.PHP ON A WEBSERVER INSIDE YOUR NETWORK AND CHANGE THE IP.
ENTER THE PATH TO THIS FILE BELOW.
*/
var _HOST_ZIGGO_HORIZON = ''; //e.g. http://192.168.1.3/domoticz/switch_horizon.php';
var _APIKEY_WUNDERGROUND = '';
var _WEATHER_CITY = 'Eindhoven';
var _WEATHER_CITYNAME = ''; //show a different city name, leave empty if same as _WEATHER_CITY
var _WEATHER_COUNTRY = 'NL';
var _USE_AUTO_POSITIONING = true; //don't want to configure positions, use auto positioning
var _USE_FAVORITES = true; //only used when using auto positioning
var _HIDE_SECONDS_IN_CLOCK = false; //do not show the seconds in the clock
var _HIDE_MEDIAPLAYER_WHEN_OFF = false; //when you have a mediaplayer connected, hide it if nothing is playing
var _NEWS_RSSFEED = 'http://www.nu.nl/rss/algemeen';
var _USE_FAHRENHEIT = false;
var _USE_BEAUFORT = true; //Bft instead of m/s
var _TRANSLATE_SPEED = false; //windspeed, north northwest instead of NNW
var _STANDBY_AFTER_MINUTES = false; //enter amount of minutes like: 5 (5 minutes)
var _SCROLL_NEWS_AFTER = 7000; //milliseconds, so 7000 is 7 seconds
var _SHOW_LASTUPDATE = true;
var _LASTUPDATE_FORMAT = 'DD-MM-YY HH:mm';
var _SCREENSLIDER_EFFECT = 'slide'; //'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
var _APIKEY_MAPS = '';
var _MAPS_LATITUDE = '';
var _MAPS_LONGITUDE = '';
var _AUTO_SWIPEBACK_TO = 1; //when no activity, swipe back to main screen after x seconds
var _AUTO_SWIPEBACK_TIME = 10; //seconds
// Online Radio Stream Plugin, Note: you must enable plugin in column section 'streamplayer', see columns[3]['blocks'] example below.
var _STREAMPLAYER_TRACKS = [
{"track":1,"name":"Music FM","file":"http://stream.musicfm.hu:8000/musicfm.mp3"},
{"track":2,"name":"Radio 1","file":"http://213.181.210.106:8000/high.mp3"},
{"track":3,"name":"Test FM","file":"http://213.181.210.106:8000/high.mp3"},
];
// iCalendar Plugin, supports all .ics calendar types like Google Calendar, Apple Calendar
var _ICALENDAR_URL = 'https://testurl.com/ical.ics'; //supports .ics type calendars (Google Calendar, Apple Calendar etc.)
var _ICALENDAR_DATEFORMAT = 'friendly'; //'friendly', 'MM.DD.YYYY HH:mm', 'DD.MM.YYYY HH:mm', 'YYYY.MM.DD HH:mm'
var _ICALENDAR_LOCALE = 'en'; //en,hu, etc.
//Buttons or images to open webpages in an iframe, like a news website or weather forecast
var buttons = {}
buttons.buienradar = {width:12, isimage:true, refreshimage:60000, image: 'http://api.buienradar.nl/image/1.0/RadarMapNL?w=285&h=256', url: 'http://www.weeronline.nl/Europa/Nederland/Son/4058667'}
buttons.radio = {width:12, image: 'img/radio_on.png', title: 'Radio', url: 'http://nederland.fm'}
buttons.nunl = {width:12, icon: 'fa-newspaper-o', title: 'Nu.nl', url: 'http://www.nu.nl'}
//CUSTOM POSITIONING:
//defining wich blocks to show, de numbers represents the IDX of the device in Domoticz
//only define if you want to use a custom width instead of the default
//var blocks = {}
//blocks[1] = {}
//blocks[1]['width'] = 4; //1 to 12, remove this line if you want to use the default (4)
//blocks[1]['title'] = 'Living room' //if you want change the name of switch different then domoticz
//blocks[1]['icon'] = 'fa-eye'; //if you want an other icon instead of the default, choose from: http://fontawesome.io/cheatsheet/
//blocks[1]['image'] = 'bulb_off.png'; //if you want to show an image instead if icon, place image in img/ folder
//blocks[204] = {} //dimmer
//blocks[204]['width'] = 12;
//blocks[204]['title'] = 'Living room' //if you want change the name of switch different then domoticz
//blocks['blocktitle_1'] = {}
//blocks['blocktitle_1']['type'] = 'blocktitle';
//blocks['blocktitle_1']['title'] = 'Schakelaars';
//var columns = {}
//columns[1] = {}
//columns[1]['blocks'] = ['blocktitle_1',1,2,62,'144_2',204,248,295] //remark: idx 144 produces 2 blocks, so you can use: '144_1' and '144_2' (or of course, just 144 if you want one)
//columns[1]['width'] = 5;
//columns[2] = {}
//columns[2]['blocks'] = ['currentweather_big','weather',5,'144_1']
//columns[2]['width'] = 5;
//columns[3] = {}
//columns[3]['blocks'] = ['clock','sunrise','horizon','streamplayer',buttons.buienradar,buttons.radio,buttons.calendar,buttons.nunl,buttons.nzbget]
//columns[3]['width'] = 2;
//var columns_standby = {}
//columns_standby[1] = {}
//columns_standby[1]['blocks'] = ['clock','currentweather_big','weather']
//columns_standby[1]['width'] = 12;
//if you want to use multiple screens, use the code below:
//var screens = {}
//screens[1] = {}
//screens[1]['background'] = 'bg1.jpg';
//screens[1]['background_morning'] = 'bg_morning.jpg';
//screens[1]['background_noon'] = 'bg_noon.jpg';
//screens[1]['background_afternoon'] = 'bg_afternoon.jpg';
//screens[1]['background_night'] = 'bg_night.jpg';
//screens[1]['columns'] = [1,2,3]
//screens[2] = {}
//screens[2]['background'] = 'bg3.jpg';
//screens[2]['background_morning'] = 'bg_morning.jpg';
//screens[2]['background_noon'] = 'bg_noon.jpg';
//screens[2]['background_afternoon'] = 'bg_afternoon.jpg';
//screens[2]['background_night'] = 'bg_night.jpg';
//screens[2]['columns'] = [4,5,6]
Looking forward to your feedback.
thnks in advnce!
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 22:44
by htilburgs
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 22:47
by Blueone
It looks like the domoticz refresh is broken in the latest version, if I look in main.js there is also no code which is using the "_DOMOTICZ_REFRESH" value, only some code which is commented". Removing the comment fixes the issue
Code: Select all
//if(typeof(_DEBUG)=='undefined' || _DEBUG===false) setTimeout(function(){ getDevices(); },(_DOMOTICZ_REFRESH*1000));
}
});
}
else {
//if(typeof(_DEBUG)=='undefined' || _DEBUG===false) setTimeout(function(){ getDevices(); },(_DOMOTICZ_REFRESH*1000));
}
}
I'm also seeing a class is added to a thermostat setpoint at every domoticz refresh:
- Untitled.png (37.85 KiB) Viewed 1709 times
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 23:04
by poudenes
Wheeling wrote:htilburgs wrote:EdKo66 wrote:
Hi @htilburgs
Nice Dash
Can you share the iPhone script with us
I've been looking for it for a long time, but do not get it to work.
Thx
Bennie
Create a DUMMY TEXT device with name "Position PERSOON" and a DUMMY % Device with name "iPhone Battery PERSOON"
Replace PERSOON to what you want and replace that as well in the script
Code: Select all
-- test if they are "home" and represent this using virtual switches
commandArray = {}
-- polling interval in minutes (1-59), setting this too low may drain the phones' batteries
interval = 10
local m = os.date('%M')
if (m % interval == 0) then
json = (loadfile "/home/osmc/domoticz/scripts/lua/JSON.lua")()
-- Array of users to be checked
users = {
PERSOON = {username = "APPLE ID EMAIL" ; password = "PASSWORD" ; devicename = "iPhone Peter"};
}
-- The latitude and longitude of your house (use Google Maps or similar to find this)
homelongitude = 4.870349
homelatitude = 52.333368
-- Radius (in km) which will be used to determine if a device is at home
radius = 0.1
function address(longitude, latitude)
command = "curl -s https://maps.googleapis.com/maps/api/geocode/json?latlng=" .. latitude .. "," .. longitude .. "&sensor=false"
local handle = io.popen(command)
local result = handle:read("*a")
handle:close()
output = json:decode(result)
return output.results[1].formatted_address
end
for user,credentials in pairs(users) do
getlocation = "curl -s -X POST -L -u '" .. credentials.username .. ":" .. credentials.password .. "' -H 'Content-Type: application/json; charset=utf-8' -H 'X-Apple-Find-Api-Ver: 2.0' -H 'X-Apple-Authscheme: UserIdGuest' -H 'X-Apple-Realm-Support: 1.0' -H 'User-agent: Find iPhone/1.3 MeKit (iPad: iPhone OS/4.2.1)' -H 'X-Client-Name: iPad' -H 'X-Client-UUID: d98c8ae0db3311e687b92890643032df' -H 'Accept-Language: en-us' -H 'Connection: keep-alive' https://fmipmobile.icloud.com/fmipservice/device/" .. credentials.username .."/initClient"
local handle = io.popen(getlocation)
local result = handle:read("*a")
handle:close()
output = json:decode(result)
for key,value in pairs(output.content) do
if value.name == credentials.devicename then
lon = value.location.longitude
lat = value.location.latitude
bat = value.batteryLevel * 100 / 1
powerstateval = value.batteryStatus
table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['iPhone Battery ' .. user] .. '|0|' .. bat})
distance = math.sqrt(((lon - homelongitude) * 111.320 * math.cos(math.rad(lat)))^2 + ((lat - homelatitude) * 110.547)^2) -- approximation
position = address(lon,lat)
position_text = string.gsub(position, ', Netherlands', '') .. ' (' .. (math.floor(distance*10+0.5)/10) .. ' km)'
prev_distance_str = string.match(otherdevices['Position ' .. user], '%(.*%)') or '(1000 km)'
prev_distance = tonumber(string.sub(prev_distance_str, 2,-5))
-- update text device, but only if postion has changed more than defined in "radius" to reduce log size
if math.abs(prev_distance - distance) > radius then
table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['Position ' .. user] .. '|0|' .. position_text})
end
print('iPhone ' .. user .. ': ' .. math.floor(distance*100+0.5)/100 .. ' km from home, ' .. bat .. '% battery remaining. PowerState: '.. powerstateval ..' ')
if distance < radius then
if otherdevices['iPhone ' .. user] == 'Off' then
commandArray['iPhone ' .. user] = 'On'
table.insert(commandArray, {['SendNotification'] = 'Presence update#' .. user .. ' came home'})
end
else
if otherdevices['iPhone ' .. user] == 'On' then
commandArray['iPhone ' .. user] = 'Off'
table.insert(commandArray, {['SendNotification'] = 'Presence update#' .. user .. ' left home'})
end
end
end
end
end
end
return commandArray
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 23:06
by Trigun
Unfortunately not working
Sent from my iPhone using Tapatalk
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 23:08
by htilburgs
Trigun wrote:
Unfortunately not working
Sent from my iPhone using Tapatalk
In which folder have you installed Dashticz ??
/domoticz/www/dashticzv2 ??
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 23:10
by Trigun
htilburgs wrote:Trigun wrote:
Unfortunately not working
Sent from my iPhone using Tapatalk
In which folder have you installed Dashticz ??
/domoticz/www/dashticzv2 ??
Yes correct, should be ok right?
Sent from my iPhone using Tapatalk
Re: RE: Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 23:11
by robgeerts
Trigun wrote:
Unfortunately not working
Sent from my iPhone using Tapatalk
Tried adding /index.html ?
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Wednesday 03 May 2017 23:48
by Phantom
i have a request, can you also make a variable for the "state" just like you did for "lastupdate"
Now i see my name with my state below it and i would like to remove that.
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 0:05
by HansieNL
Phantom wrote:i have a request, can you also make a variable for the "state" just like you did for "lastupdate"
Now i see my name with my state below it and i would like to remove that.
Have you tried
blocks[idx]['hide_data'] = true
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 0:13
by Phantom
HansieNL wrote:Phantom wrote:i have a request, can you also make a variable for the "state" just like you did for "lastupdate"
Now i see my name with my state below it and i would like to remove that.
Have you tried
blocks[idx]['hide_data'] = true
Great thanks that worked, where did you find that before i ask a silly question here again xD
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 0:28
by HansieNL
Phantom wrote:HansieNL wrote:Phantom wrote:i have a request, can you also make a variable for the "state" just like you did for "lastupdate"
Now i see my name with my state below it and i would like to remove that.
Have you tried
blocks[idx]['hide_data'] = true
Great thanks that worked, where did you find that before i ask a silly question here again xD
I can't remember when I've added it to my config.js. Must be some time ago. Just added to the Wiki.
AND There are no silly questions as it is not added to the Wiki
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 7:56
by Derik
Got some output...
- ScreenShot240.jpg (81.48 KiB) Viewed 1621 times
Now try to to customizing.
Looks great!!
Please a first step to simple begin.
When i put off the favorites and the automatic.
I don't have any screen [ see no thing ] anymore
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 8:32
by crashingdutchman
robgeerts wrote:Ah, please specify blocks for the standby mode, like:
Code: Select all
var columns_standby = {}
columns_standby[1] = {}
columns_standby[1]['blocks'] = ['clock']
columns_standby[1]['width'] = 12;
Okay, that solved it I don't have a black screen anymore... I think I missed that step somehow. I just don't want the clock but the same screen with all my blocks and have it dim after a while... looking into more details...
Thanks Rob
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 8:39
by Phantom
Derik wrote:Got some output...
ScreenShot240.jpg
Now try to to customizing.
Looks great!!
Please a first step to simple begin.
When i put off the favorites and the automatic.
I don't have any screen [ see no thing ] anymore
When you turn those off you need to activate the the custom position:
http://www.domoticz.com/wiki/Dashticz_V2_-_Positioning
There you can add the devices you want to see and the location where you want to see them.
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 8:54
by Trigun
robgeerts wrote:Trigun wrote:
Unfortunately not working
Sent from my iPhone using Tapatalk
Tried adding /index.html ?
Unfortunately not working either
Shouldn't be that hard right?
Sent from my iPhone using Tapatalk
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 8:56
by crashingdutchman
If I would like to make the block of the traffic map twice as high as it is now, how would I need to do that?
Re: Dashticz v2.0, custom positioning and multiple screens
Posted: Thursday 04 May 2017 9:20
by Blueone
I am handling my thermostat setpoint buttons in the custom.js but I had to change the "Add thermostatFunction" a little bit to make it work:
I had to change this in main.js so you can also use the function from custom.js:
Code: Select all
function addThermostatFunctions(thermelement){
//$(thermelement+' .btn-number').click(function(e) {
$(document).delegate((thermelement+' .btn-number'),"click",function(e){
sliding=true;
fieldName = $(this).attr('data-field');
type = $(this).attr('data-type');
var input = $(thermelement+" strong");
var currentVal = input.text().split('°');
currentVal = parseFloat(currentVal[0]);
if (!isNaN(currentVal)) {
if (type == 'minus') {
if (currentVal > input.attr('min')) {
input.text(currentVal - 0.5 + _TEMP_SYMBOL).change();
switchThermostat(parseFloat(input.text()),input);
}
if (parseFloat(input.text()) == input.attr('min')) {
$(this).attr('disabled', true);
}
} else if (type == 'plus') {
if (currentVal < input.attr('max')) {
input.text(currentVal + 0.5 + _TEMP_SYMBOL).change();
switchThermostat(parseFloat(input.text()),input);
}
if (parseFloat(input.text()) == input.attr('max')) {
$(this).attr('disabled', true);
}
}
} else {
input.text(0);
}
});
$(thermelement+' .input-number').focusin(function() {
$(this).data('oldValue', $(this).text());
});
$(thermelement+' .input-number').change(function() {
minValue = parseFloat($(this).attr('min'));
maxValue = parseFloat($(this).attr('max'));
valueCurrent = parseFloat($(this).text());
name = $(this).attr('name');
if (valueCurrent >= minValue) {
$(thermelement+" .btn-number[data-type='minus']").removeAttr('disabled')
} else {
$(this).val($(this).data('oldValue'));
}
if (valueCurrent <= maxValue) {
$(thermelement+" .btn-number[data-type='plus']").removeAttr('disabled')
} else {
$(this).val($(this).data('oldValue'));
}
});
}
I changed "$(thermelement+' .btn-number').click(function(e) {" to "$(document).delegate((thermelement+' .btn-number'),"click",function(e){". otherwise the clickevent doesn't work when it is added from custom.js with the following code:
Code: Select all
function getBlock_628(device,idx){ //Setpoint block
//CHstate = getDevicestatus(224)
//DHWstate = getDevicestatus(225)
//debugger;
//debug with dummy devices
CHstate = getDevicestatus(631)
DHWstate = getDevicestatus(632)
console.log('CHstate: ' + CHstate)
console.log('DHWstate: ' + DHWstate)
var html='';
html+=iconORimage(idx+'_1','','heating.png','on icon','style="max-height:35px;"');
html+='<div class="col-xs-8 col-data">';
if(typeof(blocks[idx])!=='undefined' && typeof(blocks[idx]['switch'])!=='undefined' && blocks[idx]['switch']==true){
html+='<strong class="title">'+device['Name']+'</strong><br />';
html+='<span class="state">'+device['Data']+_TEMP_SYMBOL+'</span>';
}
else {
html+='<strong class="title">'+device['Data']+_TEMP_SYMBOL+'</strong><br />';
html+='<span class="state">'+device['Name']+'</span>';
}
if(_SHOW_LASTUPDATE && (typeof(blocks[idx])=='undefined' || typeof(blocks[idx]['hide_lastupdate'])=='undefined' || blocks[idx]['hide_lastupdate']===false)){
html+='<br /><span class="lastupdate">'+moment(device['LastUpdate']).format(_LASTUPDATE_FORMAT)+'</span>';
}
html+='</div>';
$('div.block_'+idx+'_1').html(html);
addHTML=false;
html='';
var random = getRandomInt(1,100000);
html+='<ul class="col-thermostat input-groupBtn">';
html+='<li class="up"><a href="javascript:void(0)" class="btn btn-number plus" data-type="plus" data-field="quant['+device['idx']+']" onclick="this.blur();">';
html+='<em class="fa fa-plus fa-small fa-thermostat"></em>';
html+='</a></li>';
html+='<li class="down"><a href="javascript:void(0)" class="btn btn-number min" data-type="minus" data-field="quant['+device['idx']+']" onclick="this.blur();">';
html+='<em class="fa fa-minus fa-small fa-thermostat"></em>';
html+='</a></li>';
html+='</ul>';
if(DHWstate == 'On') {
html+=iconORimage(idx+'_2','','hotwater.png','on icon iconheating','','2');
}
else if(CHstate == 'On') {
html+=iconORimage(idx+'_2','','CH_Active.png','on icon iconheating','','2');
}
else {
html+=iconORimage(idx+'_2','','heating.png','on icon iconheating','','2');
}
html+='<div class="col-xs-8 col-data">';
html+='<strong class="title input-number title-input" min="12" max="25" data-light="'+device['idx']+'">'+device['Data']+_TEMP_SYMBOL+'</strong>';
html+='<div class="state stateheating">'+device['Name']+'</div>';
html+='</div>';
$('div.block_'+idx+'_2').addClass('thermostat'+random).html(html);
$('div.block_'+idx).addClass('thermostat'+random).html(html);
addHTML=false;
thermelement = ('.thermostat'+random);
addThermostatFunctions(thermelement);
return html;
}