mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
30_pilight_*: fix restore (StateFn)
git-svn-id: https://svn.fhem.de/fhem/trunk@8663 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4f26e1783a
commit
3b8a9779fd
@ -1,5 +1,6 @@
|
||||
# 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.
|
||||
- bugfix: 30_pilight_*: restore (StateFn)
|
||||
- feature: 30_pilight_dimmer: new attributes dimlevel_on, dimlevel_off
|
||||
dimmers without direct dimlevel support (switch combined with screen)
|
||||
- bugfix: 73_km200: Bugfix for sorting and comparison method
|
||||
|
@ -1,5 +1,5 @@
|
||||
##############################################
|
||||
# $Id: 10_pilight_ctrl.pm 1.03 2015-05-20 Risiko $
|
||||
# $Id: 10_pilight_ctrl.pm 1.04 2015-05-30 Risiko $
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
@ -27,6 +27,7 @@
|
||||
# V 1.01 2015-05-09 - NEW: add quigg_gt* protocol (e.q quigg_gt7000)
|
||||
# V 1.02 2015-05-16 - NEW: battery state for temperature sensors
|
||||
# V 1.03 2015-05-20 - NEW: handle screen messages (up,down)
|
||||
# V 1.04 2015-05-30 - FIX: StateFn
|
||||
##############################################
|
||||
package main;
|
||||
|
||||
@ -70,6 +71,7 @@ sub pilight_ctrl_Initialize($)
|
||||
$hash->{UndefFn} = "pilight_ctrl_Undef";
|
||||
$hash->{SetFn} = "pilight_ctrl_Set";
|
||||
$hash->{NotifyFn}= "pilight_ctrl_Notify";
|
||||
$hash->{StateFn} = "pilight_ctrl_State";
|
||||
$hash->{AttrList}= "ignoreProtocol brands ContactAsSwitch ".$readingFnAttributes;
|
||||
|
||||
$hash->{Clients} = ":pilight_switch:pilight_dimmer:pilight_temp:";
|
||||
@ -114,6 +116,18 @@ sub pilight_ctrl_Define($$)
|
||||
return pilight_ctrl_TryConnect($hash);
|
||||
}
|
||||
|
||||
#####################################
|
||||
sub pilight_ctrl_State($$$$)
|
||||
{
|
||||
my ($hash, $time, $name, $val) = @_;
|
||||
my $me = $hash->{NAME};
|
||||
# gespeicherten Readings löschen
|
||||
if ($name eq "state" || $name eq "rcv_raw") {
|
||||
setReadingsVal($hash, $name, undef, TimeNow());
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub pilight_ctrl_Close($)
|
||||
{
|
||||
my $hash = shift;
|
||||
|
@ -1,5 +1,5 @@
|
||||
##############################################
|
||||
# $Id: 30_pilight_dimmer.pm 0.53 2015-05-30 Risiko $
|
||||
# $Id: 30_pilight_dimmer.pm 0.54 2015-05-30 Risiko $
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
@ -13,6 +13,7 @@
|
||||
# V 0.51 2015-05-21 - CHG: modifications for dimers without dimlevel
|
||||
# V 0.52 2015-05-25 - CHG: attributes dimlevel_on, dimlevel_off
|
||||
# V 0.53 2015-05-30 - FIX: set dimlevel 0
|
||||
# V 0.54 2015-05-30 - FIX: StateFn
|
||||
##############################################
|
||||
|
||||
package main;
|
||||
@ -23,10 +24,6 @@ use Time::HiRes qw(gettimeofday);
|
||||
use JSON;
|
||||
use Switch; #libswitch-perl
|
||||
|
||||
sub pilight_dimmer_Parse($$);
|
||||
sub pilight_dimmer_Define($$);
|
||||
sub pilight_dimmer_Fingerprint($$);
|
||||
|
||||
sub pilight_dimmer_Initialize($)
|
||||
{
|
||||
my ($hash) = @_;
|
||||
@ -35,6 +32,7 @@ sub pilight_dimmer_Initialize($)
|
||||
$hash->{Match} = "^PISWITCH|^PIDIMMER|^PISCREEN";
|
||||
$hash->{ParseFn} = "pilight_dimmer_Parse";
|
||||
$hash->{SetFn} = "pilight_dimmer_Set";
|
||||
$hash->{StateFn} = "pilight_dimmer_State";
|
||||
$hash->{AttrList} = "dimlevel_max dimlevel_step dimlevel_max_device dimlevel_on dimlevel_off ".$readingFnAttributes;
|
||||
}
|
||||
|
||||
@ -56,6 +54,7 @@ sub pilight_dimmer_Define($$)
|
||||
my $unit = $a[4];
|
||||
|
||||
$hash->{STATE} = "defined";
|
||||
|
||||
$hash->{PROTOCOL} = lc($protocol);
|
||||
$hash->{ID} = $id;
|
||||
$hash->{UNIT} = $unit;
|
||||
@ -64,7 +63,7 @@ sub pilight_dimmer_Define($$)
|
||||
$hash->{helper}{OWN_DIM} = 1;
|
||||
$hash->{helper}{OWN_DIM} = 0 if ($hash->{PROTOCOL} =~ /screen/);
|
||||
|
||||
$hash->{helper}{ISSCREEN} = 1 if ($hash->{PROTOCOL} =~ /screen/ or $hash->{PROTOCOL2} =~ /screen/);
|
||||
$hash->{helper}{ISSCREEN} = 1 if ($hash->{PROTOCOL} =~ /screen/ or (defined($hash->{PROTOCOL2}) and $hash->{PROTOCOL2}) =~ /screen/);
|
||||
|
||||
#$attr{$me}{verbose} = 5;
|
||||
|
||||
@ -78,7 +77,6 @@ sub pilight_dimmer_Parse($$)
|
||||
{
|
||||
my ($mhash, $rmsg, $rawdata) = @_;
|
||||
my $backend = $mhash->{NAME};
|
||||
my $dimlevel = undef;
|
||||
|
||||
Log3 $backend, 4, "pilight_dimmer_Parse: RCV -> $rmsg";
|
||||
|
||||
@ -265,6 +263,17 @@ sub pilight_dimmer_Set($$)
|
||||
return undef;
|
||||
}
|
||||
|
||||
#####################################
|
||||
sub pilight_dimmer_State($$$$)
|
||||
{
|
||||
my ($hash, $time, $name, $val) = @_;
|
||||
my $me = $hash->{NAME};
|
||||
|
||||
#$hash->{STATE} wird nur ersetzt, wenn $hash->{STATE} == ??? fhem.pl Z: 2469
|
||||
#machen wir es also selbst
|
||||
$hash->{STATE} = $val if ($name eq "state");
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
##############################################
|
||||
# $Id: 30_pilight_switch.pm 0.12 2015-05-18 Risiko $
|
||||
# $Id: 30_pilight_switch.pm 0.13 2015-05-30 Risiko $
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
@ -10,6 +10,7 @@
|
||||
# V 0.10 2015-02-22 - initial beta version
|
||||
# V 0.11 2015-03-29 - FIX: $readingFnAttributes
|
||||
# V 0.12 2015-05-18 - FIX: add version information
|
||||
# V 0.13 2015-05-30 - FIX: StateFn
|
||||
##############################################
|
||||
|
||||
package main;
|
||||
@ -21,7 +22,7 @@ use JSON;
|
||||
|
||||
sub pilight_switch_Parse($$);
|
||||
sub pilight_switch_Define($$);
|
||||
sub pilight_switch_Fingerprint($$);
|
||||
|
||||
|
||||
sub pilight_switch_Initialize($)
|
||||
{
|
||||
@ -31,6 +32,7 @@ sub pilight_switch_Initialize($)
|
||||
$hash->{Match} = "^PISWITCH";
|
||||
$hash->{ParseFn} = "pilight_switch_Parse";
|
||||
$hash->{SetFn} = "pilight_switch_Set";
|
||||
$hash->{StateFn} = "pilight_switch_State";
|
||||
$hash->{AttrList} = $readingFnAttributes;
|
||||
}
|
||||
|
||||
@ -63,6 +65,18 @@ sub pilight_switch_Define($$)
|
||||
return undef;
|
||||
}
|
||||
|
||||
#####################################
|
||||
sub pilight_switch_State($$$$)
|
||||
{
|
||||
my ($hash, $time, $name, $val) = @_;
|
||||
my $me = $hash->{NAME};
|
||||
|
||||
#$hash->{STATE} wird nur ersetzt, wenn $hash->{STATE} == ??? fhem.pl Z: 2469
|
||||
#machen wir es also selbst
|
||||
$hash->{STATE} = $val if ($name eq "state");
|
||||
return undef;
|
||||
}
|
||||
|
||||
###########################################
|
||||
sub pilight_switch_Parse($$)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
##############################################
|
||||
# $Id: 30_pilight_temp.pm 0.13 2015-05-17 Risiko $
|
||||
# $Id: 30_pilight_temp.pm 0.14 2015-05-30 Risiko $
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
@ -12,6 +12,7 @@
|
||||
# V 0.12 2015-05-16 - NEW: reading battery
|
||||
# V 0.12 2015-05-16 - NEW: attribut corrTemp, a factor to modify temperatur
|
||||
# V 0.13 2015-05-17 - NEW: attribut corrHumidity, a factor to modify humidity
|
||||
# V 0.14 2015-05-30 - FIX: StateFn
|
||||
##############################################
|
||||
|
||||
package main;
|
||||
@ -23,7 +24,6 @@ use JSON;
|
||||
|
||||
sub pilight_temp_Parse($$);
|
||||
sub pilight_temp_Define($$);
|
||||
sub pilight_temp_Fingerprint($$);
|
||||
|
||||
sub pilight_temp_Initialize($)
|
||||
{
|
||||
@ -32,6 +32,7 @@ sub pilight_temp_Initialize($)
|
||||
$hash->{DefFn} = "pilight_temp_Define";
|
||||
$hash->{Match} = "^PITEMP";
|
||||
$hash->{ParseFn} = "pilight_temp_Parse";
|
||||
$hash->{StateFn} = "pilight_temp_State";
|
||||
$hash->{AttrList} = "corrTemp corrHumidity ".$readingFnAttributes;
|
||||
}
|
||||
|
||||
@ -62,6 +63,18 @@ sub pilight_temp_Define($$)
|
||||
return undef;
|
||||
}
|
||||
|
||||
#####################################
|
||||
sub pilight_temp_State($$$$)
|
||||
{
|
||||
my ($hash, $time, $name, $val) = @_;
|
||||
my $me = $hash->{NAME};
|
||||
|
||||
#$hash->{STATE} wird nur ersetzt, wenn $hash->{STATE} == ??? fhem.pl Z: 2469
|
||||
#machen wir es also selbst
|
||||
$hash->{STATE} = $val if ($name eq "state");
|
||||
return undef;
|
||||
}
|
||||
|
||||
###########################################
|
||||
sub pilight_temp_Parse($$)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user