Skip to content

Commit

Permalink
Add esp-idf compatibility
Browse files Browse the repository at this point in the history
* Update to 2023.2.4
* Fix device class for wifi signal strength
  • Loading branch information
jayme-github committed Mar 4, 2023
1 parent 732a3c1 commit fa1c2f6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 8 additions & 4 deletions vaillant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ esphome:
- vaillantx6.h

esp32:
board: az-delivery-devkit-v4
#board: az-delivery-devkit-v4
board: esp32dev
framework:
type: arduino
#type: arduino
type: esp-idf

debug:
update_interval: 10s
Expand All @@ -20,7 +22,8 @@ syslog:

# Enable Home Assistant API
api:
password: !secret api_password
encryption:
key: !secret api_encryption_key

ota:
password: !secret ota_password
Expand All @@ -34,7 +37,7 @@ wifi:
ssid: "Vaillant Fallback Hotspot"
password: !secret ap_password

captive_portal:
#captive_portal:

switch:
- platform: restart
Expand All @@ -60,6 +63,7 @@ sensor:
unit_of_measurement: "%"
update_interval: 60s
entity_category: "diagnostic"
device_class: ""
- platform: debug
free:
name: "Heap Free"
Expand Down
7 changes: 6 additions & 1 deletion vaillantx6.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include "esphome.h"
#include <string>

#define CMD_LENGTH 7
#define ANSWER_LENGTH 8
#define RETURN_TYPE_COUNT 3

typedef unsigned char byte;

void logCmd(const char *tag, byte *cmd)
{
ESP_LOGD("Vaillantx6", "%s: 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x 0x%.2x", tag, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6]);
Expand Down Expand Up @@ -57,7 +60,7 @@ int VaillantParseBool(byte *answerBuff, uint8_t offset)

struct VaillantCommand
{
String Name;
std::string Name;
byte Address;
VaillantReturnTypes ReturnTypes[RETURN_TYPE_COUNT];
// SensorID contains the ID of the sensor to use, corresponding to the ReturnType.
Expand Down Expand Up @@ -268,6 +271,8 @@ class Vaillantx6 : public PollingComponent,
switch (vaillantCommands[i].ReturnTypes[t])
{
case None:
case SensorState:
// FIXME: This ignores the sensor state, it probably should not.
// Exit the loop on first None type, there won't be more
goto exit_type_loop;
case Temperature:
Expand Down

0 comments on commit fa1c2f6

Please sign in to comment.