RCTemp changes

This commit is contained in:
proddy
2018-06-17 11:30:03 +02:00
parent f6e2ea12b5
commit 3833533017
4 changed files with 35 additions and 26 deletions

View File

@@ -173,10 +173,11 @@ The Boiler (ID 0x08) will send out these broadcast telegrams regularly:
And a thermostat (ID 0x17 for a RC20) would broadcast these messages regularly:
| Type | Description | Comment | Frequency |
| ---- | ----------------- | --------------------------- | ------------ |
| 0x06 | RC20Time | time and date on thermostat | every minute | |
| 0x91 | RC20StatusMessage | thermostat mode | every minute |
| Type | Description | Comment | Frequency |
| ---- | ---------------------- | --------------------------- | ------------ |
| 0x06 | RC20Time | time and date on thermostat | every minute |
| 0x91 | RC20StatusMessage | thermostat mode | every minute |
| 0xA3 | RC20OutdoorTempMessage | external sensors | every minute |
Refer to the code in `ems.cpp` for further explanation on how to parse these message types and also reference the EMS Wiki.
@@ -219,12 +220,11 @@ The code is built on the Arduino framework and is dependent on these external li
| Boiler (0x08) | 0x15 | UBAMaintenanceSettingsMessage | |
| Boiler (0x08) | 0x16 | UBAParametersMessage | |
| Thermostat (0x17) | 0xA8 | RC20Temperature | sets temperature and operating modes |
| Thermostat (0x17) | 0xA3 | RCOutdoorTempMessage | |
| Thermostat (0x17) | 0x02 | Version | reads Version major/minor |
In `boiler.ino` you can make calls to automatically send these read commands. See the function *regularUpdates()*
Note the thermostat types are based on a RC20 model thermostat. If using an RC30/RC35 use types 0x3E and 0x48 to read the values.
Note when reading the temperature values from a non RC20 thermostat like the RC30 or RC35 you will need to query types 0x3E (Monitor HC1) and 0x48 (Monitor HC2) instead of from 0xA8. This is because they have two heating circuits and this will give you the current room selected temperature and specific values for summer, holiday, pause and day modes. Furthermore to get more information on those actual temperature settings and modes use WorkingMode types 0x3D and 0x47 respectively. Consult the wiki documentation for the data format.
### Customizing the code

View File

