mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 01:09:47 +00:00
readonly bug fix
git-svn-id: https://svn.fhem.de/fhem/trunk@3837 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
271959a6c1
commit
b8a8f77be3
@ -110,7 +110,7 @@ PCA301_Set($@)
|
|||||||
my $readonly = AttrVal($name, "readonly", "0" );
|
my $readonly = AttrVal($name, "readonly", "0" );
|
||||||
|
|
||||||
my $list = "identify:noArg reset:noArg statusRequest:noArg";
|
my $list = "identify:noArg reset:noArg statusRequest:noArg";
|
||||||
$list .= " off:noArg on:noArg toggle:noArg" if( $readonly eq "0" );
|
$list .= " off:noArg on:noArg toggle:noArg" if( !$readonly );
|
||||||
|
|
||||||
if( $cmd eq 'toggle' ) {
|
if( $cmd eq 'toggle' ) {
|
||||||
$cmd = ReadingsVal($name,"state","on") eq "off" ? "on" :"off";
|
$cmd = ReadingsVal($name,"state","on") eq "off" ? "on" :"off";
|
||||||
@ -214,7 +214,7 @@ PCA301_Parse($$)
|
|||||||
my $state = $data==0x00?"off":"on";
|
my $state = $data==0x00?"off":"on";
|
||||||
my $power = ($bytes[6]*256 + $bytes[7]) / 10.0;
|
my $power = ($bytes[6]*256 + $bytes[7]) / 10.0;
|
||||||
my $consumption = ($bytes[8]*256 + $bytes[9]) / 100.0;
|
my $consumption = ($bytes[8]*256 + $bytes[9]) / 100.0;
|
||||||
$state = $power if( !$readonly );
|
$state = $power if( $readonly );
|
||||||
readingsBeginUpdate($rhash);
|
readingsBeginUpdate($rhash);
|
||||||
readingsBulkUpdate($rhash, "power", $power) if( $data != 0x00 || ReadingsVal($rname,"power","") != $power );
|
readingsBulkUpdate($rhash, "power", $power) if( $data != 0x00 || ReadingsVal($rname,"power","") != $power );
|
||||||
readingsBulkUpdate($rhash, "consumption", $consumption) if( ReadingsVal($rname,"consumption","") != $consumption );
|
readingsBulkUpdate($rhash, "consumption", $consumption) if( ReadingsVal($rname,"consumption","") != $consumption );
|
||||||
|
Loading…
Reference in New Issue
Block a user