From 495c82aabe8953a887a9fac588f51e9de8048efa Mon Sep 17 00:00:00 2001 From: deespe Date: Mon, 31 Oct 2016 23:17:18 +0000 Subject: [PATCH] 98_Hyperion: add set toggleMode, add attr hyperionToggleModes, add textField to dimUp/dimDown, add attr widgetOverride on define to fix the dimUp/dimDown textField now, minor other changes, update commandref, add german commandref git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@12480 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 3 + fhem/FHEM/98_Hyperion.pm | 441 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 418 insertions(+), 26 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 79b626594a..35c0944c05 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,8 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 98_Hyperion: new set toggleMode + new attr hyperionToggleModes + new german commandref - bugfix: 93_DbRep: calc issue due to daylight saving time end (winter time) - new: 30_pilight_raw.pm: New Attribut sendCount - bugfix: 10_SOMFY: wrong attribute reference ...-up-time-to-close removed diff --git a/fhem/FHEM/98_Hyperion.pm b/fhem/FHEM/98_Hyperion.pm index b37d5813d5..67dc9a157e 100644 --- a/fhem/FHEM/98_Hyperion.pm +++ b/fhem/FHEM/98_Hyperion.pm @@ -21,15 +21,16 @@ use DevIo; my %Hyperion_sets = ( "dim" => "slider,0,1,100", - "dimDown" => "noArg", - "dimUp" => "noArg", + "dimDown" => "textField", + "dimUp" => "textField", "clear" => "textField", "clearall" => "noArg", "mode" => "clearall,effect,off,rgb", "off" => "noArg", "on" => "noArg", "rgb" => "colorpicker,RGB", - "toggle" => "noArg" + "toggle" => "noArg", + "toggleMode" => "noArg" ); my $Hyperion_requiredVersion = "1.03.2"; @@ -60,6 +61,7 @@ sub Hyperion_Initialize($) "hyperionDimStep ". "hyperionNoSudo:1 ". "hyperionSshUser ". + "hyperionToggleModes ". "hyperionVersionCheck:0 ". "queryAfterSet:0 ". $readingFnAttributes; @@ -100,9 +102,10 @@ sub Hyperion_Define($$) $attr{$name}{icon} = "light_led_stripe_rgb"; $attr{$name}{lightSceneParamsToSave} = "state"; $attr{$name}{room} = "Hyperion"; + $attr{$name}{webCmd} = $Hyperion_webCmd; + $attr{$name}{widgetOverride} = "dimUp:noArg dimDown:noArg"; addToDevAttrList($name,"lightSceneParamsToSave") if (index($attr{"global"}{userattr},"lightSceneParamsToSave") == -1); addToDevAttrList($name,"homebridgeMapping") if (index($attr{"global"}{userattr},"homebridgeMapping") == -1); - $attr{$name}{webCmd} = $Hyperion_webCmd; } if ($init_done) { @@ -638,8 +641,24 @@ sub Hyperion_Set($@) elsif ($cmd eq "toggle") { return "$cmd need no additional value of $value" if (defined $value); - my $rstate = Value($name); - ($rstate ne "off") ? fhem "set ".$name." off" : fhem "set ".$name." on"; + my $state = Value($name); + my $nstate = $state ne "off" ? "off" : "on"; + fhem "set $name $nstate"; + return undef; + } + elsif ($cmd eq "toggleMode") + { + return "$cmd need no additional value of $value" if (defined $value); + my $mode = ReadingsVal($name,"mode","off"); + my $nmode; + my @modeorder = split(",",AttrVal($name,"hyperionToggleModes","clearall,rgb,effect,off")); + my $count = scalar @modeorder; + for (my $i = 0; $i < $count; $i++) + { + $nmode = $i < $count - 1 ? $modeorder[$i+1] : $modeorder[0] if ($modeorder[$i] eq $mode); + } + $nmode = $nmode ? $nmode : "off"; + fhem "set $name mode $nmode"; return undef; } elsif ($cmd eq "mode") @@ -789,6 +808,10 @@ sub Hyperion_Attr(@) Hyperion_Call($hash); } } + elsif ($attr_name eq "hyperionToggleModes") + { + $err = "Invalid value $attr_value for attribute $attr_name. Must be a comma separated list of available modes of clearall,rgb,effect,off. Each mode only once in the list." if ($attr_value !~ /^(clearall|rgb|effect|off),(clearall|rgb|effect|off)(,(clearall|rgb|effect|off)){0,2}$/); + } elsif ($attr_name eq "hyperionVersionCheck") { $err = "Invalid value $attr_value for attribute $attr_name. Can only be value 0." if ($attr_value !~ /^0$/); @@ -875,7 +898,7 @@ sub Hyperion_devStateIcon($;$) With Hyperion it is possible to change the color or start an effect on a hyperion server.
It's also possible to control the complete color calibration (changes are temorary and will not be written to the config file).
The Hyperion server must have enabled the JSON server.
- You can also restart Hyperion with different configuration files (p.e. switch input)
+ You can also restart Hyperion with different configuration files (p.e. switch input/grabber)

Define

@@ -883,7 +906,7 @@ sub Hyperion_devStateIcon($;$) define <name> Hyperion <IP or HOSTNAME> <PORT> [<INTERVAL>]

- <INTERVAL> is optional for polling.
+ <INTERVAL> is optional for periodically polling.

After defining "get <name> statusRequest" will be called once automatically to get the list of available effects and the current state of the Hyperion server.

@@ -904,7 +927,8 @@ sub Hyperion_devStateIcon($;$)
@@ -1052,8 +1080,8 @@ sub Hyperion_devStateIcon($;$)
  • hyperionBin
    - path to the hyperion executable
    - OpenELEC users may set hyperiond.sh as executable
    + path to the hyperion daemon
    + OpenELEC users may set hyperiond.sh as daemon
    default: /usr/bin/hyperiond
  • @@ -1064,26 +1092,32 @@ sub Hyperion_devStateIcon($;$)
  • hyperionDefaultDuration
    default duration
    - default: infinity + default: 0 = infinity
  • hyperionDefaultPriority
    default priority
    - default: 0 + default: 0 = highest priority
  • hyperionDimStep
    dim step for dimDown/dimUp
    - default: 5 (percent) + default: 10 (percent)
  • hyperionNoSudo
    - disable sudo for non-root users
    + disable sudo for non-root ssh user
    default: 0
  • hyperionSshUser
    - user for executing SSH commands + user name for executing SSH commands
    + default: pi +
  • +
  • + hyperionToggleModes
    + modes and order of toggleMode as comma separated list (min. 2 modes, max. 4 modes, each mode only once)
    + default: clearall,rgb,effect,off
  • hyperionVersionCheck
    @@ -1094,7 +1128,8 @@ sub Hyperion_devStateIcon($;$)
  • queryAfterSet
    If set to 0 the state of the Hyperion server will not be queried after setting, instead the state will be queried on next interval query.
    - This is only used when polling is enabled, without polling the state will be queried automatically after set. + This is only used if periodically polling is enabled, without this polling the state will be queried automatically after set.
    + default: 1

  • @@ -1135,7 +1170,7 @@ sub Hyperion_devStateIcon($;$)
  • duration
    - active/previous duration in seconds or infinite + active/previous/remaining primary duration in seconds or infinite
  • effect
    @@ -1155,11 +1190,11 @@ sub Hyperion_devStateIcon($;$)
  • luminanceGain
    - luminanceGain + current luminanceGain
  • luminanceMinimum
    - luminanceMinimum + current luminanceMinimum
  • mode
    @@ -1179,11 +1214,11 @@ sub Hyperion_devStateIcon($;$)
  • saturationGain
    - active/previous saturationGain + active saturationGain
  • saturationLGain
    - active/previous saturationLGain + active saturationLGain
  • serverResponse
    @@ -1209,4 +1244,358 @@ sub Hyperion_devStateIcon($;$) =end html +=begin html_DE + + +

    Hyperion

    + + +=end html_DE =cut