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![]()
New Moonphase LUA script:Please confirm...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
Regards
Wizjos
Dashticz - General Discussions
Moderators: leecollings, htilburgs, robgeerts
-
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
After replace with this script, everything updated again and no errors 
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Re: Dashticz v2.0, custom positioning and multiple screens
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.).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
- 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
+1madrian wrote: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.).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
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
That will be a great ideamadrian wrote: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.).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
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Re: Dashticz v2.0, custom positioning and multiple screens
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
I will look into this tonight, unless you are already on it..madrian wrote: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.).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
Will fix this asap!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?
Could you send me the device output?mvveelen wrote: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 ?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.
Re: Dashticz v2.0, custom positioning and multiple screens
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
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"
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"
},Re: Dashticz v2.0, custom positioning and multiple screens
Work in progress.
-
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
Cool, and so fast... To bad im not into programming... haha Im a happy usermadrian wrote:Work in progress.![]()
Screen-Shot-2017-04-27-21-06-07.png
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
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.
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.
Re: Dashticz v2.0, custom positioning and multiple screens
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):

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):
-
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
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)
By the way, is it xompatible with 24-hour format and multiple language s (didnt take a look at the code yet)
Re: Dashticz v2.0, custom positioning and multiple screens
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.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)
- HansieNL
- Posts: 969
- Joined: Monday 28 September 2015 15:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Dashticz v2.0, custom positioning and multiple screens
As far as I know this was already on the to do list. I hope it will be integrated soon.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?
Maybe the Toon selector switch can be the same.
Blah blah blah
- mvveelen
- Posts: 710
- 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
Don't know the exact JSON for this device,robgeerts wrote:Could you send me the device output?mvveelen wrote: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 ?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.
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"
},
Will there be a version in which we can use the Apple (iCloud) calendar ?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
Does this mean we can show the last update per device? If so, howTurn off last update date per device enhancement
#18 by robgeerts was closed 12 hours ago updated 12 hours ago
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/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
Re: Dashticz v2.0, custom positioning and multiple screens
Hmmm, I thought that it is possible to export .ics from Apple Calendar, but now I can't find it. This needs more research.
- mvveelen
- Posts: 710
- 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
Yes, it's possible. But that's a one-time export, and it would be better if you can just add the 'live' calendar.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.
RPi3b+/RFXCOM rfxtrx433E/Shelly/Sonoff Zigbee Gateway/Philips HUE Lights/Atag Zone One/2 SunnyBoy inverters/AirconWithMe/P1 smartmeter/Domoticz latest Beta
Re: Dashticz v2.0, custom positioning and multiple screens
I think this is a good idea, and are more then happy to contribute to this.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?
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?
Who is online
Users browsing this forum: No registered users and 1 guest