Skip to content

Commit

Permalink
v0.9.42 firmware todo-list MDNS=P1P2
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnold-n committed Sep 29, 2023
1 parent aee1bd5 commit e8ba40b
Show file tree
Hide file tree
Showing 35 changed files with 10,367 additions and 32 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,999 changes: 1,999 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.42-Eseries-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1,187 changes: 1,187 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.42-Hseries-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

1,122 changes: 1,122 additions & 0 deletions Firmware_images/P1P2Monitor-v0.9.42-Tseries-P1P2MQTT-bridge.ino.hex

Large diffs are not rendered by default.

46 changes: 31 additions & 15 deletions Firmware_images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,76 @@ The P1P2MQTT bridge (previously P1P2-ESP-interface) has 2 CPUs:
- ATmega328P running P1P2Monitor
- ESP8266 running P1P2-bridge-esp8266 (software will later be renamed by P1P2MQTT)

A full upgrade involves flashing both CPUs.

## P1P2Monitor firmware for ATmega328 on P1P2-ESP-Interface

These images are for the P1P2-ESP-interface (P1P2MQTT bridge) v1.0, v1.1 and v1.2. They do not work on the Arduino Uno.

P1P2Monitor auxiliary control is currently only usable for Daikin E-series, and FDY/FDYQ/FXMQ F-series. Monitoring is also available for certain F-series models (using the generic F-series firmware).

[P1P2Monitor v0.9.40 for Daikin E-series](P1P2Monitor-v0.9.40-Eseries-P1P2MQTT-bridge.ino.hex)
[P1P2Monitor v0.9.42 for Daikin E-series](P1P2Monitor-v0.9.42-Eseries-P1P2MQTT-bridge.ino.hex)

[P1P2Monitor v0.9.42 for Daikin F-series (no control)](P1P2Monitor-v0.9.42-Fseries-P1P2MQTT-bridge.ino.hex)

[P1P2Monitor v0.9.40 for Daikin F-series (no control)](P1P2Monitor-v0.9.40-Fseries-P1P2MQTT-bridge.ino.hex)
[P1P2Monitor v0.9.42 (only for Daikin FDY)](P1P2Monitor-v0.9.42-FDY-P1P2MQTT-bridge.ino.hex)

[P1P2Monitor v0.9.40 (only for Daikin FDY)](P1P2Monitor-v0.9.40-FDY-P1P2MQTT-bridge.ino.hex)
[P1P2Monitor v0.9.42 (only for Daikin FDYQ)](P1P2Monitor-v0.9.42-FDYQ-P1P2MQTT-bridge.ino.hex)

[P1P2Monitor v0.9.40 (only for Daikin FDYQ)](P1P2Monitor-v0.9.40-FDYQ-P1P2MQTT-bridge.ino.hex)
[P1P2Monitor v0.9.42 (only for Daikin FXMQ and some other daikin F-series models)](P1P2Monitor-v0.9.42-FXMQ-P1P2MQTT-bridge.ino.hex)

[P1P2Monitor v0.9.40 (only for Daikin FXMQ)](P1P2Monitor-v0.9.40-FXMQ-P1P2MQTT-bridge.ino.hex)
[P1P2Monitor v0.9.42 (experimental for Hitachi models)](P1P2Monitor-v0.9.42-Hseries-P1P2MQTT-bridge.ino.hex)

[P1P2Monitor v0.9.40 (experimental for Hitachi models)](P1P2Monitor-v0.9.40-Hseries-P1P2MQTT-bridge.ino.hex)
[P1P2Monitor v0.9.42 (experimental for Toshiba models)](P1P2Monitor-v0.9.42-Tseries-P1P2MQTT-bridge.ino.hex)

To install (Linux CLI):
To flash this image OTA (Linux CLI):

```
avrdude -c avrisp -p atmega328p -P net:<IPv4>:328 -e -Uflash:w:<hex-file>:i
```

To install (Windows CLI, using avrdude 7.0 for Windows):
If you are running P1P2-bridge-esp8266 v0.9.42 or later and are on a local network segment, you may use P1P2.local instead of &lt;IPv4>.

To flash this image OTA (Windows CLI, using avrdude 7.0 for Windows):

```
avrdude.exe -c avrisp -p m328p -P net:<IPv4>:328 -e -Uflash:w:<hex-file>:i
```

If you have trouble installing avrdude, you may prefer to wait for a later P1P2-bridge-esp8266 version which will support P1P2Monitor updates via a webserver running on the ESP.


## P1P2-bridge-esp8266 firmware for ESP8266 on P1P2-ESP-Interface

