Package de.freaklamarsch.systarest
Class SystaRESTAPI
java.lang.Object
de.freaklamarsch.systarest.SystaRESTAPI
@Path("{systarest : (?i)systarest}")
public class SystaRESTAPI
extends java.lang.Object
/** A REST API for interacting with the Paradigma SystaComfort system. This
API provides endpoints for retrieving system status, monitoring raw data, and
managing logging. This class is intended to be run by a
SystaRESTServer-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>configprivate static FakeSystaWebfswprivate static SystaRESTAPIinstanceprivate jakarta.json.JsonBuilderFactoryjsonFactorystatic java.lang.StringPROP_LOG_DIRstatic java.lang.StringPROP_PARADIGMA_IPprivate static java.lang.Threadt -
Constructor Summary
Constructors Constructor Description SystaRESTAPI(org.glassfish.jersey.server.ResourceConfig config)Create SystaRESTAPI object which provides the Jersey REST API resource for the SystaRESTServer. -
Method Summary
Modifier and Type Method Description voiddeleteAllLogs()voiddisablelogging()disables the logging of the received data packets.voidenablelogging(java.lang.String filePrefix, java.lang.String delimiter, int entriesPerFile)enables the logging of each received data element to a log filejakarta.json.JsonObjectfindSystaComfort()find SystaComfort units using the search capability of the device touch protocol.jakarta.ws.rs.core.ResponsegetAllLogs()java.io.InputStreamgetDashboardHTML()Returns the a .html file for showing a dashboard for the values of the last 24h in the browser.(package private) static SystaRESTAPIgetInstance()Returns the singleton instance of SystaRESTAPI.java.io.InputStreamgetMonitorRawDataHTML(java.lang.String theme)Returns the a .html file for monitoring raw data in the browser.jakarta.json.JsonObjectgetRawData()Get the last values received by the FakeSystaWeb, without any conversion or interpretationjakarta.json.JsonObjectgetStatus()returns a JsonObject holding the status of the connected Paradigma SystaComfort II.jakarta.json.JsonObjectgetWaterHeater()returns a JsonObject holding the fields of an Home Assistant Water Heater Entityprivate voidprintAPI()print information about the provided functions by this REST API.voidstart(org.glassfish.jersey.server.ResourceConfig config)start the associatedFakeSystaWeb, for receiving packets from a Paradigma SystaComfort IIjakarta.json.JsonObjectstatus()return the status of the SystaRESTAPI servicevoidstop()stop listening for packetsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
PROP_PARADIGMA_IP
public static final java.lang.String PROP_PARADIGMA_IP- See Also:
- Constant Field Values
-
PROP_LOG_DIR
public static final java.lang.String PROP_LOG_DIR- See Also:
- Constant Field Values
-
fsw
-
t
private static java.lang.Thread t -
config
private final java.util.Map<java.lang.String,java.lang.Object> config -
jsonFactory
private final jakarta.json.JsonBuilderFactory jsonFactory -
instance
-
-
Constructor Details
-
SystaRESTAPI
public SystaRESTAPI(@Context org.glassfish.jersey.server.ResourceConfig config)Create SystaRESTAPI object which provides the Jersey REST API resource for the SystaRESTServer. The constructor is called by every call to the server- Parameters:
config-ResourceConfigthat holds the propertyPROP_PARADIGMA_IPfor configuring the used IP address
-
-
Method Details
-
getInstance
Returns the singleton instance of SystaRESTAPI. This is package-private for access from tests or other closely related classes.- Returns:
- The SystaRESTAPI instance.
-
printAPI
private void printAPI()print information about the provided functions by this REST API. This function is only used for debugging server problems. In general, the API can also be accesses by callinghttp://<ip>:<port>/application.wadl?detail=true -
start
@POST @Path("{start : (?i)start}") public void start(@Context org.glassfish.jersey.server.ResourceConfig config)start the associatedFakeSystaWeb, for receiving packets from a Paradigma SystaComfort II- Parameters:
config-ResourceConfigthat holds the propertyPROP_PARADIGMA_IPfor configuring the used IP address
-
stop
@POST @Path("{stop : (?i)stop}") public void stop()stop listening for packets -
findSystaComfort
@GET @Path("{findsystacomfort : (?i)findsystacomfort}") @Produces("application/json") public jakarta.json.JsonObject findSystaComfort()find SystaComfort units using the search capability of the device touch protocol. This function looks over all available network interfaces and tries to discover device touch capable units using a search broadcast message.- Returns:
- a JSON object representing the found unit, or null
-
status
@GET @Path("{servicestatus : (?i)servicestatus}") @Produces("application/json") public jakarta.json.JsonObject status()return the status of the SystaRESTAPI service- Returns:
- JSONObject holding the status
-
getRawData
@GET @Path("{rawdata : (?i)rawdata}") @Produces("application/json") public jakarta.json.JsonObject getRawData()Get the last values received by the FakeSystaWeb, without any conversion or interpretation- Returns:
- JsonObject holding the values of the last received data
-
getWaterHeater
@GET @Path("{waterheater : (?i)waterheater}") @Produces("application/json") public jakarta.json.JsonObject getWaterHeater()returns a JsonObject holding the fields of an Home Assistant Water Heater Entity- Returns:
- the Water Heater Entity
-
getStatus
@GET @Path("{status : (?i)status}") @Produces("application/json") public jakarta.json.JsonObject getStatus()returns a JsonObject holding the status of the connected Paradigma SystaComfort II. The status is all known fields.- Returns:
- the status
-
enablelogging
@PUT @Path("{enablelogging : (?i)enablelogging}") public void enablelogging(@DefaultValue("SystaREST") @QueryParam("filePrefix") java.lang.String filePrefix, @DefaultValue(";") @QueryParam("logEntryDelimiter") java.lang.String delimiter, @DefaultValue("60") @QueryParam("entriesPerFile") int entriesPerFile)enables the logging of each received data element to a log file- Parameters:
filePrefix- the prefix for the created log files. Following the prefix a running number is added to the file names defaults toparadigmadelimiter- the delimiter used in the log files for seperating the entries. Defaults to;entriesPerFile- the logger collects up to this number of elemnt before writing the file to disk. Defaults to60
-
disablelogging
@PUT @Path("{disablelogging : (?i)disablelogging}") public void disablelogging()disables the logging of the received data packets. Writes the collected packets from memory to disk, even if the last file is not full -
getAllLogs
@GET @Path("{getalllogs : (?i)getalllogs}") @Produces("application/zip") public jakarta.ws.rs.core.Response getAllLogs() -
deleteAllLogs
@DELETE @Path("{deletealllogs : (?i)deletealllogs}") public void deleteAllLogs() -
getMonitorRawDataHTML
@GET @Produces("text/html") @Path("{monitorrawdata : (?i)monitorrawdata}") public java.io.InputStream getMonitorRawDataHTML(@DefaultValue("systarest") @QueryParam("theme") java.lang.String theme)Returns the a .html file for monitoring raw data in the browser.- Parameters:
theme- parameter to define which page .html file to load. Possible values are systarest or systaweb- Returns:
- the InputStream of the file, or null, if something went wrong in the file handling
-
getDashboardHTML
@GET @Produces("text/html") @Path("{dashboard : (?i)dashboard}") public java.io.InputStream getDashboardHTML()Returns the a .html file for showing a dashboard for the values of the last 24h in the browser.- Returns:
- the InputStream of the file, or null, if something went wrong in the file handling
-