Dashticz - General Discussions

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Locked
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by poudenes »

After replace with this script, everything updated again and no errors :D
wizjos wrote:OK I think I've got the moonphase lua script working again. I made the mistake to assume lua has a function 'round' when porting it from js to lua.
But now I think I've 'floored' the problem :lol:
New Moonphase LUA script:

Code: Select all

-- Variables to customize ------------------------------------------------
local moonpicture = "MoonPicture"           -- name of the uservar to write the name of the moonphase picture to
local checkvar = "MoonphaseCheck"           -- name of the uservar to check if update is allowed
local checktime = 3600                      -- check allowed every x seconds 3600 = 60 min. Check the wundergroud API limitation before changing this
local city = "<your town>"                        -- Your city for Wunderground API
local countryCode = "<YOUR COUNTRY CODE>"                    -- Your country code for Wunderground API
local idxmoonpercentage ='125'              -- Your virtual moon percentage illuminated Device ID
local idxmoonage ='131'                     -- Your virtual moon age Device ID
local idxmoonphase ='132'                   -- Your virtual moon phase Device ID
local idxmoonrise='124'                     -- Your virtual moon rise variable ID
local idxmoonset='127'                      -- Your virtual moon set variable ID
local wuAPIkey = "<your key>"         -- Your Weather Underground API Key
local DOMO_IP = "<your domo ip>"            -- Domoticz ip address
local DOMO_PORT = "<your domo port>"                    -- Domoticz port
local tempfilename = '/var/tmp/phase.tmp'   -- can be anywhere writeable
local debug=false                            -- false, true for domoticz log
-------------------------------------------------------------------------

function file_exists(path)
    -- function to check if a file exists
    local file = io.open(path, "rb")
    if file then file:close() end
    return file ~= nil
end

function timedifference(s)
    -- function to determine the difference in seconds between the current time and a given one
    year = string.sub(s, 1, 4)
    month = string.sub(s, 6, 7)
    day = string.sub(s, 9, 10)
    hour = string.sub(s, 12, 13)
    minutes = string.sub(s, 15, 16)
    seconds = string.sub(s, 18, 19)
    t1 = os.time()
    t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
    difference = os.difftime (t1, t2)
    return difference
end

function may_update(device, timeelapsed)
    -- function to check whether an update is allowed
    return uservariables_lastupdate[device] == nil or timedifference(uservariables_lastupdate[device]) >= timeelapsed
end

