Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Adds rule variable power<x> and switch<x> #19331

Closed
wants to merge 3 commits into from

Commits on Aug 14, 2023

  1. Configuration menu
    Copy the full SHA
    8bb562e View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2023

  1. Adds rule variable power<x> and switch<x>

    The variables can be used to query or logic operation of the current
    status of the inputs and outputs. For example, in a 3-sockets with USB
    output, the USB output can be switched on when one of the sockets is
    switched on:
    
    rule1 on power1#state do event usbpower endon on power2#state do event usbpower endon on power3#state do event usbpower endon
    rule2 on event#usbpower do if ( %power1%==1 or %power2%==1 or %power3%==1 ) power4 1 else power4 0 endif endon
    
    or if you want to send a message when the inputs have a defined status:
    
    rule3 on event#test do if ( %switch1%==1 and %switch2%==0 and %switch3%==1 ) publish stat/foo/bar hello endif endon
    
    To use the examples the feature #define USE_EXPRESSION and #define SUPPORT_IF_STATEMENT must compiled in.
    marsman7 committed Aug 16, 2023
    Configuration menu
    Copy the full SHA
    24cecdf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f1f6529 View commit details
    Browse the repository at this point in the history