From 84ea8500e16c1bc05a752a702ca5b4fc30704444 Mon Sep 17 00:00:00 2001
From: breaker27 <>
Date: Fri, 14 Jun 2024 17:34:38 +0000
Subject: [PATCH] 37_SHCdev.pm: Added support for new proxy device. Set icons
for devices automatically.
git-svn-id: https://svn.fhem.de/fhem/trunk@28969 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/37_SHCdev.pm | 19 +++++++++++++++++--
fhem/FHEM/lib/SHC_packet_layout.xml | 4 ++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/fhem/FHEM/37_SHCdev.pm b/fhem/FHEM/37_SHCdev.pm
index b0b549284..c9515c4d9 100644
--- a/fhem/FHEM/37_SHCdev.pm
+++ b/fhem/FHEM/37_SHCdev.pm
@@ -2,7 +2,7 @@
# This file is part of the smarthomatic module for FHEM.
#
# Copyright (c) 2014 Stefan Baumann
-# 2014, 2015, 2019, 2022, 2023 Uwe Freese
+# 2014, 2015, 2019, 2022, 2023, 2024 Uwe Freese
#
# You can find smarthomatic at www.smarthomatic.org.
# You can find FHEM at www.fhem.de.
@@ -34,11 +34,22 @@ use SHC_parser;
my $parser = new SHC_parser();
+my %icons = (
+ "PowerSwitch" => "message_socket",
+ "Dimmer" => "light_ceiling",
+ "EnvSensor" => "temperature_humidity",
+ "Controller" => "display_dot",
+ "Proxy" => "it_router",
+ "RGBDimmer" => "control_arrow_turn_right",
+ "SoilMoistureMeter" => "sani_irrigation"
+);
+
my %dev_state_icons = (
"PowerSwitch" => ".*1\\d{7}:on:off .*0\\d{7}:off:on set.*:light_question:off",
"Dimmer" => "on:on off:off set.*:light_question:off",
"EnvSensor" => undef,
"Controller" => undef,
+ "Proxy" => undef,
"RGBDimmer" => undef,
"SoilMoistureMeter" => ".*H:\\s\\d\\..*:ampel_rot"
);
@@ -48,6 +59,7 @@ my %web_cmds = (
"Dimmer" => "on:off:statusRequest",
"EnvSensor" => undef,
"Controller" => undef,
+ "Proxy" => undef,
"RGBDimmer" => undef,
"SoilMoistureMeter" => undef
);
@@ -140,7 +152,7 @@ sub SHCdev_Initialize($)
." readonly:1"
." forceOn:1"
." $readingFnAttributes"
- ." devtype:EnvSensor,Dimmer,PowerSwitch,Controller,RGBDimmer,SoilMoistureMeter";
+ ." devtype:EnvSensor,Dimmer,PowerSwitch,Controller,Proxy,RGBDimmer,SoilMoistureMeter";
}
#####################################
@@ -437,6 +449,9 @@ sub SHCdev_Parse($$)
# If the devtype is defined add, if not already done, the according webCmds and devStateIcons
my $devtype2 = AttrVal( $rname, "devtype", undef );
if (defined($devtype2)) {
+ if (!defined($attr{$rname}{icon}) && defined($icons{$devtype2})) {
+ $attr{$rname}{icon} = $icons{$devtype2};
+ }
if (!defined($attr{$rname}{devStateIcon}) && defined($dev_state_icons{$devtype2})) {
$attr{$rname}{devStateIcon} = $dev_state_icons{$devtype2};
}
diff --git a/fhem/FHEM/lib/SHC_packet_layout.xml b/fhem/FHEM/lib/SHC_packet_layout.xml
index 8ba5b2de0..0f10a7504 100644
--- a/fhem/FHEM/lib/SHC_packet_layout.xml
+++ b/fhem/FHEM/lib/SHC_packet_layout.xml
@@ -204,6 +204,10 @@
0
BaseStation
+
+ 10
+ Proxy
+
20
EnvSensor