mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
14_SD_WS_Maverick.pm: support for device TFA 14.1504
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@20748 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cdf34621dd
commit
434732632e
4
CHANGED
4
CHANGED
@ -1,5 +1,9 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: 14_SD_WS_Maverick: added support for device TFA 14.1504
|
||||||
|
(Radio-controlled grill and meat thermometer)
|
||||||
|
- changed: 14_SD_WS_Maverick: removed internals which are identical to readings
|
||||||
|
removed declaration of stateFormat
|
||||||
- feature: 14_SD_WS.pm: new weatherstation Lidl AURIOL AHFL 433 B2 IAN 314695
|
- feature: 14_SD_WS.pm: new weatherstation Lidl AURIOL AHFL 433 B2 IAN 314695
|
||||||
- feature: 00_SIGNALduino.pm:
|
- feature: 00_SIGNALduino.pm:
|
||||||
new Internal hasCC1101 added
|
new Internal hasCC1101 added
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
# Version 1.1
|
# Version 1.1
|
||||||
# - changed: 14_SD_WS_Maverick: rename Readings for Temperatures
|
# - changed: 14_SD_WS_Maverick: rename Readings for Temperatures
|
||||||
# - feature: 14_SD_WS_Maverick: added Readings for Sensor-states
|
# - feature: 14_SD_WS_Maverick: added Readings for Sensor-states
|
||||||
|
# - feature: 14_SD_WS_Maverick: added support for device TFA 14.1504 (Radio-controlled grill and meat thermometer)
|
||||||
|
# - changed: 14_SD_WS_Maverick: removed internals which are identical to readings
|
||||||
|
# - changed: 14_SD_WS_Maverick: removed declaration of stateFormat
|
||||||
|
# - changed: 14_SD_WS_Maverick: code optimization
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
@ -23,9 +27,9 @@ sub SD_WS_Maverick_Define($$);
|
|||||||
sub SD_WS_Maverick_Undef($$);
|
sub SD_WS_Maverick_Undef($$);
|
||||||
sub SD_WS_Maverick_Parse($$);
|
sub SD_WS_Maverick_Parse($$);
|
||||||
sub SD_WS_Maverick_Attr(@);
|
sub SD_WS_Maverick_Attr(@);
|
||||||
sub SD_WS_Maverick_SetSensor1Inaktiv($);
|
sub SD_WS_Maverick_SetSensor1Inactive($);
|
||||||
sub SD_WS_Maverick_SetSensor2Inaktiv($);
|
sub SD_WS_Maverick_SetSensor2Inactive($);
|
||||||
sub SD_WS_Maverick_updateReadings($);
|
sub SD_WS_Maverick_UpdateState($);
|
||||||
|
|
||||||
sub
|
sub
|
||||||
SD_WS_Maverick_Initialize($)
|
SD_WS_Maverick_Initialize($)
|
||||||
@ -62,36 +66,6 @@ SD_WS_Maverick_Define($$)
|
|||||||
$modules{SD_WS_Maverick}{defptr}{$a[2]} = $hash;
|
$modules{SD_WS_Maverick}{defptr}{$a[2]} = $hash;
|
||||||
$hash->{STATE} = "Defined";
|
$hash->{STATE} = "Defined";
|
||||||
|
|
||||||
my $name= $hash->{NAME};
|
|
||||||
# prüfen, ob eine neue Definition angelegt wird
|
|
||||||
if($init_done && !defined($hash->{OLDDEF}))
|
|
||||||
{
|
|
||||||
# setzen von stateFormat
|
|
||||||
$attr{$name}{"stateFormat"} = '{
|
|
||||||
my $s1=ReadingsVal($name,"Sensor-1-food_state",-1);
|
|
||||||
my $s2=ReadingsVal($name,"Sensor-2-bbq_state",-1);
|
|
||||||
if ($s1 ne "connected" && $s1 eq $s2 ) {
|
|
||||||
return $s1;
|
|
||||||
}else{
|
|
||||||
my $state="Food: ";
|
|
||||||
my $temp_food=ReadingsVal($name,"temp-food","");
|
|
||||||
my $temp_bbq=ReadingsVal($name,"temp-bbq","");
|
|
||||||
if($s1 eq "connected"){
|
|
||||||
$state .=$temp_food;
|
|
||||||
}else{
|
|
||||||
$state .=$s1;
|
|
||||||
}
|
|
||||||
$state .=" BBQ: ";
|
|
||||||
if($s2 eq "connected"){
|
|
||||||
$state .=$temp_bbq;
|
|
||||||
}else{
|
|
||||||
$state .=$s2;
|
|
||||||
}
|
|
||||||
return $state;
|
|
||||||
}
|
|
||||||
}';
|
|
||||||
|
|
||||||
}
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +74,8 @@ sub
|
|||||||
SD_WS_Maverick_Undef($$)
|
SD_WS_Maverick_Undef($$)
|
||||||
{
|
{
|
||||||
my ($hash, $name) = @_;
|
my ($hash, $name) = @_;
|
||||||
|
RemoveInternalTimer($hash, 'SD_WS_Maverick_SetSensor1Inactive');
|
||||||
|
RemoveInternalTimer($hash, 'SD_WS_Maverick_SetSensor2Inactive');
|
||||||
delete($modules{SD_WS_Maverick}{defptr}{$hash->{CODE}})
|
delete($modules{SD_WS_Maverick}{defptr}{$hash->{CODE}})
|
||||||
if(defined($hash->{CODE}) &&
|
if(defined($hash->{CODE}) &&
|
||||||
defined($modules{SD_WS_Maverick}{defptr}{$hash->{CODE}}));
|
defined($modules{SD_WS_Maverick}{defptr}{$hash->{CODE}}));
|
||||||
@ -152,12 +128,12 @@ SD_WS_Maverick_Parse($$)
|
|||||||
|
|
||||||
Log3 $iohash, 4, "$name $model decoded protocolid: 47 sensor messageType=$messageType, temp-f=$temp_str1, temp-b=$temp_str2, checksum-s=$checksum_str";
|
Log3 $iohash, 4, "$name $model decoded protocolid: 47 sensor messageType=$messageType, temp-f=$temp_str1, temp-b=$temp_str2, checksum-s=$checksum_str";
|
||||||
|
|
||||||
if ($messageType eq '59'){
|
if ($messageType eq '55' || $messageType eq '59') {
|
||||||
$messageType="normal";
|
$messageType = "normal";
|
||||||
}elsif ($messageType eq '6A') {
|
} elsif ($messageType eq '66' || $messageType eq '6A') {
|
||||||
$messageType="sync";
|
$messageType = "sync";
|
||||||
}else{
|
} else {
|
||||||
Log3 $iohash, 4, "$name $model ERROR: wrong messageType=$messageType (must be 59 or 6A)";
|
Log3 $iohash, 4, "$name $model ERROR: wrong messageType '$messageType' (must be one of: 55, 59, 66, 6A)";
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,14 +216,12 @@ SD_WS_Maverick_Parse($$)
|
|||||||
# Den SensorState bei Inaktivität zurücksetzen lassen durch Timer
|
# Den SensorState bei Inaktivität zurücksetzen lassen durch Timer
|
||||||
my $inactivityinterval=int(AttrVal($name,"inactivityinterval",360));
|
my $inactivityinterval=int(AttrVal($name,"inactivityinterval",360));
|
||||||
if ($sensor_1_state ne "unknown") {
|
if ($sensor_1_state ne "unknown") {
|
||||||
$hash->{sensor_1_state}=$sensor_1_state;
|
RemoveInternalTimer($hash, 'SD_WS_Maverick_SetSensor1Inactive');
|
||||||
RemoveInternalTimer($hash, 'SD_WS_Maverick_SetSensor1Inaktiv');
|
InternalTimer(time()+($inactivityinterval), 'SD_WS_Maverick_SetSensor1Inactive', $hash, 0);
|
||||||
InternalTimer(time()+($inactivityinterval), 'SD_WS_Maverick_SetSensor1Inaktiv', $hash, 0);
|
|
||||||
}
|
}
|
||||||
if ( $sensor_2_state ne "unknown") {
|
if ( $sensor_2_state ne "unknown") {
|
||||||
$hash->{sensor_2_state}=$sensor_2_state;
|
RemoveInternalTimer($hash, 'SD_WS_Maverick_SetSensor2Inactive');
|
||||||
RemoveInternalTimer($hash, 'SD_WS_Maverick_SetSensor2Inaktiv');
|
InternalTimer(time()+($inactivityinterval), 'SD_WS_Maverick_SetSensor2Inactive', $hash, 0);
|
||||||
InternalTimer(time()+($inactivityinterval), 'SD_WS_Maverick_SetSensor2Inaktiv', $hash, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Checksum auswerten
|
# Checksum auswerten
|
||||||
@ -257,18 +231,22 @@ SD_WS_Maverick_Parse($$)
|
|||||||
# TODO: Die eigentliche Checksum errechnen. Diese ändert sich bei jedem Temperaturwechsel
|
# TODO: Die eigentliche Checksum errechnen. Diese ändert sich bei jedem Temperaturwechsel
|
||||||
# TODO: Evtl. ist in den checksum-bits auch noch eine Info zur Batterie enthalten
|
# TODO: Evtl. ist in den checksum-bits auch noch eine Info zur Batterie enthalten
|
||||||
# ggf. ist es möglich die checksum als ID zu verwenden und so mehrere Mavericks in fhem einbinden zu können.
|
# ggf. ist es möglich die checksum als ID zu verwenden und so mehrere Mavericks in fhem einbinden zu können.
|
||||||
$hash->{checksum}=$checksum;
|
|
||||||
$hash->{temp_food}=$temp_food if ($temp_food ne"");
|
|
||||||
$hash->{temp_bbq}=$temp_bbq if ($temp_bbq ne"");
|
|
||||||
$hash->{messageType}=$messageType;
|
|
||||||
|
|
||||||
# TODO: Logging kann entfernt werden, wenn checksum entschlüsselt ist. Wird zur Analyse verwendet.
|
# TODO: Logging kann entfernt werden, wenn checksum entschlüsselt ist. Wird zur Analyse verwendet.
|
||||||
Log3 $hash, 4, "$name statistic: checksum=$checksum, t1=$temp_str1, temp-food=$temp_food, t2_$temp_str2, temp-bbq=$temp_bbq;";
|
Log3 $hash, 4, "$name statistic: checksum=$checksum, t1=$temp_str1, temp-food=$temp_food, t2=$temp_str2, temp-bbq=$temp_bbq;";
|
||||||
|
|
||||||
SD_WS_Maverick_updateReadings($hash);
|
# update readings
|
||||||
|
readingsBeginUpdate($hash);
|
||||||
|
readingsBulkUpdate($hash, "checksum", $checksum);
|
||||||
|
readingsBulkUpdate($hash, "temp-food", $temp_food) if ($temp_food ne "");
|
||||||
|
readingsBulkUpdate($hash, "temp-bbq", $temp_bbq) if ($temp_bbq ne "");
|
||||||
|
readingsBulkUpdate($hash, "messageType", $messageType);
|
||||||
|
readingsBulkUpdate($hash, "Sensor-1-food_state", $sensor_1_state);
|
||||||
|
readingsBulkUpdate($hash, "Sensor-2-bbq_state", $sensor_2_state);
|
||||||
|
readingsEndUpdate($hash, 1); # Notify is done by Dispatch
|
||||||
|
SD_WS_Maverick_UpdateState($hash);
|
||||||
|
|
||||||
return $name;
|
return $name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub SD_WS_Maverick_Attr(@)
|
sub SD_WS_Maverick_Attr(@)
|
||||||
@ -294,38 +272,44 @@ sub SD_WS_Maverick_Attr(@)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub SD_WS_Maverick_SetSensor1Inaktiv($){
|
sub SD_WS_Maverick_SetSensor1Inactive($){
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
Log3 $hash, 5, "$name SD_WS_Maverick_SetSensor1Inaktiv";
|
Log3 $hash, 5, "$name SD_WS_Maverick_SetSensor1Inactive";
|
||||||
|
readingsSingleUpdate($hash, "Sensor-1-food_state", "inactive", 1);
|
||||||
$hash->{sensor_1_state}="inactiv";
|
SD_WS_Maverick_UpdateState($hash);
|
||||||
SD_WS_Maverick_updateReadings($hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub SD_WS_Maverick_SetSensor2Inaktiv($){
|
sub SD_WS_Maverick_SetSensor2Inactive($){
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
Log3 $hash, 5, "$name SD_WS_Maverick_SetSensor2Inaktiv";
|
Log3 $hash, 5, "$name SD_WS_Maverick_SetSensor2Inactive";
|
||||||
|
readingsSingleUpdate($hash, "Sensor-2-bbq_state", "inactive", 1);
|
||||||
$hash->{sensor_2_state}="inactiv";
|
SD_WS_Maverick_UpdateState($hash);
|
||||||
SD_WS_Maverick_updateReadings($hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub SD_WS_Maverick_updateReadings($){
|
sub SD_WS_Maverick_UpdateState($) {
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
Log3 $hash, 5, "$name SD_WS_Maverick_updateReadings";
|
Log3 $hash, 5, "$name SD_WS_Maverick_UpdateState";
|
||||||
|
|
||||||
readingsBeginUpdate($hash);
|
my $state_food = ReadingsVal($name, "Sensor-1-food_state", undef);
|
||||||
readingsBulkUpdate($hash, "temp-food", $hash->{temp_food});
|
my $temp_food = ReadingsVal($name, "temp-food", undef);
|
||||||
readingsBulkUpdate($hash, "temp-bbq", $hash->{temp_bbq});
|
my $state_bbq = ReadingsVal($name, "Sensor-2-bbq_state", undef);
|
||||||
readingsBulkUpdate($hash, "messageType ", $hash->{messageType});
|
my $temp_bbq = ReadingsVal($name, "temp-bbq", undef);;
|
||||||
readingsBulkUpdate($hash, "checksum", $hash->{checksum});
|
|
||||||
readingsBulkUpdate($hash, "Sensor-1-food_state", $hash->{sensor_1_state});
|
my $state = "???";
|
||||||
readingsBulkUpdate($hash, "Sensor-2-bbq_state", $hash->{sensor_2_state});
|
if ($state_food ne "connected" && $state_food eq $state_bbq ) {
|
||||||
readingsEndUpdate($hash, 1); # Notify is done by Dispatch
|
$state = $state_food;
|
||||||
return undef;
|
} else {
|
||||||
|
$state = "Food: ";
|
||||||
|
$state .= $state_food eq "connected" ? $temp_food : $state_food;
|
||||||
|
$state .= " BBQ: ";
|
||||||
|
$state .= $state_bbq eq "connected" ? $temp_bbq : $state_bbq;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log3 $hash, 5, "$name state: $state";
|
||||||
|
readingsSingleUpdate($hash, "state", $state, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
@ -344,6 +328,7 @@ sub SD_WS_Maverick_updateReadings($){
|
|||||||
<b>Known models:</b>
|
<b>Known models:</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Maverick 732/733</li>
|
<li>Maverick 732/733</li>
|
||||||
|
<li>TFA 14.1504 (Radio-controlled grill and meat thermometer)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
New received device will be added in fhem with autocreate (if autocreate is globally enabled).
|
New received device will be added in fhem with autocreate (if autocreate is globally enabled).
|
||||||
@ -362,8 +347,8 @@ sub SD_WS_Maverick_updateReadings($){
|
|||||||
<li>State (Food: BBQ: )</li>
|
<li>State (Food: BBQ: )</li>
|
||||||
<li>temp-food (°C)</li>
|
<li>temp-food (°C)</li>
|
||||||
<li>temp-bbq (°C)</li>
|
<li>temp-bbq (°C)</li>
|
||||||
<li>Sensor-1-food_state (connected, disconnected or inactiv)</li>
|
<li>Sensor-1-food_state (connected, disconnected or inactive)</li>
|
||||||
<li>Sensor-2-bbq_state (connected, disconnected or inactiv)</li>
|
<li>Sensor-2-bbq_state (connected, disconnected or inactive)</li>
|
||||||
<li>messageType (sync at startup or resync, otherwise normal)</li>
|
<li>messageType (sync at startup or resync, otherwise normal)</li>
|
||||||
<li>checksum (experimental)</li>
|
<li>checksum (experimental)</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -371,7 +356,7 @@ sub SD_WS_Maverick_updateReadings($){
|
|||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>inactivityinterval <seconds (60-3600)><br>
|
<li>inactivityinterval <seconds (60-3600)><br>
|
||||||
The Interval to set Sensor-1-food_state and/or Sensor-2-bbq_state to inactiv after defined minutes. This can help to detect empty batteries or the malfunction of a tempertature-sensor.<br>
|
The Interval to set Sensor-1-food_state and/or Sensor-2-bbq_state to inactive after defined minutes. This can help to detect empty batteries or the malfunction of a tempertature-sensor.<br>
|
||||||
<code>default: 360</code></li>
|
<code>default: 360</code></li>
|
||||||
<li><a href="#do_not_notify">do_not_notify</a></li>
|
<li><a href="#do_not_notify">do_not_notify</a></li>
|
||||||
<li><a href="#ignore">ignore </a></li>
|
<li><a href="#ignore">ignore </a></li>
|
||||||
@ -399,6 +384,7 @@ sub SD_WS_Maverick_updateReadings($){
|
|||||||
<b>Unterstützte Modelle:</b>
|
<b>Unterstützte Modelle:</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Maverick 732/733</li>
|
<li>Maverick 732/733</li>
|
||||||
|
<li>TFA 14.1504 (Küchen-Chef Funk-Bratenthermometer)</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
Neu empfangene Sensoren werden in FHEM per autocreate angelegt (sofern autocreate in global aktiv ist).
|
Neu empfangene Sensoren werden in FHEM per autocreate angelegt (sofern autocreate in global aktiv ist).
|
||||||
@ -417,8 +403,8 @@ sub SD_WS_Maverick_updateReadings($){
|
|||||||
<li>State (Food: BBQ: )</li>
|
<li>State (Food: BBQ: )</li>
|
||||||
<li>temp-food (°C)</li>
|
<li>temp-food (°C)</li>
|
||||||
<li>temp-bbq (°C)</li>
|
<li>temp-bbq (°C)</li>
|
||||||
<li>Sensor-1-food_state (connected, disconnected oder inactiv)</li>
|
<li>Sensor-1-food_state (connected, disconnected oder inactive)</li>
|
||||||
<li>Sensor-2-bbq_state (connected, disconnected oder inactiv)</li>
|
<li>Sensor-2-bbq_state (connected, disconnected oder inactive)</li>
|
||||||
<li>messageType (sync bei Start oder resync, sonst normal)</li>
|
<li>messageType (sync bei Start oder resync, sonst normal)</li>
|
||||||
<li>checksum (experimentell)</li>
|
<li>checksum (experimentell)</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -426,7 +412,7 @@ sub SD_WS_Maverick_updateReadings($){
|
|||||||
<b>Attribute</b>
|
<b>Attribute</b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>inactivityinterval <Sekunden (60-3600)><br>
|
<li>inactivityinterval <Sekunden (60-3600)><br>
|
||||||
Das Interval nach dem Sensor-1-food_state und/oder Sensor-2-bbq_state auf inactiv gesetzt werden, wenn keine Signale mehr empfangen werden.
|
Das Interval nach dem Sensor-1-food_state und/oder Sensor-2-bbq_state auf inactive gesetzt werden, wenn keine Signale mehr empfangen werden.
|
||||||
Hilfreich zum erkennen einer leeren Batterie oder eines defekten Termperaturfühlers.<br>
|
Hilfreich zum erkennen einer leeren Batterie oder eines defekten Termperaturfühlers.<br>
|
||||||
<code>default: 360</code></li>
|
<code>default: 360</code></li>
|
||||||
<li><a href="#do_not_notify">do_not_notify</a></li>
|
<li><a href="#do_not_notify">do_not_notify</a></li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user