Autor Thema: Semikolon verdoppeln  (Gelesen 218 mal)

Offline dero

  • Full Member
  • ***
  • Beiträge: 248
Semikolon verdoppeln
« am: 29 November 2022, 19:09:43 »
Hey,

bin jahrelanger FHEM-Nutzer, aber eins habe ich immernoch nicht kapiert: Was ist der genaue Grund, warum man Semikolons verdoppeln muss?

Danke!

Dero

Online KölnSolar

  • Developer
  • Hero Member
  • ****
  • Beiträge: 5785
Antw:Semikolon verdoppeln
« Antwort #1 am: 29 November 2022, 19:13:26 »
commandref
Zitat
Multiple FHEM commands are separated by semicolon (;). In order to use semicolon in perl code or shell programs, they have to be escaped by the double semicolon (;;). See the Notes section of the notify chapter on command parameters and escape rules.
E.g. the following first command switches Lamp1 off at 07:00 and Lamp2 immediately (at the point of definition), the second one switches both lamps off at 07:00.
define lampoff at 07:00 set Lamp1 off; set Lamp2 off
define lampoff at 07:00 set Lamp1 off;; set Lamp2 off
For every further indirection you need to double the semicolons:, e.g. to switch on every day 2 devices at 7:00 for 10 minutes you have to write:
define onAt at 07:00 set Lamp1 on;;set Lamp2 on;; define offAt at +00:10 set Lamp1 off;;;;set Lamp2 off
Don't dispair, the previous example can also be written as
define onAt at 07:00 set Lamp1,Lamp2 on-for-timer 600
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt
Zustimmung Zustimmung x 2 Liste anzeigen

Offline dero

  • Full Member
  • ***
  • Beiträge: 248
Antw:Semikolon verdoppeln
« Antwort #2 am: 29 November 2022, 21:18:39 »
Ja, aber ist das eine Perl-Spezialität oder liegt es an FHEM?

Online KölnSolar

  • Developer
  • Hero Member
  • ****
  • Beiträge: 5785
Antw:Semikolon verdoppeln
« Antwort #3 am: 30 November 2022, 09:30:47 »
Zitat
Multiple FHEM commands are separated by semicolon
Also ist FHEM wohl die Antwort auf Deine Frage. FHEM ist in Perl geschrieben, also ein "level" höher.
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt