show variable on lcd display

Post Reply
adval40
Posts: 8
Joined: Sunday 28 May 2017 18:51
Target OS: Raspberry Pi
Domoticz version: V3.8005
Location: Eindhoven (The netherlands)
Contact:

show variable on lcd display

Post by adval40 » Saturday 02 September 2017 22:32

I want to show variable on lcd display
it doesn't work
I think this is a syntax problem
I have look on several forum but i can't find a solution.

who can help me ?

IP_WOONKAMER = "http://192.168.0.144/control?cmd="
function Isdagnaam()
local dayNow = tonumber(os.date("%w"))
local dagnaam
if (dayNow == 0) then dagnaam = "zondag"
elseif (dayNow == 1) then dagnaam = "maandag"
elseif (dayNow == 2) then dagnaam = "dinsdag"
elseif (dayNow == 3) then dagnaam = "woensdag"
elseif (dayNow == 4) then dagnaam = "donderdag"
elseif (dayNow == 5) then dagnaam = "vrijdag"
elseif (dayNow == 6) then dagnaam = "zaterdag"
end
return dagnaam
end

commandArray=['OpenURL'] =' http://192.168.0.144/control?cmd=lcd,3,1,'..dagnaam..

User avatar
jvdz
Posts: 1062
Joined: Tuesday 30 December 2014 20:25
Target OS: Raspberry Pi
Domoticz version: Stable
Location: Westland/Netherlands
Contact:

Re: show variable on lcd display

Post by jvdz » Saturday 02 September 2017 23:11

Untested, but something like this should be close:

Code: Select all

commandArray = {}

IP_WOONKAMER = "http://192.168.0.144/control?cmd=" 

function Isdagnaam()
	local dayNow = tonumber(os.date("%w"))
	local dagnaam
	if (dayNow == 0) then dagnaam = "zondag"
	elseif (dayNow == 1) then dagnaam = "maandag"
	elseif (dayNow == 2) then dagnaam = "dinsdag"
	elseif (dayNow == 3) then dagnaam = "woensdag"
	elseif (dayNow == 4) then dagnaam = "donderdag"
	elseif (dayNow == 5) then dagnaam = "vrijdag"
	elseif (dayNow == 6) then dagnaam = "zaterdag"
	end 
	return dagnaam
end

commandArray['OpenURL']= IP_WOONKAMER..'lcd,3,1,'..Isdagnaam()

return commandArray
Jos

adval40
Posts: 8
Joined: Sunday 28 May 2017 18:51
Target OS: Raspberry Pi
Domoticz version: V3.8005
Location: Eindhoven (The netherlands)
Contact:

Re: show variable on lcd display

Post by adval40 » Sunday 03 September 2017 1:13

thanks it works now

function Ismaandnaam()
local monthNow = tonumber(os.date("%m"))
local maandnaam
if (monthNow == 1) then maandnaam = "jan"
elseif (monthNow == 2) then maandnaam = "febr"
elseif (monthNow == 3) then maandnaam = "maart"
elseif (monthNow == 4) then maandnaam = "apr"
elseif (monthNow == 5) then maandnaam = "mei"
elseif (monthNow == 6) then maandnaam = "jun"
elseif (monthNow == 7) then maandnaam = "jul"
elseif (monthNow == 8) then maandnaam = "aug"
elseif (monthNow == 9) then maandnaam = "sept"
elseif (monthNow == 10) then maandnaam = "okt"
elseif (monthNow == 11) then maandnaam = "nov"
elseif (monthNow == 12) then maandnaam = "dec"
end
return maandnaam
end

commandArray['OpenURL']= IP_WOONKAMER..'lcd,3,1,' ..Isdagnaam() ..space ..day ..space ..Ismaandnaam() ..space ..year

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests