Hauptmenü

Coding help

Begonnen von andyclimb, 15 März 2013, 08:22:36

Vorheriges Thema - Nächstes Thema

andyclimb

Hi,

I've made a post in the English section but not got a reply yet, I hope its ok to bump it here as well...?

http://translate.googleusercontent.com/translate_c?depth=1&hl=en&ie=UTF8&prev=_t&rurl=translate.google.co.uk&sl=auto&tl=en&u=http://forum.fhem.de/index.php%3Ft%3Dmsg%26th%3D11619%26goto%3D68164%26rid%3D0&usg=ALkJrhi3VTJJ7i9xK-OKGPszZs3oNXVpCQ#msg_68164

I'm struggling to manipulate strings in FHEM / PERL...  

I would like to have a : in the drop down box....  or replace a . with a : so it can be used as time specification...

Essentially I would like my morning heating to be defined by a dummy variable ...  wakeuptime and then adjust the heating accordingly..  Been struggling for a while now and I can't seem to get it to work..

any help would be much appreciated.

Thanks
AM

Groby

Andrew,

I use setList like this (no spaces!):


attr xxx setList setList state:08:00,09:00,10:00,11:00


Best regards, Groby

andyclimb

Hi,

Thanks for getting back to me.  That is exactly what i tried, only i only get the first 08 if i put in 08:00 and none of the rest....

If I put two setLists in as you just described I get two options, state and setlist...

I've attached pictures to show you...

Thank you for your help.

A
AM

Groby

Andrew,

I am not sure what is causing the issue but it might be related to your regional settings if you are running it on a Windows machine. The very same applies for MS Excel (at least older versions) with the csv format (',' vs. ';') depending on the OS language (DE/EN) with the default regional settings.

If this does not help or might not be useful to change it, try to modify the entries to your needs to get them listed.

You can split strings using:


my ($h,$m,$s) = split(":", shift);


I am not sure about the syntax, but the code is taken out of the 99_utils.pm and might help you to "google" more examples of it...

Best regards, Groby