@@ -619,11 +619,12 @@ void systemCheck() {
// calls to get data from EMS for the types that aren't sent as broadcasts
// number of calls is defined in MAX_MANUAL_CALLS
// it's done sequentially with a count since we don't queue sends (there's really no point)
void regularUpdates() {
uint8_t cycle = (regularUpdatesCount++ % MAX_MANUAL_CALLS);
if ((cycle == 0) && Boiler_Status.thermostat_enabled) {
ems_doReadCommand(EMS_TYPE_RC20Temperature); // to get the thermostat mode which is not broadcasted
ems_doReadCommand(EMS_TYPE_RC20Temperature); // to force get the thermostat mode which is not broadcasted
} else if (cycle == 1) {
ems_doReadCommand(EMS_TYPE_UBAParameterWW); // get Warm Water values
}

View File

@@ -26,7 +26,7 @@ _EMS_Sys_Status EMS_Sys_Status; // EMS Status
_EMS_TxTelegram EMS_TxTelegram; // Empty buffer for sending telegrams
// and call backs
#define MAX_TYPECALLBACK 12 // make sure it matches the #types you have
#define MAX_TYPECALLBACK 13 // make sure it matches the #types you have
// callbacks per type
bool _process_UBAMonitorFast(uint8_t * data, uint8_t length);
bool _process_UBAMonitorSlow(uint8_t * data, uint8_t length);
@@ -35,6 +35,7 @@ bool _process_UBAParameterWW(uint8_t * data, uint8_t length);
bool _process_RC20StatusMessage(uint8_t * data, uint8_t length);
bool _process_RC20Time(uint8_t * data, uint8_t length);
bool _process_RC20Temperature(uint8_t * data, uint8_t length);
bool _process_RCTempMessage(uint8_t * data, uint8_t length);
bool _process_Version(uint8_t * data, uint8_t length);
const _EMS_Types EMS_Types[MAX_TYPECALLBACK] =
@@ -50,6 +51,7 @@ const _EMS_Types EMS_Types[MAX_TYPECALLBACK] =
{EMS_ID_THERMOSTAT, EMS_TYPE_RC20StatusMessage, "RC20StatusMessage", _process_RC20StatusMessage},
{EMS_ID_THERMOSTAT, EMS_TYPE_RC20Time, "RC20Time", _process_RC20Time},
{EMS_ID_THERMOSTAT, EMS_TYPE_RC20Temperature, "RC20Temperature", _process_RC20Temperature},
{EMS_ID_THERMOSTAT, EMS_TYPE_RCTempMessage, "RCTempMessage", _process_RCTempMessage},
{EMS_ID_THERMOSTAT, EMS_TYPE_Version, "Version", _process_Version}};
// reserve space for the data we collect from the Boiler and Thermostat
@@ -203,6 +205,19 @@ uint8_t _crcCalculator(uint8_t * data, uint8_t len) {
return crc;
}
// function to turn a telegram int (2 bytes) to a float
float _toFloat(uint8_t i, uint8_t * data) {
if ((data[i] == 0x80) && (data[i + 1] == 0)) // 0x8000 is used when sensor is missing
return (float)-1; // return -1 to indicate that is unknown
return ((float)(((data[i] << 8) + data[i + 1]))) / 10;
}
// function to turn a telegram long (3 bytes) to a long int
uint16_t _toLong(uint8_t i, uint8_t * data) {
return (((data[i]) << 16) + ((data[i + 1]) << 8) + (data[i + 2]));
}
// debug print a telegram to telnet console
// len is length in bytes including the CRC
void _debugPrintTelegram(const char * prefix, uint8_t * data, uint8_t len, const char * color) {
@@ -573,6 +588,16 @@ bool _process_RC20Temperature(uint8_t * data, uint8_t length) {
return true;
}
/*
* RC20OutdoorTempMessage - type 0xa3 - for external temp settings from the the RC* thermostats
*/
bool _process_RCTempMessage(uint8_t * data, uint8_t length) {
// add support here if you're reading external sensors
return true;
}
/*
* Version - type 0x02 - get the version of the Thermostat firmware
* We don't bother storing these values anywhere
@@ -759,16 +784,3 @@ void ems_setWarmWaterActivated(bool activated) {
EMS_TxTelegram.checkValue = (activated ? 0xFF : 0x00);
_buildTxTelegram(EMS_TxTelegram.checkValue);
}
// function to turn a telegram int (2 bytes) to a float
float _toFloat(uint8_t i, uint8_t * data) {
if ((data[i] == 0x80) && (data[i + 1] == 0)) // 0x8000 is used when sensor is missing
return (float)-1; // return -1 to indicate that is unknown
return ((float)(((data[i] << 8) + data[i + 1]))) / 10;
}
// function to turn a telegram long (3 bytes) to a long int
uint16_t _toLong(uint8_t i, uint8_t * data) {
return (((data[i]) << 16) + ((data[i + 1]) << 8) + (data[i + 2]));
}

View File

@@ -38,8 +38,8 @@
// Thermostat...
#define EMS_TYPE_RC20StatusMessage 0x91 // is an automatic thermostat broadcast
#define EMS_TYPE_RC20Time 0x06 // is an automatic thermostat broadcast
#define EMS_TYPE_RCTempMessage 0xA3 // is an automatic thermostat broadcast
#define EMS_TYPE_RC20Temperature 0xA8
#define EMS_TYPE_RCOutdoorTempMessage 0xA3
#define EMS_TYPE_Version 0x02 // version of the controller
// Offsets for specific values in a telegram, per type, used for validation
@@ -207,10 +207,6 @@ void _initTxBuffer();
void _buildTxTelegram(uint8_t data_value);
void _debugPrintPackage(const char * prefix, uint8_t * data, uint8_t len, const char * color);
// helper functions
float _toFloat(uint8_t i, uint8_t * data);
uint16_t _toLong(uint8_t i, uint8_t * data);
// global so can referenced in other classes
extern _EMS_Sys_Status EMS_Sys_Status;
extern _EMS_TxTelegram EMS_TxTelegram;