SpaceLogic KNX Forum
Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.
Link copied. Please paste this link to share this article on your social media post.
hello
I want to convert a time object ( datatype: ASCII String) into an integer
to compare it with the current time.
I tried to use string.format and string.gmatch but I get an error in the error log.
if there are some examples or ideas.
best regards,
Link copied. Please paste this link to share this article on your social media post.
Then string.split(value,':') is your friend (:
splitted = string.split(event.getvalue(),':')
hour = tonumber(splitted[1])
minute = tonumber(splitted[2])
log(hour,minute)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Can you give a sample how the time is formated? Is it xx:xx::xx ?
Where is this time comming from as the normal 3byte time object holds a table with day/hour/min/sec and you mention a string,
we can do a string.split('13:14:15', ':') and that would return a table with 3 values -> {hour, min,sec} -> {13,14,15}
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Then string.split(value,':') is your friend (:
splitted = string.split(event.getvalue(),':')
hour = tonumber(splitted[1])
minute = tonumber(splitted[2])
log(hour,minute)
Link copied. Please paste this link to share this article on your social media post.
I got this error :
Resident script:13: attempt to index global 'spliited' (a nil value) stack traceback:
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.