* Servlet handler. Shelly1: http request, Shelly2: WebSocket call
*/
@Override
- protected void service(HttpServletRequest request, HttpServletResponse resp)
+ protected void service(@Nullable HttpServletRequest request, @Nullable HttpServletResponse resp)
throws ServletException, IOException, IllegalArgumentException {
String path = getString(request.getRequestURI()).toLowerCase();
-
if (path.equals(SHELLY2_CALLBACK_URI)) { // Shelly2 WebSocket
- super.service(request, resp);
+ if (request != null && resp != null) {
+ super.service(request, resp);
+ }
return;
}
config.serviceName = getString(properties.get(PROPERTY_SERVICE_NAME));
config.localIp = bindingConfig.localIP;
config.localPort = String.valueOf(bindingConfig.httpPort);
+ if (config.localIp.startsWith("169.254")) {
+ setThingOffline(ThingStatusDetail.COMMUNICATION_ERROR, "config-status.error.network-config",
+ config.localIp);
+ return;
+ }
+
if (!profile.isGen2 && config.userId.isEmpty() && !bindingConfig.defaultUserId.isEmpty()) {
// Gen2 has hard coded user "admin"
config.userId = bindingConfig.defaultUserId;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/**
*
* @author Markus Michels - Initial contribution
*/
-@NonNullByDefault
public class ShellyManagerCache<K, V> extends ConcurrentHashMap<K, V> {
private static final long serialVersionUID = 1L;
}
@Override
- public @Nullable V put(K key, V value) {
+ public V put(K key, V value) {
Date date = new Date();
timeMap.put(key, date.getTime());
return super.put(key, value);
}
@Override
- public @Nullable V putIfAbsent(K key, V value) {
+ public V putIfAbsent(K key, V value) {
if (!containsKey(key)) {
return put(key, value);
} else {
}
}
- @SuppressWarnings("null")
private void cleanMap() {
long currentTime = new Date().getTime();
for (K key : timeMap.keySet()) {
addon.shelly.config.autoCoIoT.description = If enabled CoIoT will be automatically used when the devices runs a firmware version 1.6 or newer; false: Use thing configuration to enabled/disable CoIoT events.
# Config status messages
+message.config-status.error.network-config = Invalid system or openHAB network configuration was detected (local IP {0}).
message.config-status.error.missing-device-address = IP/MAC Address of the Shelly device is missing.
message.config-status.error.missing-userid = No user ID in the Thing configuration