This commit is contained in:
Thomas Vogl 2024-03-02 21:53:38 +01:00
parent f88d80d6db
commit ac8486d150
2 changed files with 14 additions and 14 deletions

View File

@ -39,7 +39,7 @@ public abstract class AbstractEcowittServlet extends HttpServlet {
@Nullable
protected StateUpdater stateUpdater = null;
private final Logger logger = LoggerFactory.getLogger(AbstractEcowittServlet.class);
protected final Logger logger = LoggerFactory.getLogger(AbstractEcowittServlet.class);
protected void doPost(HttpServletRequest request, HttpServletResponse response) {
for (Map.Entry<String, String[]> stringEntry : request.getParameterMap().entrySet()) {

View File

@ -57,53 +57,53 @@ public class EcowittGW1000Servlet extends AbstractEcowittServlet {
}
String type = channelUID.getId();
float value;
Float value;
switch (type) {
case "humidity":
case "atmospheric-humidity":
case "moisture":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.PERCENT));
break;
case "temperature":
case "outdoor-temperature":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.FAHRENHEIT));
break;
case "uv-index":
case "lightning-num":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new DecimalType(value));
break;
case "rain-amount":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.INCH));
break;
case "rain-rate":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.INCHES_PER_HOUR));
break;
case "wind-speed":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.MILES_PER_HOUR));
break;
case "wind-direction":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.DEGREE_ANGLE));
break;
case "barometric-pressure":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, ImperialUnits.INCH_OF_MERCURY));
break;
case "solar-radiation":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.IRRADIANCE));
break;
case "lightning-distance":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, MetricPrefix.KILO(SIUnits.METRE)));
break;
@ -113,12 +113,12 @@ public class EcowittGW1000Servlet extends AbstractEcowittServlet {
break;
case "pm25-particles":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
stateUpdater.updateState(ch.getUID(), new QuantityType<>(value, Units.MICROGRAM_PER_CUBICMETRE));
break;
case "battery-level":
value = Float.parseFloat(strValue);
value = new Float(Float.parseFloat(strValue));
int batLevel = 0;
switch (id) {
case "pm25batt1":