commandArray = {}
    time = os.date("*t")
    url='http://api.wunderground.com/api/'..wuAPIkey..'/astronomy/q/'..countryCode..'/'..city..'.json'
    if (may_update(checkvar,checktime)==true) or (file_exists(tempfilename)==false) then
       -- read API Wunderground
        if debug then print("Moonphase - Collecting data from: "..url) end
        os.execute('curl -s '..url..' > '..tempfilename)
        -- NOTE: if the command above doens't work in your situation try
        -- read = os.execute('curl -s -o '..tempfilename..' "'..url..'"')
        -- instead! Thanks to EdKo66
        file = io.open(tempfilename, "r")
        s= file:read("*a")
        s = (string.gsub(s, "%c+", ""))
        file:close()

        -- moonrise
        moonriseHour, moonriseMinute = string.match(s, [["moonrise": {"hour":"(%d+)","minute":"(%d+)"]])
        if debug then print("Moonrise:\t"..moonriseHour..":"..moonriseMinute) end
        -- moonset
        moonsetHour, moonsetMinute = string.match(s, [["moonset": {"hour":"(%d+)","minute":"(%d+)"]])
        if debug then print("Moonset:\t"..moonsetHour..":"..moonsetMinute) end

        -- percentage of moon illuminated
        percentIlluminated = string.match(s, [["percentIlluminated":"(%d+)"]])
        if debug then print("Percent:\t"..percentIlluminated.."%") end

        -- age of moon since last new moon
        age = string.match(s, [["ageOfMoon":"(%d+)"]])
        if debug then print("Age:\t\t"..age) end

        -- Phase of the moon
        -- set the moonPhaseIcon to your appropriate icon number (8 x)
        moonPhase = string.match(s, [["phaseofMoon":"(.-)"]])
        if moonPhase=="New Moon" then
            moonPhase = "Nieuwe maan"
            is_waxing = true
        end
        if moonPhase=="Waxing Crescent" then
            moonPhase = "Wassende halve maan"
            is_waxing = true
        end
        if moonPhase=="First Quarter" then
            moonPhase = "Eerste kwartier"
            is_waxing = true
        end
        if moonPhase=="Waxing Gibbous" then
            moonPhase = "Wassende maan"
            is_waxing = true
        end
        if moonPhase=="Full" then
            moonPhase = "Volle maan"
            is_waxing = false
        end
        if moonPhase=="Waning Gibbous" then
            moonPhase = "Afnemende maan"
            is_waxing = false
        end
        if moonPhase=="Last Quarter" then
            moonPhase = "Laatste kwartier"
            is_waxing = false
        end
        if moonPhase=="Waning Crescent" then
            moonPhase = "Afnemende halve maan"
            is_waxing = false
        end

        -- calculate moonphase picture
        if percentIlluminated == '0' then
            n='50'
        else
            if waardecheck==false then
                picnumber=math.floor(math.abs(percentIlluminated-100)/2)
                n=tostring(picnumber)
                if n.length==1 then
                    n='0'+n
                end
            else
                picnumber=math.floor(50+(percentIlluminated/2))
                if picnumber == 100 then
                  picnumber=99
              end
            end
            n=tostring(picnumber)
        end
        picture='moon.'..n..'.png'
        if debug then print('Picture number: '..n..' '..'Picture name: '..picture) end
   
        commandArray['Variable:'..checkvar]=moonPhase
        commandArray['Variable:'..moonpicture]=picture
        commandArray[1] = {['UpdateDevice'] = idxmoonphase.."|0|"..moonPhase}
        commandArray[2] = {['UpdateDevice'] = idxmoonrise.."|0|"..moonriseHour..":"..moonriseMinute}
        commandArray[3] = {['UpdateDevice'] = idxmoonset.."|0|"..moonsetHour..":"..moonsetMinute}
        commandArray[4] = {['UpdateDevice'] = idxmoonage.."|0|"..age}
        commandArray[5] = {['UpdateDevice'] = idxmoonpercentage.."|0|"..percentIlluminated}
    else
        if debug then print("MoonPhase - Update not allowed: Difference is "..timedifference(uservariables_lastupdate[checkvar]).." seconds") end
    end

return commandArray

Please confirm...

Regards
Wizjos
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

Ierlandfan wrote: add frames.calendar to some column.

Edit: For some reason when dashboard reloads the page the calendar isn't filled anymore. Need to look into that.
Enjoy
Thank you, maybe I am going to develop an advanced plugin for this (with iCal support, so you can use any Calendar application which support it: Apple Calendar, Google Calendar etc.).
User avatar
wizjos
Posts: 79
Joined: Monday 07 March 2016 19:35
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by wizjos »

madrian wrote:
Ierlandfan wrote: add frames.calendar to some column.

Edit: For some reason when dashboard reloads the page the calendar isn't filled anymore. Need to look into that.
Enjoy
Thank you, maybe I am going to develop an advanced plugin for this (with iCal support, so you can use any Calendar application which support it: Apple Calendar, Google Calendar etc.).
+1 :!:
At the moment struggling with this myself...
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by poudenes »

madrian wrote:
Ierlandfan wrote: add frames.calendar to some column.

Edit: For some reason when dashboard reloads the page the calendar isn't filled anymore. Need to look into that.
Enjoy
Thank you, maybe I am going to develop an advanced plugin for this (with iCal support, so you can use any Calendar application which support it: Apple Calendar, Google Calendar etc.).
That will be a great idea :) i can't wait already ...
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

OK guys, I opened a ticket for this on GitHUB, we'll see when it's coming. :)
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by robgeerts »

madrian wrote:
Ierlandfan wrote: add frames.calendar to some column.

Edit: For some reason when dashboard reloads the page the calendar isn't filled anymore. Need to look into that.
Enjoy
Thank you, maybe I am going to develop an advanced plugin for this (with iCal support, so you can use any Calendar application which support it: Apple Calendar, Google Calendar etc.).
I will look into this tonight, unless you are already on it..

Blueone wrote:I have the following block:
columns[2] = {}
columns[2]['blocks'] = ['blocktitle_Verbruik','281_1','281_2','282']
columns[2]['width'] = 6;


Device 281 is the powerusage and 282 the gas usage.
When I click the gas block the graph is showing in a popup. When I click the power blocks the graph isn't showing, probably because of the _1 and _2, is it possible to show the graph also at these kind of blocks?
Will fix this asap!

mvveelen wrote:
mvveelen wrote:I was wondering: Is it possible to get the "var _SHOW_LASTUPDATE" per device?

For instance: I couldn't care less when the last time it was when I switch off a light, but it would be nice to see when a door sensor has been opened/closed.
And another question: I'd like to display the CV pressure (general, pressure), but all I see is: "Nefit - CV druk : AAN", where it should read 1.6 BAR. Is it possible to change that too ?
Could you send me the device output?
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

I am on it, we'll see how it goes.
Ierlandfan
Posts: 89
Joined: Friday 09 October 2015 17:40
Target OS: Linux
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by Ierlandfan »

I have a new idea for Toon and I think it's already possible but I am not sure.

The roomsetpoint now shows a icon. I would be nice if this icon resembles the state of the burner ("Heating on" which is a switch)
Can we have the icon resembles the heating (switch on/off) while the room setpoint part stays the same?

Output of switch "Heating on"

Code: Select all

 {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "On",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 3,
         "HardwareName" : "Toon",
         "HardwareType" : "Toon Thermostat",
         "HardwareTypeVal" : 34,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "0000071",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2017-04-27 20:44:00",
         "Level" : 100,
         "LevelInt" : 15,
         "MaxDimLevel" : 15,
         "Name" : "HeatingOn",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "On",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "AC",
         "SwitchType" : "On/Off",
         "SwitchTypeVal" : 0,
         "Timers" : "false",
         "Type" : "Lighting 2",
         "TypeImg" : "lightbulb",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "38"
      },
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

Work in progress. 8-)
Screen-Shot-2017-04-27-21-06-07.png
Screen-Shot-2017-04-27-21-06-07.png (175.09 KiB) Viewed 1653 times
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by robgeerts »

New version is live.
Check out the fixes at:
https://github.com/robgeerts/dashticz_v ... dated-desc
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by poudenes »

madrian wrote:Work in progress. 8-)

Screen-Shot-2017-04-27-21-06-07.png
Cool, and so fast... To bad im not into programming... haha Im a happy user
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Ierlandfan
Posts: 89
Joined: Friday 09 October 2015 17:40
Target OS: Linux
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by Ierlandfan »

Would the original creator of the "trash"/"bin"/"afvalwijzer" lua script step in? I hate not to give credits where credits are due.
I never mentioned him/her because it was a modified script for personal use without original creator name and I can't find the original message.
Everyone is quoting me while i just modified the script. My fault. I am sorry for that. Give me a PM and I 'll make it up to you.
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

It's live, merge request was sent to Rob.

Until he accepts the request, go and find your iCal URL at Google Calendar:

Gear Icon -> Settings -> Calendars Tab -> click on desidered calendar name -> in Private address row click on ical icon and copy your URL.

The plugin (it shows the next 5 events):
Screen-Shot-2017-04-27-23-21-52.png
Screen-Shot-2017-04-27-23-21-52.png (202.91 KiB) Viewed 1606 times
;)
robgeerts
Posts: 1273
Joined: Saturday 24 January 2015 22:12
Target OS: NAS (Synology & others)
Domoticz version: 3.7067
Location: NL
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by robgeerts »

Thanks, I will do some testing tomorrow night and merge it with the beta branch!

By the way, is it xompatible with 24-hour format and multiple language s (didnt take a look at the code yet)
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

robgeerts wrote:Thanks, I will do some testing tomorrow night and merge it with the beta branch!

By the way, is it xompatible with 24-hour format and multiple language s (didnt take a look at the code yet)
Of course it is, you can set date/time format from CONFIG.js (it is accepting moment.js format) or IMHO the best (default) is to show event time in "friendly" format -> Tomorrow at XY, etc... you can change the locale for this one too.
User avatar
HansieNL
Posts: 964
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by HansieNL »

Ierlandfan wrote:I have a new idea for Toon and I think it's already possible but I am not sure.

