2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

ENIGMA2: add attribute macaddr

git-svn-id: https://svn.fhem.de/fhem/trunk@7705 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2015-01-25 11:28:00 +00:00
parent e76df61ab3
commit 1725473539

View File

@ -24,7 +24,7 @@
# along with fhem. If not, see <http://www.gnu.org/licenses/>.
#
#
# Version: 1.4.1
# Version: 1.4.4
#
# Major Version History:
# - 1.4.0 - 2014-11-27
@ -83,7 +83,7 @@ sub ENIGMA2_Initialize($) {
$hash->{UndefFn} = "ENIGMA2_Undefine";
$hash->{AttrList} =
"https:0,1 http-method:GET,POST http-noshutdown:1,0 disable:0,1 bouquet-tv bouquet-radio timeout remotecontrol:standard,advanced,keyboard lightMode:0,1 "
"https:0,1 http-method:GET,POST http-noshutdown:1,0 disable:0,1 bouquet-tv bouquet-radio timeout remotecontrol:standard,advanced,keyboard lightMode:0,1 macaddr:textField"
. $readingFnAttributes;
$data{RC_layout}{ENIGMA2_DreamMultimedia_DM500_DM800_SVG} =
@ -334,14 +334,20 @@ sub ENIGMA2_Set($@) {
if ( $hash->{READINGS}{state}{VAL} eq "absent" ) {
Log3 $name, 2, "ENIGMA2 set $name " . $a[1] . " (wakeup)";
if ( defined( $hash->{READINGS}{lanmac}{VAL} )
&& $hash->{READINGS}{lanmac}{VAL} ne "-" )
if (
(
defined( $hash->{READINGS}{lanmac}{VAL} )
&& $hash->{READINGS}{lanmac}{VAL} ne "-"
)
|| ( defined( $attr{$name}{macaddr} )
&& $attr{$name}{macaddr} ne "" )
)
{
$result = ENIGMA2_wake($hash);
}
else {
return
"Device MAC address unknown. Please turn on the device manually once.";
"Device MAC address unknown. Please turn on the device manually once or set attribute macaddr.";
}
}
else {
@ -817,11 +823,12 @@ sub ENIGMA2_Define($$) {
###################################
sub ENIGMA2_SendCommand($$;$$) {
my ( $hash, $service, $cmd, $type ) = @_;
my $name = $hash->{NAME};
my $address = $hash->{helper}{ADDRESS};
my $port = $hash->{helper}{PORT};
my $http_method = $attr{$name}{"http-method"};
my $http_noshutdown = ( defined($attr{$name}{"http-noshutdown"}) && $attr{$name}{"http-noshutdown"} eq "0" ) ? 0 : 1;
my $name = $hash->{NAME};
my $address = $hash->{helper}{ADDRESS};
my $port = $hash->{helper}{PORT};
my $http_method = $attr{$name}{"http-method"};
my $http_noshutdown = ( defined( $attr{$name}{"http-noshutdown"} )
&& $attr{$name}{"http-noshutdown"} eq "0" ) ? 0 : 1;
my $timeout;
$cmd = ( defined($cmd) ) ? $cmd : "";
@ -891,7 +898,11 @@ sub ENIGMA2_SendCommand($$;$$) {
# send request via HTTP-GET method
if ( $http_method eq "GET" || $http_method eq "" || $cmd eq "" ) {
Log3 $name, 5, "ENIGMA2 $name: GET " . urlDecode($URL) . " (noshutdown=" . $http_noshutdown . ")";
Log3 $name, 5,
"ENIGMA2 $name: GET "
. urlDecode($URL)
. " (noshutdown="
. $http_noshutdown . ")";
HttpUtils_NonblockingGet(
{
@ -915,7 +926,9 @@ sub ENIGMA2_SendCommand($$;$$) {
"ENIGMA2 $name: GET "
. $URL
. " (POST DATA: "
. urlDecode($cmd) . ", noshutdown=" . $http_noshutdown . ")";
. urlDecode($cmd)
. ", noshutdown="
. $http_noshutdown . ")";
HttpUtils_NonblockingGet(
{
@ -2273,9 +2286,12 @@ sub ENIGMA2_Undefine($$) {
###################################
sub ENIGMA2_wake ($) {
my ($hash) = @_;
my $name = $hash->{NAME};
my $mac_addr = $hash->{READINGS}{lanmac}{VAL};
my ($hash) = @_;
my $name = $hash->{NAME};
my $mac_addr =
( defined( $attr{$name}{macaddr} ) )
? $attr{$name}{macaddr}
: $hash->{READINGS}{lanmac}{VAL};
my $address;
my $port;