[P1P2-bridge-esp8266 0.9.40 (P1P2-ESP-Interface version) for Daikin E-series](P1P2-bridge-esp8266-0.9.40-Eseries-P1P2MQTT-bridge.ino.bin)
[P1P2-bridge-esp8266 v0.9.42 (P1P2-ESP-Interface version) for Daikin E-series](P1P2-bridge-esp8266-v0.9.42-Eseries-P1P2MQTT-bridge.ino.bin)

[P1P2-bridge-esp8266 v0.9.42 (P1P2-ESP-Interface version) for Daikin F-series](P1P2-bridge-esp8266-v0.9.42-Fseries-P1P2MQTT-bridge.ino.bin)

[P1P2-bridge-esp8266 v0.9.42 (P1P2-ESP-Interface version) for Hitachi models (experimental)](P1P2-bridge-esp8266-v0.9.42-Hseries-P1P2MQTT-bridge.ino.bin)

[P1P2-bridge-esp8266 v0.9.42 (P1P2-ESP-Interface version) for Toshiba models (experimental)](P1P2-bridge-esp8266-v0.9.42-Tseries-P1P2MQTT-bridge.ino.bin)

Note to users of the older v1.0 version of the P1P2-ESP-interface: please do not erase the flash area of the ESP8266 when flashing these images; if you do, you will need to reset the hardware identifier back to 0 using the 'B' command (or you will not be able to flash the ATmega328P).

[P1P2-bridge-esp8266 0.9.40 (P1P2-ESP-Interface version) for Daikin F-series](P1P2-bridge-esp8266-0.9.40-Fseries-P1P2MQTT-bridge.ino.bin)
To flash this image OTA (browser):

[P1P2-bridge-esp8266 0.9.40 (P1P2-ESP-Interface version) for Hitachi models (experimental)](P1P2-bridge-esp8266-0.9.40-Hseries-P1P2MQTT-bridge.ino.bin)
As of v0.9.41: browse to the webserver on the ESP: http://&lt;IPv4>/update (note: https not supported) and upload and install the new firmware image.

Note to P1P2-ESP-interface v1.0 users: please do not erase the flash area of the ESP8266 when flashing these images; if you do, you will need to reset the hardware identifier back to 0 using the 'B' command (or you will not be able to flash the ATmega328P).
As of v0.9.42: browse to the webserver on the ESP: http://P1P2.local/update (note: https not supported) and upload and install the new firmware image.

To install OTA (Linux CLI):
To flash this image OTA (Linux CLI):

```
~/.arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 -I ~/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/espota.py -i <IPv4> -p 8266 --auth=P1P2MQTT -f <bin-file>
```

To install over USB with ESP01 programmer (Linux CLI):
If you bricked the ESP, you can still flash a new image with the ESP01 USB programmer (Linux CLI):

```
~/.arduino15/packages/esp8266/tools/python3/3.7.2-post1/python3 -I ~/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py --chip esp8266 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash 0x0 <bin-file>
```

