Skip to content

Instantly share code, notes, and snippets.

@IT-Berater
Created October 27, 2020 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IT-Berater/c58da54b1f20337827f8de827715d728 to your computer and use it in GitHub Desktop.
Save IT-Berater/c58da54b1f20337827f8de827715d728 to your computer and use it in GitHub Desktop.
package de.wenzlaff;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/v1")
public class CO2AmpelResource {
static {
try {
MqttCo2Client.start();
} catch (Exception e) {
}
}
@Path("/rest/co2ampel")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String co2ampel() {
return "CO2Ampel: " + MqttCo2Client.bewertungUBAausgeben(MqttCo2Client.getCo2WertInPpm());
}
@Path("/rest/co2")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String co2wert() {
return "CO2 Wert: " + MqttCo2Client.getCo2WertInPpm();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment