Skip to content

Commit

Permalink
v0.9.33 cycle-steal in all 00F03x response windows (use with caregit …
Browse files Browse the repository at this point in the history
…status), Fseries 0xA3 thermistor decode
  • Loading branch information
Arnold-n committed Feb 11, 2023
1 parent 592be57 commit 02a9ce6
Show file tree
Hide file tree
Showing 11 changed files with 7,339 additions and 8 deletions.
Binary file not shown.
Binary file not shown.
1,755 changes: 1,755 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.33-Eseries-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

1,382 changes: 1,382 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.33-FDY-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

1,384 changes: 1,384 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.33-FDYQ-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

1,388 changes: 1,388 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.33-FXMQ-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

1,365 changes: 1,365 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.33-Fseries-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions examples/P1P2-bridge-esp8266/P1P2_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* WARNING: P1P2-bridge-esp8266 is end-of-life, and will be replaced by P1P2MQTT
*
* Version history
* 20230211 v0.9.33 0xA3 thermistor read-out F-series
* 20230117 v0.9.32 centralize pseudopacket handling
* 20230108 v0.9.31 sensor prefix, +2 valves in HA, fix bit history for 0x30/0x31, +pseudo controlLevel
* 20221228 v0.9.30 switch from modified ESP_telnet library to ESP_telnet v2.0.0
Expand Down Expand Up @@ -114,9 +115,9 @@
#define SAVEPACKETS
// to save memory to avoid ESP instability (until P1P2MQTT is released): do not #define SAVESCHEDULE // format of schedules will change to JSON format in P1P2MQTT

#define WELCOMESTRING "* [ESP] P1P2-bridge-esp8266 v0.9.32"
#define WELCOMESTRING_TELNET "P1P2-bridge-esp8266 v0.9.32"
#define HA_SW "0.9.32"
#define WELCOMESTRING "* [ESP] P1P2-bridge-esp8266 v0.9.33"
#define WELCOMESTRING_TELNET "P1P2-bridge-esp8266 v0.9.33"
#define HA_SW "0.9.33"

