Page 2 of 3

Re: Dashticz - Module Moonphases

Posted: Sunday 04 February 2018 23:15
by clubeddie
Cannot seems to get it working. Created 2 dummy switches
MoonPicture
MoonPhaseCheck

Then created 5 devices on the MoonPhaseCheck
Did not create any device on the MoonPicture (i cannot found info on this, but i think i must do here someting)

Adjust the script and placed it. That's all working, i retrieve data on the 5 devices. I can display data in Dashticz, but it don't show the image of the moon. Someone above said " (e.g. the MoonPicture variable contains "moon.89.png") " but i don't have this.
So i think i have to create a variable on MoonPicture, but cannot find any info. Can anyone help me?

Re: Dashticz - Module Moonphases

Posted: Monday 05 February 2018 9:54
by CaesarPL
clubeddie wrote: Sunday 04 February 2018 23:15 Cannot seems to get it working. Created 2 dummy switches
MoonPicture
MoonPhaseCheck
Why switches? Instruction is VERY clear describing it:
'2 uservariables'

Re: Dashticz - Module Moonphases

Posted: Monday 05 February 2018 11:28
by clubeddie
CaesarPL wrote: Monday 05 February 2018 9:54
clubeddie wrote: Sunday 04 February 2018 23:15 Cannot seems to get it working. Created 2 dummy switches
MoonPicture
MoonPhaseCheck
Why switches? Instruction is VERY clear describing it:
'2 uservariables'
Ok, i am confused, i read this;

As you can see there are some (dummy) devices that need to be created in Domoticz. 2 uservariables:
User variable Type
MoonPicture STRING
MoonphaseCheck STRING

So in hardware i created a dummy moonpicture and moonphasecheck.
In the dummy moonphase check i created 5 virtual sensors that are working.

How can i create a uservariable?

Edit: i found it. Menu never used before so i am trying to get it working. Thanks for your reply!

Re: Dashticz - Module Moonphases

Posted: Friday 09 February 2018 17:30
by Plaffie
I have a strange problem. The moonpicture is the wrong side. The moon is waning crescent phase but the picture shows a waxing crescent phase. Am i the only one with this problem? i could rename all the pictures but maybe there is an easier solve. Is there a list with moonphase <-> picturenumber?

Re: Dashticz - Module Moonphases

Posted: Saturday 10 February 2018 14:30
by RobertK
What coincidence... I was looking and wondering about the same thing yesterday. So, no you're not the only one. My picture also shows the
illuminated part at the wrong side.

I was looking at the moonphase script due to another problem I had. The script_time_moon.lua script polled the wunderground website every minute,
so I received the well known API usage alert email "Your wunderground API key (******) exceeded its allotted usage today by making 511 calls in a day but the limit is 500.".
By now, I have found the problem for this issue on my side, so I toss in here, maybe it's useful for anyone else as well:
The script itself is being called every 60 seconds. However, in the script is a timecheck that compares the current time against the time of the last
update of the 'MoonphaseCheck' user variable in Domoticz. If the time difference is less than 3600 seconds (1 hour), the poll to the wunderground
website is skipped. In my case, I had a typo in the variable name (MoophaseCheck) so the actual MoonphaseCheck variable itself didn't actually
exist in in my system and because of that, time difference check resulted every time in 3600. And this again resulted in a new poll to the wunderground website every 60 seconds...
Maybe this is helpful to know for every anyone else: Check this variable name. (I would have found it more logical to compare e.g. the update time of
the used '/var/tmp/phase.tmp' file with the current os-time, instead of checking a Domoticz user variable, but that's my opinion :)).

Back to the incorrect picture: The picture number to be displayed is also calculated in this same .lua script.
The variable 'waardecheck' on line 123 in the script should likely be changed into 'is_waxing'. The 'is_waxing' variable is only set in
the statements above but its value is never used, while it probably should be the trigger to step into the 'if' part of the if-else statement
of lines 123 - 136.
Changing this variable will show the correct picture again.

Re: Dashticz - Module Moonphases

Posted: Sunday 11 February 2018 13:02
by Plaffie
RobertK wrote: Saturday 10 February 2018 14:30 What coincidence... I was looking and wondering about the same thing yesterday. So, no you're not the only one. My picture also shows the
illuminated part at the wrong side.

...

Back to the incorrect picture: The picture number to be displayed is also calculated in this same .lua script.
The variable 'waardecheck' on line 123 in the script should likely be changed into 'is_waxing'. The 'is_waxing' variable is only set in
the statements above but its value is never used, while it probably should be the trigger to step into the 'if' part of the if-else statement
of lines 123 - 136.
Changing this variable will show the correct picture again.
Thanks. changing the variable solved the problem.

Re: Dashticz - Module Moonphases

Posted: Sunday 11 February 2018 13:29
by clubeddie
Plaffie wrote: Sunday 11 February 2018 13:02
RobertK wrote: Saturday 10 February 2018 14:30 What coincidence... I was looking and wondering about the same thing yesterday. So, no you're not the only one. My picture also shows the
illuminated part at the wrong side.

...

Back to the incorrect picture: The picture number to be displayed is also calculated in this same .lua script.
The variable 'waardecheck' on line 123 in the script should likely be changed into 'is_waxing'. The 'is_waxing' variable is only set in
the statements above but its value is never used, while it probably should be the trigger to step into the 'if' part of the if-else statement
of lines 123 - 136.
Changing this variable will show the correct picture again.
Thanks. changing the variable solved the problem.
Okay, how must the sentence be then?
Something like this?

Code: Select all

 if waardecheck==is_waxing then

Re: Dashticz - Module Moonphases

Posted: Sunday 11 February 2018 13:36
by RobertK
Just replace waardecheck into is_waxing, like:

Code: Select all

if is_waxing==false then
    picnumber=math.floor(...etc...)

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 11:00
by florisi
jvanthof wrote: Monday 09 October 2017 23:59 The Moon Phase module is not showing the images of the moon... I think I have followed all the instructions to the letter. The /var/tmp/phases.tmp file is filled with info. The dummy devices and user variables get filled with information (e.g. the MoonPicture variable contains "moon.89.png") but on the dashticz website: nada...

When I inspect the elements using the developer tools of Safari, it looks like the image is not properly set in the DOM:

Code: Select all

<div class="col-xs-12 transbg imgblock imgblock17610" data-id="buttons.UNKNOWN">
  <div class="col-xs-12">
    <div class="moon"></div>
  </div>
</div>
The "buttons.UNKNOWN" doesn't look right...

My CONFIG.js (I thinks there's a typo on the Wiki btw...) contains these lines:

Code: Select all

buttons.moon = {width:12, isimage:true, refreshimage:60000, image:'moon'}
and

Code: Select all

columns[1] = {}
columns[1]['blocks'] = ['garbage','s1',buttons.moon]
columns[1]['width'] = 5;
Anyone knows what I'm missing?
I'm having the same issue.
Changed my CONFIG.js with config['idx_moonpicture'] = 1 (this the index of the uservariable)

Can someone help me with this?

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 12:02
by RobertK
Can you mention what steps/code you have already inserted yourself in the CONFIG.js file?
And if the file /var/temp/phase.tmp indeed contains the correct information, retrieved from wunderground?

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 12:26
by florisi
Here is my CONFIG.js
All the dummy devices get the right values, so the temp file is correct.


var config = {}
config['language'] = 'nl_NL';
config['domoticz_ip'] = 'http://xxxxxxxxxxxxxxxxx';
config['app_title'] = 'ControlCenter';
config['domoticz_refresh'] = '5';
config['dashticz_refresh'] = '60';

config['calendarformat'] = 'dd DD.MM HH:mm';
config['calendarlanguage'] = 'nl_NL';
config['auto_positionning'] = 0;
config['idx_moonpicture'] = 1;

config['garbage_company'] = 'afvalwijzerarnhem';
config['garbage_icalurl'] = 0;
config['garbage_zipcode'] = 'xxxxxx';
config['garbage_street'] = 'xxxxxxx';
config['garbage_housenumber'] = '9';
config['garbage_maxitems'] = '12';
config['garbage_width'] = '12';
config['garbage_hideicon'] = 0;
config['garbage_use_names'] = true;
config['garbage_use_colors'] = true;
config['garbage_icon_use_colors'] = true;
config['garbage_use_cors_prefix'] = true;
config['garbage'] = {
gft: {kliko: 'green', code: '#375b23', name: 'GFT', icon: 'img/garbage/kliko_green.png'},
pmd: {kliko: 'orange', code: '#db5518', name: 'PMD', icon: 'img/garbage/kliko_orange.png'},
rest: {kliko: 'grey', code: '#5e5d5c', name: 'Restafval', icon: 'img/garbage/kliko_grey.png'},
papier: {kliko: 'blue', code: '#153477', name: 'Papier', icon: 'img/garbage/kliko_blue.png'},
kca: {kliko: 'red', code: '#b21807', name: 'Chemisch afval', icon: 'img/garbage/kliko_red.png'},
brown: {kliko: 'brown', code: '#7c3607', name: 'Bruin', icon: 'img/garbage/kliko_brown.png'},
black: {kliko: 'black', code: '#000000', name: 'Zwart', icon: 'img/garbage/kliko_black.png'},
milieu: {kliko: 'yellow', code: '#f9e231', name: 'Geel', icon: 'img/garbage/kliko_yellow.png'},
kerstboom: {kliko: 'green', code: '#375b23', name: 'Kerstboom', icon: 'img/garbage/tree.png'},

};

var coins = {}
coins.bitcoin = { key:'bitcoin', currency: 'EUR', layout:'vertical',width:6 }
coins.monero = { key:'monero', currency: 'EUR', layout:'vertical',width:6 }
coins.bitcoincash = { key:'bitcoin-cash', amount: 0.03071800, currency: 'EUR', width:12 }

var trashnames = {}
trashnames['Gft'] = 'GFT';
trashnames['Papier en Karton'] = 'Papier';
trashnames['Plastic, Metalen en Drankkartons(PMD)'] = 'Plastic';
trashnames['Rest'] = ''; //LEAVE EMPTY IF YOU WANT TO HIDE IT

var calendars = {}
calendars.business = { maxitems: 8, icalurl: 'https://calendar.google.com/calendar/ic ... /basic.ics' }

var publictransport = {}
publictransport.ovinfobus = { show_via: false, station: 'arnhem/bushalte-keulse-slag', provider: '9292-bus', icon: 'bus', width:5, results: 6 }

var tvguide = {}
tvguide.dutch = { key:'dutch', icon: 'fa-television', width:7, channels: [1,2,3,148], maxitems: 10 }

var _STREAMPLAYER_TRACKS = [
{"track":1,"name":"Q-music","file":"http://icecast-qmusic.cdp.triple-it.nl/ ... ive_96.mp3"},
{"track":2,"name":"538 Hitzone","file":"http://vip-icecast.538.lw.triple-it.nl/WEB11_MP3"},
{"track":3,"name":"Slam! NonStop","file":"http://stream.radiocorp.nl/web10_mp3"},
{"track":4,"name":"100%NL","file":"http://stream.100p.nl/100pctnl.mp3"},
];

var buttons = {}
buttons.nunl = {key: 'nunl', width:12, icon: 'fa-newspaper-o', title: 'Nu.nl', newwindow:true, url: 'http://www.nu.nl'}
buttons.nos = {key: 'nos', width:12, icon: 'fa-newspaper-o', title: 'Nos', url: 'http://www.nos.nl'}
buttons.moon = {width:12, isimage:true, refreshimage:60000, image: 'moon'}

var blocks = {}
blocks['blocktitle_1'] = {}
blocks['blocktitle_1']['key'] = 'blocktitle_1';
blocks['blocktitle_1']['type'] = 'blocktitle';
blocks['blocktitle_1']['title'] = 'Example';


var columns = {}
columns['bar'] = {}
columns['bar']['blocks'] = ['logo','miniclock','settings']

columns[1] = {}
columns[1]['blocks'] = [buttons.moon,'garbage',coins.bitcoin,coins.monero,calendars.business]
columns[1]['width'] = 6;

columns[2] = {}
columns[2]['blocks'] = ['blocktitle_1',tvguide.dutch,publictransport.ovinfobus]
columns[2]['width'] = 4;

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 13:09
by RobertK
I do get the moon picture (A big black circle, with just a small enlighted part today) with your CONFIG.js, so this CONFIG.js file does not seem be the problem.
When you look in the Domoticz (not Dashticz) dashboard itself and check the 'Current value' of the 'MoonPicture' user variable (Setup -> More Options - User Variables), does it show a filename there (like moon.44.png)?
If you do not see a User Variable there, then that may be your issue and you would need to create them (MoonphaseCheck and MoonPicture).

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 13:14
by florisi
Yes, it does show moon.55.png

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 13:48
by RobertK
In the main.js script, I see that the IP-address is likely used to find your pictures:

Code: Select all

function getMoonInfo(image){
   req = $.getJSONP({
      url: settings['domoticz_ip']+"/json.htm?type=command&param=getuservariable&idx="+settings['idx_moonpicture']+"&jsoncallback=?",
      type: 'GET',async: true,contentType: "application/json",dataType: 'jsonp',
...
This:
config['domoticz_ip'] = 'http://xxxxxxxxxxxxxxxxx';

is the only thing I did not use from your file, since that needs to reflect my personal IP-address
Can you check if that address (with portnumber) is really correct and reflects where your Domoticz installation is running?
Something like: 'http://192.168.1.100:8080';

Another thing you may want to check: Are the pictures really present in your dasticz_v2/img/moon folder? (I would not know
why they wouldn't be there, but I'm trying to exhaust all possibilities I can think of).

BTW. the picture that is showing in your User variable is not the correct one, but that's a different issue. See a couple of post back (last weekend), about the 'waardecheck' variable in your .lua script.

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 14:10
by florisi
Solved.
It was an issue with the ip-address.

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 14:59
by florisi
By the way, the uservariable shows now: moon.45.png
Is this the correct one?

Re: Dashticz - Module Moonphases

Posted: Monday 12 February 2018 15:07
by clubeddie
RobertK wrote: Sunday 11 February 2018 13:36 Just replace waardecheck into is_waxing, like:

Code: Select all

if is_waxing==false then
    picnumber=math.floor(...etc...)
That solved the problem! Thank you.

Re: Dashticz - Module Moonphases

Posted: Saturday 03 March 2018 10:53
by brain
hi the moon module stops working this morning does anyone has this problem ?

thanx

Re: Dashticz - Module Moonphases

Posted: Saturday 03 March 2018 16:40
by Jan Jansen
+1

Re: Dashticz - Module Moonphases

Posted: Saturday 03 March 2018 17:06
by clubeddie
brain wrote: Saturday 03 March 2018 10:53 hi the moon module stops working this morning does anyone has this problem ?

thanx
Same here