The roomsetpoint now shows a icon. I would be nice if this icon resembles the state of the burner ("Heating on" which is a switch)
Can we have the icon resembles the heating (switch on/off) while the room setpoint part stays the same?
As far as I know this was already on the to do list. I hope it will be integrated soon.
Maybe the Toon selector switch can be the same.
Blah blah blah
User avatar
mvveelen
Posts: 697
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by mvveelen »

robgeerts wrote:
mvveelen wrote:
mvveelen wrote:I was wondering: Is it possible to get the "var _SHOW_LASTUPDATE" per device?

For instance: I couldn't care less when the last time it was when I switch off a light, but it would be nice to see when a door sensor has been opened/closed.
And another question: I'd like to display the CV pressure (general, pressure), but all I see is: "Nefit - CV druk : AAN", where it should read 1.6 BAR. Is it possible to change that too ?
Could you send me the device output?
Don't know the exact JSON for this device,

but when I open "http://192.168.0.124:8084/json.htm?type ... 529&plan=0" I get:

Code: Select all

     {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "1.3 Bar",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 10,
         "HardwareName" : "Nefit Easy SYNO",
         "HardwareType" : "Nefit Easy HTTP server over LAN interface",
         "HardwareTypeVal" : 68,
         "HaveTimeout" : false,
         "ID" : "00000101",
         "LastUpdate" : "2017-04-28 07:28:09",
         "Name" : "Nefit - CV druk",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Pressure" : 1.3,
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "SubType" : "Pressure",
         "Timers" : "false",
         "Type" : "General",
         "TypeImg" : "gauge",
         "Unit" : 1,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "807"
      },
      
madrian wrote:It's live, merge request was sent to Rob.

Until he accepts the request, go and find your iCal URL at Google Calendar:

Gear Icon -> Settings -> Calendars Tab -> click on desidered calendar name -> in Private address row click on ical icon and copy your URL.

The plugin (it shows the next 5 events):

Screen-Shot-2017-04-27-23-21-52.png
;)
Will there be a version in which we can use the Apple (iCloud) calendar ?
Turn off last update date per device enhancement
#18 by robgeerts was closed 12 hours ago updated 12 hours ago
Does this mean we can show the last update per device? If so, how :) ?

Edit:

Would it be possible to add a wiki-file / how-to / readme for the extra's some users have made?

For instance:

- The waste calendar: how-to ad the switch, the contents of the lua script, etc.
- The moon add-on: what switches to add (and how), etc (nice, but not really sure HOW to add which switches etc).
- The calendar add-on (most recent)
- How to adjust the height (and witdh) of the traffic
- etc.

We can read this topic, but if it is in the package, then it would me much easier to maintain and find. Right?
Last edited by mvveelen on Friday 28 April 2017 8:41, edited 2 times in total.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
madrian
Posts: 231
Joined: Saturday 27 August 2016 1:18
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by madrian »

Hmmm, I thought that it is possible to export .ics from Apple Calendar, but now I can't find it. This needs more research.
User avatar
mvveelen
Posts: 697
Joined: Friday 31 October 2014 10:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by mvveelen »

madrian wrote:Hmmm, I thought that it is possible to export .ics from Apple Calendar, but now I can't find it. This needs more research.
Yes, it's possible. But that's a one-time export, and it would be better if you can just add the 'live' calendar.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Xiaomi Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
TapNL
Posts: 30
Joined: Monday 24 April 2017 21:52
Target OS: -
Domoticz version:
Contact:

Re: Dashticz v2.0, custom positioning and multiple screens

Post by TapNL »

Would it be possible to add a wiki-file / how-to / readme for the extra's some users have made?

For instance:

- The waste calendar: how-to ad the switch, the contents of the lua script, etc.
- The moon add-on: what switches to add (and how), etc (nice, but not really sure HOW to add which switches etc).
- The calendar add-on (most recent)
- How to adjust the height (and witdh) of the traffic
- etc.

We can read this topic, but if it is in the package, then it would me much easier to maintain and find. Right?
I think this is a good idea, and are more then happy to contribute to this.
The way I imagine it is that we make per function as short description in the wiki and keep updating that.
If we create a trello board of functions that need to be fixed and functions that changed we can set this up quite easy.

@Rob: what do you think?
@Others: who wants to participate?
Locked

Who is online

Users browsing this forum: No registered users and 1 guest