Ankündigung

Einklappen
Keine Ankündigung bisher.

Strange behaviour

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Strange behaviour

    I have the following code:

    Code:
    if ("Melding_DonkerBuiten-3/1/13"==EIN) and chtime(16,00,00) and (NACHTMODE==AUS) then {
      write("Switch_Vijver_Ledverlichting-0/5/3",EIN);
      write("Switch_TuinMuurTL-0/1/38",EIN);
    } else {
      write("Switch_Vijver_Ledverlichting-0/5/3",AUS);
      write("Switch_TuinMuurTL-0/1/38",AUS);
    } endif
    A Merten Argus 220 movement detector sends a value 1 when the brightness drops (it's getting dark outside). When I go to bed, NIGHT MODUS (NACHTMODE) is set ON.

    As soon as it gets dark outside (but not before 16:00) and as long as I'm not in my bed, two lights should be set on:
    - the light of the pond (vijver)
    - the light in the garden (tuinmuur)

    Works perfect. Light went on around 18:50 this evening. But I noticed that the light of the pond switches off after a while. The light in the garden stays on. And I don't understand why.

    In eibpc, I see that eibpc triggers an OFF value:

    Code:
    % 2012-10-23 19:37:23 [I]| [/I]Sender: EibPC | GA: "Switch_Vijver_Ledverlichting-0/5/3" | Value: OFF | Type: binary value | Write
    But why is this value triggered? I have no clue at all.

    In eibpc I also have written the following code to join eibpc with CommandFusion and to generate a web page. No other references to the light of the pond:
    Code:
    JoinToggle2GA(CFT,d184,"Switch_Vijver_Ledverlichting-0/5/3","Status_Koivijver_Ledverlichting-2/5/3")
    
    CallSwitch(20,4,"Switch_Vijver_Ledverlichting-0/5/3","Status_Koivijver_Ledverlichting-2/5/3")
    
    :begin CallSwitch(PageId, ButtonId, SwitchAddress, StatusAddress)
    if pbutton(ButtonId, PageId)==1 then {
      write(SwitchAddress, !SwitchAddress) 
    } endif
    
    if change(StatusAddress) then {
      pdisplay(ButtonId,convert(PageId,$$)+$_$+convert(ButtonId,$$)+$_$+convert(StatusAddress,$$),LIGHT,DISPLAY,GREY,PageId)
    } endif
    :end
    Tx for your help.

    BTW No problem if you prefer German.

    Ivan

    #2
    Avoid using the else-statement. It will likely not do what you want. Try to write code that does not use else. Look close at the manual for the else statement.
    Did I already write you should not use else? Do not use else-statement.

    As soon you rewrite your code without else it will work.

    if a then b else c endif
    will expand to

    if a then b endif
    if !a then c endif

    if b does something to change a then you got a problem with forecasting the results.

    Regards,
    Bernd

    Kommentar

    Lädt...
    X