CDX-24 / PoolexDreamlineController

MIT License
1 stars 1 forks source link

GPIO definition ? #1

Open sh00t2kill opened 1 year ago

sh00t2kill commented 1 year ago

Hi. Ive been using the original by njanik for a couple of weeks now, but have been having issues with wifi signal.

I wanted to switch to your version, using ESPHOME, as i have an esp32-poe that i can use, to do away with wifi entirely. Its much easier to allow ESPHOME to control the ethernet chip than all the possible permutations in an arduino sketch,

What I cant work out is how to define the GPIO used on the pool heater interface ?

sh00t2kill commented 1 year ago

It appears you have hard coded pin 12 here: https://github.com/CDX-24/PoolexDreamlineController/blob/d5835cd1b4c94e595031417f7213f268c3246ab3/components/hpci/swi.h#L10

The ESP32-POE doesnt actualy have a GPIO12. For right now is it a case of forking your repo, changing that to a different pin, and changing the esphome configuration accordingly ?

CDX-24 commented 1 year ago

Hello @sh00t2kill,

Yes, currently the pin is hard coded to pin 12 to match my use case. I haven't been able to change that yet due to lack of time in this. For the moment the only solution I see is indeed to fork my repo. I'll try to change that later to have a specific setting in ESPHome to select the pin and other parameters.

sh00t2kill commented 1 year ago

ok cool, i might have a go at making that improvement, knowing i have a plan b if it takes too long :)

sh00t2kill commented 1 year ago

Im trying to flash it, and I am getting this error that im not quite sure what it means.

Im 99% sure its to do with your component, but im not sure exactly as im new to esphome components.

21:28:41][I][logger:268]: Log initialized
[21:28:41][C][ota:473]: There have been 7 suspected unsuccessful boot attempts.
[21:28:41][D][esp32.preferences:114]: Saving 1 preferences to flash...
[21:28:41][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[21:28:41][I][app:029]: Running through setup()...
[21:28:41][D][esp-idf:000]: E (36) gpio: gpio_isr_handler_remove(480): GPIO isr service is not installed, call gpio_install_isr_service() first
[21:28:41]
[21:28:46]E (10315) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[21:28:46]E (10315) task_wdt:  - loopTask (CPU 1)
[21:28:46]E (10315) task_wdt: Tasks currently running:
[21:28:46]E (10315) task_wdt: CPU 0: IDLE
[21:28:46]E (10315) task_wdt: CPU 1: loopTask
[21:28:46]E (10315) task_wdt: Aborting.
[21:28:46]
[21:28:46]abort() was called at PC 0x400f4838 on core 0
[21:28:46]
[21:28:46]
[21:28:46]Backtrace:0x40083791:0x3ffbe7bc |<-CORRUPTED
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40083791: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
[21:28:46]
[21:28:46]
[21:28:46]
[21:28:46]
[21:28:46]ELF file SHA256: 0000000000000000
[21:28:46]
[21:28:46]Rebooting...
[21:28:46]ets Jul 29 2019 12:21:46
[21:28:46]
[21:28:46]rst:0xc (SW_CPU_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
[21:28:46]configsip: 0, SPIWP:0xee
[21:28:46]clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[21:28:46]mode:DIO, clock div:2
[21:28:46]load:0x3fff0030,len:1184
[21:28:46]load:0x40078000,len:13132
[21:28:46]load:0x40080400,len:3036
[21:28:46]entry 0x400805e4
CDX-24 commented 1 year ago

Hmmm that is strange, would you mind sharing your esphome configuration ? I haven't tested my code on ESP32.

sh00t2kill commented 1 year ago

Here it is!

esphome:
  name: pooltesting
  platform: ESP32
  board: esp32-poe

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12

mqtt:
  broker: ''
  username: ''
  password: ''
# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

external_components:
  - source:
      type: git
      url: https://github.com/sh00t2kill/PoolexDreamlineController
      ref: main
    refresh: 0s
    components: [hpci]

hpci:
  id: hpci_dev

sensor:
  - platform: template
    name: "Target Temperature"
    unit_of_measurement: "°C"
    accuracy_decimals: 0
    icon: "mdi:water-thermometer"
    device_class: "temperature"
    state_class: "measurement"
    lambda: |-
      return id(hpci_dev).getTargetTemp();
    update_interval: 30s
  - platform: template
    name: "Water Inlet Temperature"
    unit_of_measurement: "°C"
    accuracy_decimals: 0
    icon: "mdi:water-thermometer"
    device_class: "temperature"
    state_class: "measurement"
    lambda: |-
      return id(hpci_dev).getWaterInTemp();
    update_interval: 30s
  - platform: template
    name: "Water Outlet Temperature"
    unit_of_measurement: "°C"
    accuracy_decimals: 0
    icon: "mdi:water-thermometer"
    device_class: "temperature"
    state_class: "measurement"
    lambda: |-
      return id(hpci_dev).getWaterOutTemp();
    update_interval: 30s
  - platform: template
    name: "Outdoor Temperature"
    accuracy_decimals: 0
    unit_of_measurement: "°C"
    icon: "mdi:sun-thermometer"
    device_class: "temperature"
    state_class: "measurement"
    lambda: |-
      return id(hpci_dev).getOutdoorTemp();
    update_interval: 30s
  - platform: template
    name: "Error Code"
    icon: "mdi:hammer-wrench"
    accuracy_decimals: 0
    lambda: |-
      return id(hpci_dev).getErrorCode();
    update_interval: 30s

number:
  - platform: template
    name: "Target Temperature"
    icon: "mdi:water-thermometer"
    step: 1
    min_value: 20
    max_value: 35
    set_action:
      lambda: |-
        id(hpci_dev).setTargetTemp((uint16_t)x);
    lambda: |-
      return id(hpci_dev).getTargetTemp();
    update_interval: 30s

switch:
  - platform: template
    name: "Power"
    icon: "mdi:power"
    restore_mode: restore_default_off
    turn_on_action:
      lambda: |-
        id(hpci_dev).setOn(true);
    turn_off_action:
      lambda: |-
        id(hpci_dev).setOn(false);
    lambda: |-
        return id(hpci_dev).getOn();