#define AVRISP // enables flashing ATmega by ESP on P1P2-ESP-Interface
#define SPI_SPEED_0 2e5 // for HSPI, default avrprog speed is 3e5, which is too high to be reliable; 2e5 works
Expand Down
51 changes: 50 additions & 1 deletion examples/P1P2-bridge-esp8266/P1P2_Daikin_ParameterConversion_F.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* WARNING: P1P2-bridge-esp8266 is end-of-life, and will be replaced by P1P2MQTT
*
* Version history
* 20230211 v0.9.33 0xA3 thermistor read-out F-series
* 20230108 v0.9.31 sensor prefix, use 4th IPv4 byte for HA MQTT discovery, fix bit history for 0x30/0x31; added pseudo controlLevel
* 20221108 v0.9.25 ADC support
* 20220918 v0.9.22 degree symbol, hwID, 32-bit outputMode
Expand Down Expand Up @@ -308,7 +309,8 @@ uint8_t value_trg(byte packetSrc, byte packetType, byte payloadIndex, byte* payl

// 16 bit fixed point reals

float FN_f8_8(uint8_t *b) { return (((int8_t) b[-1]) + (b[0] * 1.0 / 256)); }
float FN_f8_8(uint8_t *b) { return (((int8_t) b[-1]) + (b[0] * 1.0 / 256)); }
float FN_s_f8_8(uint8_t *b) { return (b[-2] ? -1 : 1) * (((int8_t) b[-1]) + (b[0] * 1.0 / 256)); }

uint8_t value_f8_8(byte packetSrc, byte packetType, byte payloadIndex, byte* payload, char* mqtt_key, char* mqtt_value, byte haConfig) {
if (!newPayloadBytesVal(packetSrc, packetType, payloadIndex, payload, mqtt_key, haConfig, 2, 1)) return 0;
Expand All @@ -320,6 +322,16 @@ uint8_t value_f8_8(byte packetSrc, byte packetType, byte payloadIndex, byte* pay
return 1;
}

uint8_t value_s_f8_8(byte packetSrc, byte packetType, byte payloadIndex, byte* payload, char* mqtt_key, char* mqtt_value, byte haConfig) {
if (!newPayloadBytesVal(packetSrc, packetType, payloadIndex, payload, mqtt_key, haConfig, 3, 1)) return 0;
#ifdef __AVR__
dtostrf(FN_s_f8_8(&payload[payloadIndex]), 1, 2, mqtt_value);
#else
snprintf(mqtt_value, MQTT_VALUE_LEN, "%1.3f", FN_s_f8_8(&payload[payloadIndex]));
#endif
return 1;
}

float FN_f8s8(uint8_t *b) { return ((float)(int8_t) b[-1]) + ((float) b[0]) / 10;}

uint8_t value_f8s8(byte packetSrc, byte packetType, byte payloadIndex, byte* payload, char* mqtt_key, char* mqtt_value, byte haConfig) {
Expand Down Expand Up @@ -364,6 +376,7 @@ uint8_t value_timeString(char* mqtt_value, char* timestring) {
// VALUE_u8_add2k: for 1-byte value (2000+payload[i]) (for year value)
// VALUE_s4abs1c: for 1-byte value -10..10 where bit 4 is sign and bit 0..3 is value
// VALUE_f8_8 for 2-byte float in f8_8 format (see protocol description)
// VALUE_s_f8_8 for 2-byte float in f8_8 format (see protocol description) with leading sign (0x40=negative)
// VALUE_f8s8 for 2-byte float in f8s8 format (see protocol description)
// VALUE_u16div10 for 2-byte integer to be divided by 10 (used for flow in 0.1m/s)
// VALUE_F(value) for self-calculated float parameter value
Expand Down Expand Up @@ -393,6 +406,7 @@ uint8_t value_timeString(char* mqtt_value, char* timestring) {
#define VALUE_u16div10_LE_changed(ch) { ch = value_u16div10_LE(packetSrc, packetType, payloadIndex, payload, mqtt_key, mqtt_value, haConfig); return ch; }

#define VALUE_f8_8 { return value_f8_8(packetSrc, packetType, payloadIndex, payload, mqtt_key, mqtt_value, haConfig); }
#define VALUE_s_f8_8 { return value_s_f8_8(packetSrc, packetType, payloadIndex, payload, mqtt_key, mqtt_value, haConfig); }
#define VALUE_f8_8_changed(ch) { ch = value_f8_8(packetSrc, packetType, payloadIndex, payload, mqtt_key, mqtt_value, haConfig); return ch; }

#define VALUE_f8s8 { return value_f8s8(packetSrc, packetType, payloadIndex, payload, mqtt_key, mqtt_value, haConfig); }
Expand Down Expand Up @@ -446,6 +460,41 @@ byte bytesbits2keyvalue(byte packetSrc, byte packetType, byte payloadIndex, byte

switch (packetType) {
// Restart packet types 00-05 (restart procedure 00-05 followed by 20, 60-9F, A1, B1, B8, 21)
// Thermistor package
// 0DAC = 13 // other 085F
// 145A = 20 // other 2A98
case 0xA3 :
switch (packetSrc) {
case 0x00 : return 0;
case 0x40 : switch (payloadIndex) {
case 0 :
case 3 :
case 6 :
case 9 :
case 12 :
case 15 :
case 1 :
case 4 :
case 7 :
case 10 :
case 13 :
case 16 : return 0;
case 2 : if (payload[payloadIndex - 2] & 0x80) return 0;
KEY("Th1"); HACONFIG; CAT_TEMP; HATEMP; VALUE_s_f8_8;
case 5 : if (payload[payloadIndex - 2] & 0x80) return 0;
KEY("Th2"); HACONFIG; CAT_TEMP; HATEMP; VALUE_s_f8_8;
case 8 : if (payload[payloadIndex - 2] & 0x80) return 0;
KEY("Th3"); HACONFIG; CAT_TEMP; HATEMP; VALUE_s_f8_8;
case 11 : if (payload[payloadIndex - 2] & 0x80) return 0;
KEY("Th4"); HACONFIG; CAT_TEMP; HATEMP; VALUE_s_f8_8;
case 14 : if (payload[payloadIndex - 2] & 0x80) return 0;
KEY("Th5"); HACONFIG; CAT_TEMP; HATEMP; VALUE_s_f8_8;
case 17 : if (payload[payloadIndex - 2] & 0x80) return 0;
KEY("Th6"); HACONFIG; CAT_TEMP; HATEMP; VALUE_s_f8_8;
default : UNKNOWN_BYTE;
}
default : UNKNOWN_BYTE;
}
// Main package communication packet types 10-16
case 0x10 :
switch (packetSrc) {
Expand Down
6 changes: 4 additions & 2 deletions examples/P1P2Monitor/P1P2Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Copyright (c) 2019-2023 Arnold Niessen, arnold.niessen-at-gmail-dot-com - licensed under CC BY-NC-ND 4.0 with exceptions (see LICENSE.md)
*
* 20230211 v0.9.33 added ENABLE_INSERT_MESSAGE_3x, user with care!
* 20230117 v0.9.32 check CONTROL_ID for write commands
* 20230108 v0.9.31 fix nr_param check
* 20221224 v0.9.30 expand F series write possibilities
Expand Down Expand Up @@ -62,7 +63,7 @@
#define SERIAL_MAGICSTRING "1P2P" // Serial input line should start with SERIAL_MAGICSTRING, otherwise input line is ignored
#endif /* F_CPU */

#define WELCOMESTRING "* P1P2Monitor-v0.9.32"
#define WELCOMESTRING "* P1P2Monitor-v0.9.33"

#define INIT_VERBOSE 3
// Set verbosity level
Expand Down Expand Up @@ -149,7 +150,8 @@
#define F03XDELAY 30 // Time delay for in ms auxiliary controller simulation, should preferably be a bit larger than any regular response from auxiliary controllers (which is typically 25 ms)
#define F0THRESHOLD 5 // Number of 00Fx30 messages to remain unanswered before we feel safe to act as auxiliary controller

#define ENABLE_INSERT_MESSAGE // enables L99 to restart Daikin system and enables W command to insert messages in 40F030 slot during L1 operation, use with care!
#define ENABLE_INSERT_MESSAGE // enables L99 to restart Daikin system and enables W command to insert messages in 40F030 (3x if ENABLE_INSERT_ME$SAGE_3x also defined) slot during L1 operation, use with care!
#define ENABLE_INSERT_MESSAGE_3x // enables L99 to restart Daikin system and enables W command to insert messages in 40F03x slot during L1 operation, use with even more care!
#define F030DELAY_INSERT 5 // Time delay for inserted message, should preferably be less than 7, but enough to transmit reliably
#define RESTART_NR_MESSAGES 1 // nr of restart messages to be sent (should be 1, perhaps 2, not more)
#define RESTART_PACKET_TYPE 0x12
Expand Down
9 changes: 7 additions & 2 deletions examples/P1P2Monitor/P1P2Monitor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ void loop() {
break;
case 'w':
case 'W': if (CONTROL_ID) {
// in L1 mode, insert message in time allocaed for 40F030 slot
// in L1/L5 mode, insert message in time allocaed for 40F030 slot
if (insertMessageCnt || restartDaikinCnt) {
Serial.println(F("* insertMessage (or restartDaikin) already scheduled"));
break;
Expand Down Expand Up @@ -760,6 +760,7 @@ void loop() {
// 2 controller mode off, do not store setting in EEPROM
// 3 controller mode on, do not store setting in EEPROM
// 5 (for experimenting with F-series only) controller responds only to 00F030 message with an empty packet, but not to other 00F03x packets
// 99 restart Daikin
// other values are treated as 0 and are reserved for further experimentation of control modes
if (scanint(RSp, temp) == 1) {
#ifdef ENABLE_INSERT_MESSAGE
Expand Down Expand Up @@ -1413,7 +1414,11 @@ void loop() {
// act as auxiliary controller:
if ((CONTROL_ID && (FxAbsentCnt[CONTROL_ID & 0x01] == F0THRESHOLD) && (RB[1] == CONTROL_ID))
#ifdef ENABLE_INSERT_MESSAGE
|| ((insertMessageCnt || restartDaikinCnt) && (RB[0] == 0x00) && (RB[1] == 0xF0) && (RB[2] == 0x30))
|| ((insertMessageCnt || restartDaikinCnt) && (RB[0] == 0x00) && (RB[1] == 0xF0)
#ifndef ENABLE_INSERT_MESSAGE_3x
&& (RB[2] == 0x30)
#endif
)
#endif
) {
WB[0] = 0x40;
Expand Down

0 comments on commit 02a9ce6

Please sign in to comment.