To install OTA from Windows with espota.py from [here](https://github.com/esp8266/Arduino.git):
To flash OTA from Windows with espota.py from [here](https://github.com/esp8266/Arduino.git):

```
yourpath\Arduino-master\tools\espota.py -i <IPv4> -p 8266 --auth=P1P2MQTT -f <bin-file>
Expand Down
16 changes: 12 additions & 4 deletions KnownIssues.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@

- Arduino/XL1192 or MM1192 based adapters should preferably not be connected to the P1/P2 bus if the adapter is not powered by the Arduino

### Older versions

- Commands 'E'/'n' broken in P1P2Monitor until v0.9.17, please upgrde P1P2Monitor to v0.9.17-fix1
- P1P2Serial (<v0.9.17) may incorrectly report read errors; please upgrade P1P2Monitor to v0.9.17-fix1
### Todo list

- COP calculation
- HA integration
- smart grid / dynamic power limitation
- web server
- setting field settings
- EKHBRD support
- documentation
- Hitachi support
- Toshiba support
- Panasonic support
31 changes: 19 additions & 12 deletions examples/P1P2-bridge-esp8266/P1P2-bridge-esp8266.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
#include <time.h>
#include <TZ.h>

// WEBSERVER
#ifdef WEBSERVER
#include "P1P2_ESP8266HTTPUpdateServer/P1P2_ESP8266HTTPUpdateServer.h"
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
#endif /* WEBSERVER */

//const char* MY_TZ[2] = {TZ_Europe_Amsterdam, TZ_Europe_London};
const char* MY_TZ[2] = { "CET-1CEST,M3.5.0/02,M10.5.0/03" , "GMT0BST,M3.5.0/1,M10.5.0" };
Expand Down Expand Up @@ -224,8 +225,10 @@ bool shouldSaveConfig = false;
static byte crc_gen = CRC_GEN;
static byte crc_feed = CRC_FEED;

#if defined AVRISP || defined WEBSERVER
const char* P1P2_host = "P1P2";
#endif
#ifdef AVRISP
const char* avrisp_host = "esp8266-avrisp";
const uint16_t avrisp_port = 328;
ESP8266AVRISP* avrprog;
#endif
Expand Down Expand Up @@ -1552,27 +1555,27 @@ void setup() {
});
ArduinoOTA.begin();

#if defined AVRISP || defined WEBSERVER
MDNS.begin(P1P2_host);
#endif
#ifdef AVRISP
// AVRISP
// set RESET_PIN high, to prevent ESP8266AVRISP from resetting ATmega328P
digitalWrite(RESET_PIN, HIGH);
avrprog = new ESP8266AVRISP(avrisp_port, RESET_PIN, ESPhwID ? SPI_SPEED_1 : SPI_SPEED_0);
// set RESET_PIN back to INPUT mode
pinMode(RESET_PIN, INPUT);
MDNS.begin(avrisp_host);
MDNS.addService("avrisp", "tcp", avrisp_port);


// WEBSERVER
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);


Sprint_P(true, true, true, PSTR("* [ESP] AVRISP: ATmega programming: avrdude -c avrisp -p atmega328p -P net:%i.%i.%i.%i:%i -t # or -U ..."), local_ip[0], local_ip[1], local_ip[2], local_ip[3], avrisp_port);
// listen for avrdudes
avrprog->begin();
#endif

#ifdef WEBSERVER
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80); // TODO testing
#endif /* WEBSERVER */
// Allow ATmega to enable serial input/output
digitalWrite(ATMEGA_SERIAL_ENABLE, HIGH);
pinMode(ATMEGA_SERIAL_ENABLE, OUTPUT);
Expand Down Expand Up @@ -1700,7 +1703,9 @@ void loop() {
// OTA
ArduinoOTA.handle();

#ifdef WEBSERVER
httpServer.handleClient();
#endif /* WEBSERVER */

// ESP-uptime and loop timing
uint32_t currMillis = millis();
Expand Down Expand Up @@ -1790,8 +1795,10 @@ void loop() {
}
// Serve the AVRISP client
if (last_state != AVRISP_STATE_IDLE) avrprog->serve();
MDNS.update();
#endif /* AVRISP */
#if defined AVRISP || defined WEBSERVER
MDNS.update();
#endif

// network and mqtt connection check
// if (WiFi.isConnected() || eth.connected()) {//} // TODO this does not work. eth.connected() becomes true after 4 minutes even if there is no ethernet cable attached
Expand Down
7 changes: 6 additions & 1 deletion examples/P1P2-bridge-esp8266/P1P2_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@
#define DEBUG_OVER_SERIAL // send debugging output over serial for ESP01S_RX or USB serial interface
// ETHERNET must be defined if a W5500 adapter is used for ethernet; otherwise ETHERNET is optional, but please
// note that if W5500 adapter is absent, a BSP with modified w5500 library is required to avoid a WDT reboot when constructor hangs
#if INIT_ESP_HW_ID > 0
#define ETHERNET
#endif
#endif /* INIT_ESP_HW_ID */
#endif /* P1P2_ESP_INTERFACE_115 */

#ifdef ARDUINO_COMBIBOARD
#define SERIALSPEED 250000
Expand Down Expand Up @@ -142,6 +144,7 @@
#define WELCOMESTRING_TELNET "P1P2-bridge-esp8266 v0.9.42"
#define HA_SW "0.9.42"

#define WEBSERVER // adds webserver to update firmware of ESP
#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
#define SPI_SPEED_1 0 // for BB-SPI
Expand Down Expand Up @@ -247,7 +250,9 @@ char mqttInputBinData[11]= "P1P2/X"; // default accepts input from any P1P2/X/#
#define RX_BUFFER_SIZE 2048 // to avoid serial buffer overruns (512 is too small)
#define MQTT_MIN_FREE_MEMORY 6000 // Must likely be more than 4kB, MQTT messages will not be transmitted if available memory is below this value
#define MQTT_QOS 0 // QOS = 1 is too slow
#ifndef SERIAL_MAGICSTRING
#define SERIAL_MAGICSTRING "1P2P" // Serial input of ATmega should start with SERIAL_MAGICSTRING, otherwise lines line is ignored by P1P2Monitor
#endif /* SERIAL_MAGICSTRING */
#ifndef TH_SERIES
#define CRC_GEN 0xD9 // Default generator/Feed for CRC check; these values work at least for the Daikin hybrid
#else /* TH_SERIES */
Expand Down

0 comments on commit e8ba40b

Please sign in to comment.