| `wifi5GHzEnable` | `Switch` | | Enable/Disable the 5.0 GHz WiFi device. |
| `wifiGuestEnable` | `Switch` | | Enable/Disable the guest WiFi. |
| `macOnline` | `Switch` | x | Online status of the device with the given MAC |
+| `macIP` | `String` | x | IP of the device with the given MAC |
+| `macSignalStrength1` | `Number` | x | Wifi Signal Strength of the device with the given MAC. This is set in case the Device is connected to 2.4Ghz |
+| `macSpeed1` | `Number:DataTransferRate` | x | Wifi Speed of the device with the given MAC. This is set in case the Device is connected to 2.4Ghz |
+| `macSignalStrength2` | `Number` | x | Wifi Signal Strength of the device with the given MAC. This is set in case the Device is connected to 5Ghz |
+| `macSpeed2` | `Number:DataTransferRate` | x | Wifi Speed of the device with the given MAC. This is set in case the Device is connected to 5Ghz |
Older FritzBox devices may not support 5 GHz WiFi.
In this case you have to use the `wifi5GHzEnable` channel for switching the guest WiFi.
return Optional.empty();
}
switch (dataType) {
+ case "ui1":
case "ui2":
return Optional.of(String.valueOf(value.shortValue()));
case "i4":
} else if (command instanceof DecimalType) {
BigDecimal value = ((DecimalType) command).toBigDecimal();
switch (dataType) {
+ case "ui1":
case "ui2":
return Optional.of(String.valueOf(value.shortValue()));
case "i4":
return rawValue.equals("0") ? OnOffType.OFF : OnOffType.ON;
case "string":
return new StringType(rawValue);
+ case "ui1":
case "ui2":
case "i4":
case "ui4":
}).or(Optional::empty);
}
+ /**
+ * post processor to map mac device signal strength to system.signal-strength 0-4
+ *
+ * @param state with signalStrength
+ * @param channelConfig channel config of the mac signal strength
+ * @return the mapped system.signal-strength in range 0-4
+ */
+ @SuppressWarnings("unused")
+ private State processMacSignalStrength(State state, Tr064ChannelConfig channelConfig) {
+ State mappedSignalStrength = UnDefType.UNDEF;
+ DecimalType currentStateValue = state.as(DecimalType.class);
+
+ if (currentStateValue != null) {
+ if (currentStateValue.intValue() > 80) {
+ mappedSignalStrength = new DecimalType(4);
+ } else if (currentStateValue.intValue() > 60) {
+ mappedSignalStrength = new DecimalType(3);
+ } else if (currentStateValue.intValue() > 40) {
+ mappedSignalStrength = new DecimalType(2);
+ } else if (currentStateValue.intValue() > 20) {
+ mappedSignalStrength = new DecimalType(1);
+ } else {
+ mappedSignalStrength = new DecimalType(0);
+ }
+ }
+
+ return mappedSignalStrength;
+ }
+
/**
* post processor for answering machine new messages channel
*
import java.lang.reflect.Field;
import java.time.Duration;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
.forEach(channelTypeDescription -> {
String channelId = channelTypeDescription.getName();
String serviceId = channelTypeDescription.getService().getServiceId();
+ String typeId = channelTypeDescription.getTypeId();
+ Map<String, String> channelProperties = new HashMap<String, String>();
+
+ if (typeId != null) {
+ channelProperties.put("typeId", typeId);
+ }
+
Set<String> parameters = new HashSet<>();
try {
SCPDServiceType deviceService = scpdUtil.getDevice(deviceId)
ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId);
ChannelBuilder channelBuilder = ChannelBuilder
.create(channelUID, channelTypeDescription.getItem().getType())
- .withType(channelTypeUID);
+ .withType(channelTypeUID).withProperties(channelProperties);
thingBuilder.withChannel(channelBuilder.build());
channels.put(channelUID, channelConfig);
} else {
channelId + "_" + normalizedParameter);
ChannelBuilder channelBuilder = ChannelBuilder
.create(channelUID, channelTypeDescription.getItem().getType())
- .withType(channelTypeUID)
+ .withType(channelTypeUID).withProperties(channelProperties)
.withLabel(channelTypeDescription.getLabel() + " " + parameter);
thingBuilder.withChannel(channelBuilder.build());
Tr064ChannelConfig channelConfig1 = new Tr064ChannelConfig(channelConfig);
pattern="([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}(\s*#.*)*"/>
</getAction>
</channel>
+ <channel name="macIP" label="MAC IP" description="IP of the device with the given MAC">
+ <item type="String"/>
+ <service deviceType="urn:dslforum-org:device:LANDevice:1" serviceId="urn:LanDeviceHosts-com:serviceId:Hosts1"/>
+ <getAction name="GetSpecificHostEntry" argument="NewIPAddress">
+ <parameter name="NewMACAddress" thingParameter="macOnline"
+ pattern="([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}(\s*#.*)*"/>
+ </getAction>
+ </channel>
+
+ <!-- WLAN Config 1 - 2.4 Ghz -->
+ <channel name="macSignalStrength1" label="MAC Wifi Signal Strength 2.4Ghz"
+ description="Wifi Signal Strength of the device with
+ the given MAC. This is set in case the Device is connected to 2.4Ghz"
+ typeId="system.signal-strength">
+ <item type="Number"/>
+ <service deviceType="urn:dslforum-org:device:LANDevice:1"
+ serviceId="urn:WLANConfiguration-com:serviceId:WLANConfiguration1"/>
+ <getAction name="GetSpecificAssociatedDeviceInfo" argument="NewX_AVM-DE_SignalStrength"
+ postProcessor="processMacSignalStrength">
+ <parameter name="NewAssociatedDeviceMACAddress" thingParameter="macOnline"
+ pattern="([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}(\s*#.*)*"/>
+ </getAction>
+ </channel>
+ <channel name="macSpeed1" label="MAC Wifi Speed 2.4Ghz"
+ description="Wifi Speed of the device with
+ the given MAC. This is set in case the Device is connected to 2.4Ghz">
+ <item type="Number:DataTransferRate" unit="Mbit/s" statePattern="%d Mbit/s"/>
+ <service deviceType="urn:dslforum-org:device:LANDevice:1"
+ serviceId="urn:WLANConfiguration-com:serviceId:WLANConfiguration1"/>
+ <getAction name="GetSpecificAssociatedDeviceInfo" argument="NewX_AVM-DE_Speed">
+ <parameter name="NewAssociatedDeviceMACAddress" thingParameter="macOnline"
+ pattern="([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}(\s*#.*)*"/>
+ </getAction>
+ </channel>
+
+ <!-- WLAN Config 2 - 5 Ghz -->
+ <channel name="macSignalStrength2" label="MAC Wifi Signal Strength 5Ghz"
+ description="Wifi Signal Strength of the device with
+ the given MAC. This is set in case the Device is connected to 5Ghz"
+ typeId="system.signal-strength">
+ <item type="Number"/>
+ <service deviceType="urn:dslforum-org:device:LANDevice:1"
+ serviceId="urn:WLANConfiguration-com:serviceId:WLANConfiguration2"/>
+ <getAction name="GetSpecificAssociatedDeviceInfo" argument="NewX_AVM-DE_SignalStrength"
+ postProcessor="processMacSignalStrength">
+ <parameter name="NewAssociatedDeviceMACAddress" thingParameter="macOnline"
+ pattern="([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}(\s*#.*)*"/>
+ </getAction>
+ </channel>
+ <channel name="macSpeed2" label="MAC Wifi Speed 5Ghz"
+ description="Wifi Speed of the device with
+ the given MAC. This is set in case the Device is connected to 5Ghz">
+ <item type="Number:DataTransferRate" unit="Mbit/s" statePattern="%d Mbit/s"/>
+ <service deviceType="urn:dslforum-org:device:LANDevice:1"
+ serviceId="urn:WLANConfiguration-com:serviceId:WLANConfiguration2"/>
+ <getAction name="GetSpecificAssociatedDeviceInfo" argument="NewX_AVM-DE_Speed">
+ <parameter name="NewAssociatedDeviceMACAddress" thingParameter="macOnline"
+ pattern="([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}(\s*#.*)*"/>
+ </getAction>
+ </channel>
<!-- WAN Device -->
<channel name="wanAccessType" label="Access Type">
<xs:attribute type="xs:string" name="name" use="required"/>
<xs:attribute type="xs:string" name="label"/>
<xs:attribute type="xs:string" name="description"/>
+ <xs:attribute type="xs:string" name="typeId"/>
<xs:attribute type="xs:boolean" name="advanced" default="false"/>
</xs:complexType>
<xs:complexType name="channelTypeDescriptions">