Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Toggle not working #8

Open
peterkappelt opened this issue Aug 27, 2017 · 2 comments
Open

Toggle not working #8

peterkappelt opened this issue Aug 27, 2017 · 2 comments
Assignees
Labels

Comments

@peterkappelt
Copy link
Owner

Valid for dev-cf
Toggle command not doing anything

@peterkappelt peterkappelt self-assigned this Aug 27, 2017
@sporkbyspork
Copy link

For the time being, I use the following workaround:
define tradfrinotify notify Taster_Btn_01:Short.* {\ if (Value("group") ne "off") {fhem("set group off")}\ else {fhem("set group on")}}

"group" is a Tradfri group of bulbs.

@peterkappelt
Copy link
Owner Author

User in FHEM-forum found workaround:
https://forum.fhem.de/index.php/topic,70653.msg753242.html#msg753242

Replacing (TradfriUtils.pm, Line 102)

	if ($opt eq "toggle") {
		$opt = (ReadingsVal($hash->{name}, 'onoff', 0) eq 'off') ? "on" : "off";
	}elsif($opt eq "on"){
		my $dimpercent = ReadingsVal($hash->{name}, 'dimvalue', 254);
		$dimpercent = int($dimpercent / 2.54 + 0.5) if(AttrVal($hash->{name}, 'usePercentDimming', 0) == 0);

with

   if ($opt eq "toggle") {
   	$opt = (ReadingsVal($hash->{name}, 'onoff', 0) eq 'off') ? "on" : "off";
   }
   if($opt eq "on"){
   	my $dimpercent = ReadingsVal($hash->{name}, 'dimvalue', 254);
   	$dimpercent = int($dimpercent / 2.54 + 0.5) if(AttrVal($hash->{name}, 'usePercentDimming', 0) == 0);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants