Package org.openwebnet4j.message
Class Thermoregulation
- java.lang.Object
-
- org.openwebnet4j.message.OpenMessage
-
- org.openwebnet4j.message.BaseOpenMessage
-
- org.openwebnet4j.message.Thermoregulation
-
public class Thermoregulation extends BaseOpenMessage
OpenWebNet Thermoregulation messages (WHO=4)- Author:
- M. Valla - Initial contribution, G. Cocchi - Contribution for new lib, A. Conte - Added fancoil speed support
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Thermoregulation.DimThermo
static class
Thermoregulation.FanCoilSpeed
static class
Thermoregulation.Function
static class
Thermoregulation.LocalOffset
static class
Thermoregulation.OperationMode
static class
Thermoregulation.ValveOrActuatorStatus
static class
Thermoregulation.WhatThermo
-
Field Summary
-
Fields inherited from class org.openwebnet4j.message.BaseOpenMessage
FORMAT_DIMENSION_REQUEST, FORMAT_DIMENSION_WRITING_1P_1V, FORMAT_DIMENSION_WRITING_1V, FORMAT_DIMENSION_WRITING_2V, FORMAT_REQUEST, FORMAT_STATUS, MAX_FRAME_LENGTH, where, whereStr, who
-
Fields inherited from class org.openwebnet4j.message.OpenMessage
FRAME_ACK, FRAME_ACK_NACK_BUSY_START, FRAME_BUSY_NACK, FRAME_END, FRAME_NACK, FRAME_START, FRAME_START_DIM, frameValue
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Thermoregulation(String value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
decodeTemperature(String _temperature)
Convert temperature from BTicino format to number For example: 0235 --> +23.5 (°C) and 1048 --> -4.8 (°C)OpenDeviceType
detectDeviceType()
Tries to return aOpenDeviceType
based on frame valueprotected Dim
dimFromValue(int i)
static String
encodeTemperature(double temp)
Encodes temperature from float to BTicino formatint
getActuator()
Returns the actuator form the message WHERE part.int
getActuatorStatus(int n)
Extracts status of actuator N from messageThermoregulation.LocalOffset
getLocalOffset()
Extracts the Local Offset valuestatic Thermoregulation.ValveOrActuatorStatus
parseActuatorStatus(Thermoregulation msg)
Parse actuator status from Thermoregulation message (dimensions: 20)static Thermoregulation.FanCoilSpeed
parseFanCoilSpeed(Thermoregulation msg)
Parse fan coil speed from Thermoregulation message (dimensions: 11)static double
parseTemperature(Thermoregulation msg)
Parse temperature from a Thermoregulation message (dimensions: 0, 12, 14 or 15)static Thermoregulation.ValveOrActuatorStatus
parseValveStatus(Thermoregulation msg, Thermoregulation.WhatThermo what)
Parse valve status (CV and HV) from Thermoregulation message (dimensions: 19)protected void
parseWhere()
Parse WHERE and assigns it toBaseOpenMessage.where
attributestatic Thermoregulation
requestActuatorStatus(String where)
OpenWebNet message N actuator status request*#4*where*20##
.static Thermoregulation
requestFanCoilSpeed(String where)
OpenWebNet message request the Fan Coil Speed*#4*where*11##
.static Thermoregulation
requestMode(String where)
OpenWebNet message request set-point temperature with local offset and operation mode*#4*where*12##
.static Thermoregulation
requestSetPointTemperature(String where)
OpenWebNet message request the current Thermostat Set Point temperature*#4*where*14##
.static Thermoregulation
requestStatus(String where)
OpenWebNet message N zone device status request*#4*where##
.static Thermoregulation
requestTemperature(String where)
OpenWebNet message request temperature*#4*where*0##
.static Thermoregulation
requestTurnOff(String where)
OpenWebNet message request to turn off the thermostatOFF
*4*303*where##
.static Thermoregulation
requestValvesStatus(String where)
OpenWebNet message N zone valves status request*#4*where*19##
.static Thermoregulation
requestValveStatus(String where)
OpenWebNet message request valves status (conditioning (CV) and heating (HV))*#4*where*19##
.static Thermoregulation
requestWriteFanCoilSpeed(String where, Thermoregulation.FanCoilSpeed newFanCoilSpeed)
OpenWebNet to set the Fan Coil Speed*#4*where*#11*speed##
.static Thermoregulation
requestWriteFunction(String where, Thermoregulation.Function newFunction)
OpenWebNet to set the funcion.static Thermoregulation
requestWriteMode(String where, Thermoregulation.OperationMode newOperationMode, Thermoregulation.Function currentFunction, double setPointTemperature)
OpenWebNet to set the operation mode.static Thermoregulation
requestWriteSetMode(String where, Thermoregulation.WhatThermo newMode)
OpenWebNet to set the Thermoregulation device mode.static Thermoregulation
requestWriteSetpointTemperature(String where, double newSetPointTemperature, Thermoregulation.Function function)
OpenWebNet message to Manual setting of "N" zone to T temperature*#4*where*#14*T*M##
.protected What
whatFromValue(int i)
-
Methods inherited from class org.openwebnet4j.message.BaseOpenMessage
addValues, getCommandParams, getDim, getDimParams, getDimValues, getWhat, getWhere, getWho, isCommand, isCommandTranslation, isDimWriting, parse, toStringVerbose
-
Methods inherited from class org.openwebnet4j.message.OpenMessage
equals, getFrameValue, isACK, isBUSY_NACK, isNACK, toString
-
-
-
-
Constructor Detail
-
Thermoregulation
protected Thermoregulation(String value)
-
-
Method Detail
-
whatFromValue
protected What whatFromValue(int i)
- Specified by:
whatFromValue
in classBaseOpenMessage
-
dimFromValue
protected Dim dimFromValue(int i)
- Specified by:
dimFromValue
in classBaseOpenMessage
-
requestWriteSetpointTemperature
public static Thermoregulation requestWriteSetpointTemperature(String where, double newSetPointTemperature, Thermoregulation.Function function) throws MalformedFrameException
OpenWebNet message to Manual setting of "N" zone to T temperature*#4*where*#14*T*M##
.- Parameters:
where
- Zone between #1 and #99newSetPointTemperature
- temperature T between 5.0° and 40.0° (with 0.5° step)function
- HEATING/COOLING/GENERIC- Returns:
- message
- Throws:
MalformedFrameException
- in case of error in parameters
-
requestWriteFanCoilSpeed
public static Thermoregulation requestWriteFanCoilSpeed(String where, Thermoregulation.FanCoilSpeed newFanCoilSpeed)
OpenWebNet to set the Fan Coil Speed*#4*where*#11*speed##
.- Parameters:
where
- WHERE stringnewFanCoilSpeed
- Speed of the Fan Coil- Returns:
- message
-
requestFanCoilSpeed
public static Thermoregulation requestFanCoilSpeed(String where)
OpenWebNet message request the Fan Coil Speed*#4*where*11##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestWriteFunction
public static Thermoregulation requestWriteFunction(String where, Thermoregulation.Function newFunction)
OpenWebNet to set the funcion.- Parameters:
where
- WHERE stringnewFunction
- Function (HEATING, COOLING, GENERIC). HEATING*4*102*where##
COOLING*4*202*where##
GENERIC*4*302*where##
- Returns:
- message
-
requestWriteMode
public static Thermoregulation requestWriteMode(String where, Thermoregulation.OperationMode newOperationMode, Thermoregulation.Function currentFunction, double setPointTemperature)
OpenWebNet to set the operation mode.- Parameters:
where
- WHERE stringnewOperationMode
- Operation mode (MANUAL, PROTECTION, OFF). MANUAL*#4*where*#14*T*M##
(requestWriteSetPointTemperature) PROTECTION*4*302*where##
(generic protection) OFF*4*303*where##
(generic OFF)currentFunction
- current thermostat function (HEATING/COOLING/GENERIC)setPointTemperature
- temperature T between 5.0° and 40.0° (with 0.5° step) to be set when switching to function=MANUAL- Returns:
- message
-
requestMode
public static Thermoregulation requestMode(String where)
OpenWebNet message request set-point temperature with local offset and operation mode*#4*where*12##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestValveStatus
public static Thermoregulation requestValveStatus(String where)
OpenWebNet message request valves status (conditioning (CV) and heating (HV))*#4*where*19##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestWriteSetMode
public static Thermoregulation requestWriteSetMode(String where, Thermoregulation.WhatThermo newMode) throws MalformedFrameException
OpenWebNet to set the Thermoregulation device mode.- Parameters:
where
- Zone between #1 and #99newMode
- the new MODE- Returns:
- message
- Throws:
MalformedFrameException
- in case of error in parameters
-
requestTurnOff
public static Thermoregulation requestTurnOff(String where)
OpenWebNet message request to turn off the thermostatOFF
*4*303*where##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestTemperature
public static Thermoregulation requestTemperature(String where)
OpenWebNet message request temperature*#4*where*0##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestSetPointTemperature
public static Thermoregulation requestSetPointTemperature(String where)
OpenWebNet message request the current Thermostat Set Point temperature*#4*where*14##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestStatus
public static Thermoregulation requestStatus(String where)
OpenWebNet message N zone device status request*#4*where##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestValvesStatus
public static Thermoregulation requestValvesStatus(String where)
OpenWebNet message N zone valves status request*#4*where*19##
.- Parameters:
where
- WHERE string- Returns:
- message
-
requestActuatorStatus
public static Thermoregulation requestActuatorStatus(String where)
OpenWebNet message N actuator status request*#4*where*20##
.- Parameters:
where
- WHERE string- Returns:
- message
-
parseWhere
protected void parseWhere() throws FrameException
Description copied from class:BaseOpenMessage
Parse WHERE and assigns it toBaseOpenMessage.where
attribute- Specified by:
parseWhere
in classBaseOpenMessage
- Throws:
FrameException
- in case of error in frame
-
getActuator
public int getActuator()
Returns the actuator form the message WHERE part. WHERE=Z#N --> returns N- Returns:
- id (int 1-9) of the actuator
-
getActuatorStatus
public int getActuatorStatus(int n) throws FrameException
Extracts status of actuator N from message- Parameters:
n
- the actuator number- Returns:
- 0=OFF, 1=ON
- Throws:
FrameException
- in case of frame error
-
getLocalOffset
public Thermoregulation.LocalOffset getLocalOffset() throws FrameException
Extracts the Local Offset value- Returns:
- localOffset
- Throws:
FrameException
- in case of frame error
-
parseTemperature
public static double parseTemperature(Thermoregulation msg) throws NumberFormatException, FrameException
Parse temperature from a Thermoregulation message (dimensions: 0, 12, 14 or 15)- Parameters:
msg
- Thermoregulation message- Returns:
- parsed temperature in degrees Celsius
- Throws:
NumberFormatException
- if the temperature cannot be parsedFrameException
- in case of error in message
-
decodeTemperature
public static double decodeTemperature(String _temperature) throws NumberFormatException
Convert temperature from BTicino format to number For example: 0235 --> +23.5 (°C) and 1048 --> -4.8 (°C)- Parameters:
_temperature
- the temperature as String- Returns:
- the temperature as Double
- Throws:
NumberFormatException
-
encodeTemperature
public static String encodeTemperature(double temp)
Encodes temperature from float to BTicino format- Parameters:
temp
- temperature- Returns:
- String
-
parseFanCoilSpeed
public static Thermoregulation.FanCoilSpeed parseFanCoilSpeed(Thermoregulation msg) throws NumberFormatException, FrameException
Parse fan coil speed from Thermoregulation message (dimensions: 11)- Parameters:
msg
- Thermoregulation message- Returns:
- parsed fan coil speed as
Thermoregulation.FanCoilSpeed
- Throws:
NumberFormatException
- in case of invalid speedFrameException
- in case of error in message
-
parseValveStatus
public static Thermoregulation.ValveOrActuatorStatus parseValveStatus(Thermoregulation msg, Thermoregulation.WhatThermo what) throws NumberFormatException, FrameException
Parse valve status (CV and HV) from Thermoregulation message (dimensions: 19)- Parameters:
msg
- Thermoregulation messagewhat
- Look for COOLING (CV) or HEATING (HV) valve- Returns:
- parsed valve status as
Thermoregulation.ValveOrActuatorStatus
- Throws:
NumberFormatException
- in case of invalid statusFrameException
- in case of error in message
-
parseActuatorStatus
public static Thermoregulation.ValveOrActuatorStatus parseActuatorStatus(Thermoregulation msg) throws NumberFormatException, FrameException
Parse actuator status from Thermoregulation message (dimensions: 20)- Parameters:
msg
- Thermoregulation message- Returns:
- parsed actuator status as
Thermoregulation.ValveOrActuatorStatus
- Throws:
NumberFormatException
- in case of invalid statusFrameException
- in case of error in message
-
detectDeviceType
public OpenDeviceType detectDeviceType()
Description copied from class:BaseOpenMessage
Tries to return aOpenDeviceType
based on frame value- Specified by:
detectDeviceType
in classBaseOpenMessage
- Returns:
- recognized device type or null if not device can be recognized
-
-