esphome-pipsolar icon indicating copy to clipboard operation
esphome-pipsolar copied to clipboard

PIP 8048 support (Aka Axpert max)

Open SeByDocKy opened this issue 2 years ago • 54 comments

Hello,

Amazing job you did .... Is-il possible to extend your work to support as well the PIP8048 (axpert max I & II). Protocol changed just a bit...... In general in your amazing work, will be fantastic to have an option to choose a particular PIP model even if I understood it's a huge work to be compatible with all PIP models

Here is the link for the PIP8048 protocol : https://www.transfernow.net/dl/202112112SpO2rcW I did a custom sensor for it... but you work is even better.... Kind regards,

SeByDocKy avatar Dec 11 '21 14:12 SeByDocKy

Hello,

I looked into your official pipsolar integration in ESPhome. I think in order to make compatible with the PIP8048, it requires "just" to add the QPIGS2 command il the list of sent commands defined in pipsolar.h & pipsolar.cpp.

The QPIGS2 command is quiet small to decode :

Device: (BB.B CCC.C DDDDD <CRC><cr>
Data Description Notes
a ( Start byte
b BB.B PV2 Input current E is an Integer ranging from 0 to 9. The units
is A.
MAX Communication Protocol
7
c CCC.C PV2 Input voltage U is an Integer ranging from 0 to 9. The units
is V.
d DDDDD PV2 Charging power M is an Integer ranging from 0 to 9. The unit 

Another small should be nice in your orgilnal QPIGS. Just change the name of the two variables/entities value_pv_input_current_for_battery_ into value_pv1_input_current_ and value_pv_input_voltage_ into value_pv1_input_voltage_

as value_pv2_input_current_ and value_pv2_input_voltage_ would be added by the QPIGS2 command....

Hope you will read this msg.

SeByDocKy avatar Jan 11 '22 16:01 SeByDocKy

Could you provide some response examples of your device?

syssi avatar Jan 11 '22 17:01 syssi

I'm a bit confused. The issue title mentions a PIP8084. You mentioned a PIP9048. Could you provide an explanation?

syssi avatar Jan 11 '22 17:01 syssi

Sure I can :) ... I would be glad to help you. In fact in paralllel I am modifying your actual pipsolar ESPhome integration to add the QPIGS2 command.

SeByDocKy avatar Jan 11 '22 17:01 SeByDocKy

I'm a bit confused. The issue title mentions a PIP8084. You mentioned a PIP9048. Could you provide an explanation?

Sorry was a typo ... it's the 8048 (aka, axpert max I & II)

SeByDocKy avatar Jan 11 '22 17:01 SeByDocKy

I also maybe saw a tiny mistake in your code tor the QPIGS -> value_pv1_input_current_ ... it's scanned with a %d and should be a %f according to the manual (13th items in the scanf instructions)

SeByDocKy avatar Jan 11 '22 17:01 SeByDocKy

The scanf is a bit different per model/firmware/response. It's important to have some response example for improvements here.

syssi avatar Jan 11 '22 17:01 syssi

Ok I modified all your code to add the QPIGS2 command and everything related.... It's compiling fine :) Need to wait sun to test results on my PIP8048. I am really impressed by your general programming level skills.... A masterpiece.

SeByDocKy avatar Jan 11 '22 18:01 SeByDocKy

I'm not the author. Just a contributor. Like you? ;-)

syssi avatar Jan 11 '22 19:01 syssi

I'm not the author. Just a contributor. Like you? ;-)

Common :) .... you did the JKBMS & the PIPsolar :).... there are masterpieces...

SeByDocKy avatar Jan 11 '22 19:01 SeByDocKy

Hi before to test my modification, I am trying to collect at least some informations from the official pipisolar integration

Very strange..... I collected this log :

WARNING 'test_clapet': Using the '_' (underscore) character in the hostname is discouraged as it can cause problems with some DHCP and local name services. For more information, see https://esphome.io/guides/faq.html#why-shouldn-t-i-use-underscores-in-my-device-name
INFO Detected timezone 'Europe/Paris'
INFO Starting log output from test_clapet.local using esphome API
INFO Successfully connected to test_clapet.local
[14:48:17][I][app:102]: ESPHome version 2022.2.0-dev compiled on Jan 13 2022, 14:45:39
[14:48:17][C][wifi:488]: WiFi:
[14:48:17][C][wifi:350]:   Local MAC: 3C:71:BF:A1:F0:80
[14:48:17][C][wifi:351]:   SSID: [redacted]
[14:48:17][C][wifi:352]:   IP Address: 192.168.1.87
[14:48:17][C][wifi:354]:   BSSID: [redacted]
[14:48:17][C][wifi:355]:   Hostname: 'test_clapet'
[14:48:17][C][wifi:357]:   Signal strength: -60 dB ▂▄▆█
[14:48:17][C][wifi:361]:   Channel: 12
[14:48:17][C][wifi:362]:   Subnet: 255.255.255.0
[14:48:17][C][wifi:363]:   Gateway: 192.168.1.1
[14:48:17][C][wifi:364]:   DNS1: 192.168.1.1
[14:48:17][C][wifi:365]:   DNS2: 192.168.1.1
[14:48:17][C][logger:233]: Logger:
[14:48:17][C][logger:234]:   Level: DEBUG
[14:48:17][C][logger:235]:   Log Baud Rate: 115200
[14:48:17][C][logger:236]:   Hardware UART: UART0
[14:48:17][C][uart.arduino_esp32:105]: UART Bus:
[14:48:17][C][uart.arduino_esp32:106]:   TX Pin: GPIO16
[14:48:17][C][uart.arduino_esp32:107]:   RX Pin: GPIO17
[14:48:17][C][uart.arduino_esp32:109]:   RX Buffer Size: 256
[14:48:17][C][uart.arduino_esp32:111]:   Baud Rate: 2400 baud
[14:48:17][C][uart.arduino_esp32:112]:   Data Bits: 8
[14:48:17][C][uart.arduino_esp32:113]:   Parity: NONE
[14:48:17][C][uart.arduino_esp32:114]:   Stop bits: 1
[14:48:17][C][homeassistant.time:010]: Home Assistant Time:
[14:48:17][C][homeassistant.time:011]:   Timezone: 'CET-1CEST,M3.5.0,M10.5.0/3'
[14:48:17][C][pipsolar:860]: Pipsolar:
[14:48:17][C][pipsolar:861]: used commands:
[14:48:17][C][pipsolar:864]: QPIRI
[14:48:17][C][pipsolar:864]: QPIGS
[14:48:17][C][pipsolar:864]: QMOD
[14:48:17][C][pipsolar.text_sensor:010]: Pipsolar TextSensor 'pvbrain_axpertdevice_mode'
[14:48:17][C][pipsolar.text_sensor:010]: Pipsolar TextSensor 'pvbrain_axpert_last_qpigs'
[14:48:17][C][pipsolar.text_sensor:010]: Pipsolar TextSensor 'pvbrain_axpert_last_qpiri'
[14:48:17][C][captive_portal:144]: Captive Portal:
[14:48:17][C][ota:082]: Over-The-Air Updates:
[14:48:17][C][ota:083]:   Address: test_clapet.local:3232
[14:48:17][C][api:134]: API Server:
[14:48:17][C][api:135]:   Address: test_clapet.local:6053
[14:48:17][C][api:139]:   Using noise encryption: NO
[14:48:18][C][mdns:084]: mDNS:
[14:48:18][C][mdns:085]:   Hostname: test_clapet
[14:48:18][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[14:48:18][D][pipsolar:772]: checking crc on incoming message
[14:48:18][D][pipsolar:775]: CRC OK
[14:48:18][D][pipsolar:448]: Decode QPIGS
[14:48:18][D][text_sensor:067]: 'pvbrain_axpert_last_qpigs': Sending state 'QPIGS'
[14:48:18][D][sensor:125]: 'pvbrain_axpert_ac_output_apparent_power': Sending state 0.00000 VA with 1 decimals of accuracy
[14:48:18][D][sensor:125]: 'pvbrain_axpert_ac_output_active_power': Sending state 0.00000 W with 1 decimals of accuracy
[14:48:18][D][sensor:125]: 'pvbrain_axpert_pv1_input_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:19][D][pipsolar:838]: Sending polling command : QMOD with length 4
[14:48:19][D][pipsolar:772]: checking crc on incoming message
[14:48:19][D][pipsolar:775]: CRC OK
[14:48:19][D][pipsolar:471]: Decode QMOD
[14:48:19][D][text_sensor:067]: 'pvbrain_axpertdevice_mode': Sending state 'M'
[14:48:20][D][pipsolar:838]: Sending polling command : QPIRI with length 5
[14:48:20][D][pipsolar:772]: checking crc on incoming message
[14:48:20][D][pipsolar:775]: CRC OK
[14:48:20][D][pipsolar:429]: Decode QPIRI
[14:48:20][D][text_sensor:067]: 'pvbrain_axpert_last_qpiri': Sending state 'QPIRI'
[14:48:20][D][sensor:125]: 'pvbrain_axpert_grid_rating_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:20][D][sensor:125]: 'pvbrain_axpert_grid_rating_current': Sending state 0.00000 A with 1 decimals of accuracy
[14:48:21][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[14:48:21][D][pipsolar:772]: checking crc on incoming message
[14:48:21][D][pipsolar:775]: CRC OK
[14:48:21][D][pipsolar:448]: Decode QPIGS
[14:48:21][D][text_sensor:067]: 'pvbrain_axpert_last_qpigs': Sending state 'QPIGS'
[14:48:21][D][sensor:125]: 'pvbrain_axpert_ac_output_apparent_power': Sending state 0.00000 VA with 1 decimals of accuracy
[14:48:21][D][sensor:125]: 'pvbrain_axpert_ac_output_active_power': Sending state 0.00000 W with 1 decimals of accuracy
[14:48:21][D][sensor:125]: 'pvbrain_axpert_pv1_input_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:22][D][pipsolar:838]: Sending polling command : QMOD with length 4
[14:48:22][D][pipsolar:772]: checking crc on incoming message
[14:48:22][D][pipsolar:775]: CRC OK
[14:48:22][D][pipsolar:471]: Decode QMOD
[14:48:22][D][text_sensor:067]: 'pvbrain_axpertdevice_mode': Sending state 'M'
[14:48:23][D][pipsolar:838]: Sending polling command : QPIRI with length 5
[14:48:23][D][pipsolar:772]: checking crc on incoming message
[14:48:23][D][pipsolar:775]: CRC OK
[14:48:23][D][pipsolar:429]: Decode QPIRI
[14:48:23][D][text_sensor:067]: 'pvbrain_axpert_last_qpiri': Sending state 'QPIRI'
[14:48:23][D][sensor:125]: 'pvbrain_axpert_grid_rating_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:23][D][sensor:125]: 'pvbrain_axpert_grid_rating_current': Sending state 0.00000 A with 1 decimals of accuracy
[14:48:24][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[14:48:24][D][pipsolar:772]: checking crc on incoming message
[14:48:24][D][pipsolar:775]: CRC OK
[14:48:24][D][pipsolar:448]: Decode QPIGS
[14:48:24][D][text_sensor:067]: 'pvbrain_axpert_last_qpigs': Sending state 'QPIGS'
[14:48:24][D][sensor:125]: 'pvbrain_axpert_ac_output_apparent_power': Sending state 0.00000 VA with 1 decimals of accuracy
[14:48:24][D][sensor:125]: 'pvbrain_axpert_ac_output_active_power': Sending state 0.00000 W with 1 decimals of accuracy
[14:48:24][D][sensor:125]: 'pvbrain_axpert_pv1_input_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:25][D][pipsolar:838]: Sending polling command : QMOD with length 4
[14:48:25][D][pipsolar:772]: checking crc on incoming message
[14:48:25][D][pipsolar:775]: CRC OK
[14:48:25][D][pipsolar:471]: Decode QMOD
[14:48:25][D][text_sensor:067]: 'pvbrain_axpertdevice_mode': Sending state 'M'
[14:48:26][D][pipsolar:838]: Sending polling command : QPIRI with length 5
[14:48:26][D][pipsolar:772]: checking crc on incoming message
[14:48:26][D][pipsolar:775]: CRC OK
[14:48:26][D][pipsolar:429]: Decode QPIRI
[14:48:26][D][text_sensor:067]: 'pvbrain_axpert_last_qpiri': Sending state 'QPIRI'
[14:48:26][D][sensor:125]: 'pvbrain_axpert_grid_rating_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:26][D][sensor:125]: 'pvbrain_axpert_grid_rating_current': Sending state 0.00000 A with 1 decimals of accuracy
[14:48:27][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[14:48:27][D][pipsolar:772]: checking crc on incoming message
[14:48:27][D][pipsolar:775]: CRC OK
[14:48:27][D][pipsolar:448]: Decode QPIGS
[14:48:27][D][text_sensor:067]: 'pvbrain_axpert_last_qpigs': Sending state 'QPIGS'
[14:48:27][D][sensor:125]: 'pvbrain_axpert_ac_output_apparent_power': Sending state 0.00000 VA with 1 decimals of accuracy
[14:48:27][D][sensor:125]: 'pvbrain_axpert_ac_output_active_power': Sending state 0.00000 W with 1 decimals of accuracy
[14:48:27][D][sensor:125]: 'pvbrain_axpert_pv1_input_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:28][D][pipsolar:838]: Sending polling command : QMOD with length 4
[14:48:28][D][pipsolar:772]: checking crc on incoming message
[14:48:28][D][pipsolar:775]: CRC OK
[14:48:28][D][pipsolar:471]: Decode QMOD
[14:48:28][D][text_sensor:067]: 'pvbrain_axpertdevice_mode': Sending state 'M'
[14:48:29][D][pipsolar:838]: Sending polling command : QPIRI with length 5
[14:48:29][D][pipsolar:772]: checking crc on incoming message
[14:48:29][D][pipsolar:775]: CRC OK
[14:48:29][D][pipsolar:429]: Decode QPIRI
[14:48:29][D][text_sensor:067]: 'pvbrain_axpert_last_qpiri': Sending state 'QPIRI'
[14:48:29][D][sensor:125]: 'pvbrain_axpert_grid_rating_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:29][D][sensor:125]: 'pvbrain_axpert_grid_rating_current': Sending state 0.00000 A with 1 decimals of accuracy
[14:48:30][D][pipsolar:838]: Sending polling command : QPIGS with length 5
[14:48:30][D][pipsolar:772]: checking crc on incoming message
[14:48:30][D][pipsolar:775]: CRC OK
[14:48:30][D][pipsolar:448]: Decode QPIGS
[14:48:30][D][text_sensor:067]: 'pvbrain_axpert_last_qpigs': Sending state 'QPIGS'
[14:48:30][D][sensor:125]: 'pvbrain_axpert_ac_output_apparent_power': Sending state 0.00000 VA with 1 decimals of accuracy
[14:48:30][D][sensor:125]: 'pvbrain_axpert_ac_output_active_power': Sending state 0.00000 W with 1 decimals of accuracy
[14:48:30][D][sensor:125]: 'pvbrain_axpert_pv1_input_voltage': Sending state 0.00000 V with 1 decimals of accuracy
[14:48:31][D][pipsolar:838]: Sending polling command : QMOD with length 4
[14:48:31][D][pipsolar:772]: checking crc on incoming message
[14:48:31][D][pipsolar:775]: CRC OK
[14:48:31][D][pipsolar:471]: Decode QMOD
[14:48:31][D][text_sensor:067]: 'pvbrain_axpertdevice_mode': Sending state 'M'
[14:48:32][D][pipsolar:838]: Sending polling command : QPIRI with length 5
[14:48:32][D][pipsolar:772]: checking crc on incoming message
[14:48:32][D][pipsolar:775]: CRC OK
[14:48:32][D][pipsolar:429]: Decode QPIRI
[14:48:32][D][text_sensor:067]: 'pvbrain_axpert_last_qpiri': Sending state 'QPIRI'

with the following basic yaml file

  name: test_clapet
  platform: ESP32
  board: esp32dev
 

# Enable logging
logger:
  #baud_rate: 0
#  baud_rate: 0
#  level: VERY_VERBOSE
  # logs:
    # uart: VERY_VERBOSE 
    # api.service: WARN
    # ota: WARN
    # sensor: DEBUG

# Enable Home Assistant API
api:

ota:
 
wifi:
  ssid: !secret esphome_ssid
  password: !secret esphome_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Geothermie Fallback Hotspot"
    password: "sebydocky"

captive_portal:

time:
  - platform: homeassistant
    id: homeassistant_time  
  
uart:
  
  # ######### UART for Axpert max PIP8048 ######
  
   - id: uart0
     tx_pin: GPIO16
     rx_pin: GPIO17
     baud_rate: 2400  
    
pipsolar:
   - uart_id: uart0
     id: pip8048 
#     update_interval: 3s
    
    
sensor: 

   - platform: pipsolar
     pipsolar_id: pip8048
     grid_rating_voltage:
       id: pvbrain_axpert_grid_rating_voltage
       name: pvbrain_axpert_grid_rating_voltage
     grid_rating_current:
       id: pvbrain_axpert_grid_rating_current
       name: pvbrain_axpert_grid_rating_current
     ac_output_apparent_power:
       id: pvbrain_axpert_ac_output_apparent_power
       name: pvbrain_axpert_ac_output_apparent_power
     ac_output_active_power:
       id: pvbrain_axpert_ac_output_active_power
       name: pvbrain_axpert_ac_output_active_power  
     pv_input_voltage:
       id: pvbrain_axpert_pv1_input_voltage
       name: pvbrain_axpert_pv1_input_voltage
#     pv2_input_voltage:
#       id: pvbrain_axpert_pv2_input_voltage
#       name: pvbrain_axpert_pv2_input_voltage  
  
text_sensor:
   - platform: pipsolar
     pipsolar_id: pip8048
     device_mode:
       id: pvbrain_axpert_device_mode
       name: pvbrain_axpertdevice_mode
     last_qpigs:
       id: pvbrain_axpert_last_qpigs
       name: pvbrain_axpert_last_qpigs
     last_qpiri:
       id: pvbrain_axpert_last_qpiri
       name: pvbrain_axpert_last_qpiri

Seems I am receiving anything .... I tried to chage GPIO, etc .... Here is a small videoshot or the led's activity....: https://www.youtube.com/watch?v=6rha8HuPOes I am not sure first of all if my physical connexion is OK. I correctly wired RJ45(1,2,9) into the DB9(3,2,8). I check continuitues no problem. Of course I tried by permuting TXpin & RXpin in the yaml....

If I unplugged the RJ45 from the inverter .... I continue to receive a CRC OK .... so there is a big problem somewhere.... I will attempt with a direct connexion to watchpower to eventually discard a problem with the RS232 part of my inverter.

SeByDocKy avatar Jan 13 '22 14:01 SeByDocKy

Hi @syssi,

I solved my problem of bad wiring and also tested my fork to integrate the GPIGS2 command. It works perfectly.... Your code is just incredible :)

SeByDocKy avatar Jan 16 '22 16:01 SeByDocKy

Hi @syssi

Got a new question concerning the PIPsolar integration. With my PIP8048, I need to define the BATTERY_BULK_VOLTAGE output command. In a first attempt, I added the new command in the output/__init__py file pointing the PCCV command as decribed in the manual. It compiles fine... and I can see in the log that the command is correctly sent .... but no changes in the associaced QPRI command after a while. For the battery_float_voltage it's working...

Here is my output/__init__py

import esphome.config_validation as cv
from esphome import automation
from esphome.components import output
from esphome.const import CONF_ID, CONF_VALUE
from .. import PIPSOLAR_COMPONENT_SCHEMA, CONF_PIPSOLAR_ID, pipsolar_ns

DEPENDENCIES = ["pipsolar"]

PipsolarOutput = pipsolar_ns.class_("PipsolarOutput", output.FloatOutput)
SetOutputAction = pipsolar_ns.class_("SetOutputAction", automation.Action)

CONF_POSSIBLE_VALUES = "possible_values"

# 3.11 PCVV<nn.n><cr>: Setting battery C.V. (constant voltage) charging voltage 48.0V ~ 58.4V for 48V unit
# battery_bulk_voltage;
# battery_recharge_voltage;     12V unit: 11V/11.3V/11.5V/11.8V/12V/12.3V/12.5V/12.8V
#                               24V unit: 22V/22.5V/23V/23.5V/24V/24.5V/25V/25.5V
#                               48V unit: 44V/45V/46V/47V/48V/49V/50V/51V
# battery_under_voltage;        40.0V ~ 48.0V for 48V unit
# battery_float_voltage;        48.0V ~ 58.4V for 48V unit
# battery_type;  00 for AGM, 01 for Flooded battery
# current_max_ac_charging_current;
# output_source_priority; 00 / 01 / 02
# charger_source_priority;  For HS: 00 for utility first, 01 for solar first, 02 for solar and utility, 03 for only solar charging
#                           For MS/MSX: 00 for utility first, 01 for solar first, 03 for only solar charging
# battery_redischarge_voltage;  12V unit: 00.0V12V/12.3V/12.5V/12.8V/13V/13.3V/13.5V/13.8V/14V/14.3V/14.5
#                               24V unit: 00.0V/24V/24.5V/25V/25.5V/26V/26.5V/27V/27.5V/28V/28.5V/29V
#                               48V unit: 00.0V48V/49V/50V/51V/52V/53V/54V/55V/56V/57V/58V

CONF_BATTERY_BULK_VOLTAGE = "battery_bulk_voltage"
CONF_BATTERY_RECHARGE_VOLTAGE = "battery_recharge_voltage"
CONF_BATTERY_UNDER_VOLTAGE = "battery_under_voltage"
CONF_BATTERY_FLOAT_VOLTAGE = "battery_float_voltage"
CONF_BATTERY_TYPE = "battery_type"
CONF_CURRENT_MAX_AC_CHARGING_CURRENT = "current_max_ac_charging_current"
CONF_CURRENT_MAX_CHARGING_CURRENT = "current_max_charging_current"
CONF_OUTPUT_SOURCE_PRIORITY = "output_source_priority"
CONF_CHARGER_SOURCE_PRIORITY = "charger_source_priority"
CONF_BATTERY_REDISCHARGE_VOLTAGE = "battery_redischarge_voltage"

TYPES = {
    CONF_BATTERY_BULK_VOLTAGE: (
	    [44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0],
        "PCCV%02.1f",
	),
    CONF_BATTERY_RECHARGE_VOLTAGE: (
        [44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0],
        "PBCV%02.1f",
    ),
    CONF_BATTERY_UNDER_VOLTAGE: (
        [40.0, 40.1, 42, 43, 44, 45, 46, 47, 48.0],
        "PSDV%02.1f",
    ),
    CONF_BATTERY_FLOAT_VOLTAGE: ([48.0, 49.0, 50.0, 51.0], "PBFT%02.1f"),
    CONF_BATTERY_TYPE: ([0, 1, 2], "PBT%02.0f"),
    CONF_CURRENT_MAX_AC_CHARGING_CURRENT: ([2, 10, 20], "MUCHGC0%02.0f"),
    CONF_CURRENT_MAX_CHARGING_CURRENT: ([10, 20, 30, 40], "MCHGC0%02.0f"),
    CONF_OUTPUT_SOURCE_PRIORITY: ([0, 1, 2], "POP%02.0f"),
    CONF_CHARGER_SOURCE_PRIORITY: ([0, 1, 2, 3], "PCP%02.0f"),
    CONF_BATTERY_REDISCHARGE_VOLTAGE: (
        [0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58],
        "PBDV%02.1f",
    ),
}

CONFIG_SCHEMA = PIPSOLAR_COMPONENT_SCHEMA.extend(
    {
        cv.Optional(type): output.FLOAT_OUTPUT_SCHEMA.extend(
            {
                cv.Required(CONF_ID): cv.declare_id(PipsolarOutput),
                cv.Optional(CONF_POSSIBLE_VALUES, default=values): cv.All(
                    cv.ensure_list(cv.positive_float), cv.Length(min=1)
                ),
            }
        )
        for type, (values, _) in TYPES.items()
    }
)


async def to_code(config):
    paren = await cg.get_variable(config[CONF_PIPSOLAR_ID])

    for type, (_, command) in TYPES.items():
        if type in config:
            conf = config[type]
            var = cg.new_Pvariable(conf[CONF_ID])
            await output.register_output(var, conf)
            cg.add(var.set_parent(paren))
            cg.add(var.set_set_command(command))
            if (CONF_POSSIBLE_VALUES) in conf:
                cg.add(var.set_possible_values(conf[CONF_POSSIBLE_VALUES]))


@automation.register_action(
    "output.pipsolar.set_level",
    SetOutputAction,
    cv.Schema(
        {
            cv.Required(CONF_ID): cv.use_id(CONF_ID),
            cv.Required(CONF_VALUE): cv.templatable(cv.positive_float),
        }
    ),
)
def output_pipsolar_set_level_to_code(config, action_id, template_arg, args):
    paren = yield cg.get_variable(config[CONF_ID])
    var = cg.new_Pvariable(action_id, template_arg, paren)
    template_ = yield cg.templatable(config[CONF_VALUE], args, float)
    cg.add(var.set_level(template_))
    yield var

SeByDocKy avatar Feb 22 '22 12:02 SeByDocKy

Could you provide the manual another time? The wetransfer link isn't available anymore. Are you sure the command is called PCCV? Do you mean PCVV (Constant Voltage Charging Voltage)?

syssi avatar Feb 22 '22 14:02 syssi

Could you provide the manual another time? The wetransfer link isn't available anymore. Are you sure the command is called PCCV? Do you mean PCVV (Constant Voltage Charging Voltage)?

Here is : https://drive.google.com/file/d/112Adm0MECE3c6t64uYWZcAL4N0FucdSJ/view?usp=sharing

p21 ....

SeByDocKy avatar Feb 22 '22 15:02 SeByDocKy

Mea culpa it's PCVV and not PCCV :) Now it's working fine :)

SeByDocKy avatar Feb 22 '22 15:02 SeByDocKy

I've pushed your customized version to the feature branch pip8048:

external_components:
  - source: github://syssi/esphome-pipsolar@pip8048
    refresh: 0s

syssi avatar Mar 12 '22 09:03 syssi

Hi @syssi, just reading more deeply the axpert max protocol manual, and I discovered a very interesting output command "PBATCD" which allow to enable/disable charging/discharging for the inverter. I think it can be extremely usefull for example with my PVbrain coupling a BMS and inverter. For example when the float voltage is reached, thanks to this command we can disable charging to let the BMS do his balancing job. In fact to be more general we can do "smarter" the couple inverter,BMS like can allow CAN exchanges with a seplos BMS for example

SeByDocKy avatar Apr 13 '22 07:04 SeByDocKy

To be more précise

Computer: PBATCD<abc><CRC><cr>
Device: (ACK<CRC><cr> if device accepts this command, otherwise, responds (NAK<CRC><cr>
a = Discharge completely on/off
b = Discharge on/off, but standby allowed (so small discharge allowed)
c = Charge completely on/off
Detail:
abc:
Charger Discharger
1 1 1 Enabled charger Enabled discharger
0 1 1
Enabled charger, depends on Prog16 setting if
AC source valid, charge 2A from AC, even if
prog. 16 is “only solar”. If prog. 16 is any other
setting, ignore and let charging from AC source
continue normally.
Disabled discharger and shut down unit
completely when insufficient PV or Grid is
present.
1 0 1
Enabled charger, depends on Prog16 setting if
AC source valid, charge 2A from AC, even if
prog. 16 is “only solar”. If prog. 16 is any other
setting, ignore and let charging from AC source
continue normally.
Disabled discharger but keep unit stay at standby
mode.
1 1 0 Disabled charger Enabled discharger
0 1 0 Disabled charger
Disabled discharger and shut down unit
completely when no PV or Grid is present.
1 0 0 Disabled charger
Disabled discharger but keep unit stay at standby
mode.
0 0 1 N/A N/A
0 0 0
Cleaned the enable/disable charger flags and
return to previous charger status.
Cleaned the enable/disable discharger flags and
return to previous discharger status.

I would like to choose between PBATCD 111 and PBATCD 110

SeByDocKy avatar Apr 13 '22 07:04 SeByDocKy

I think the custom select written by @andreashergert1984 could be modified to add the PBATCD with something like

  - platform: pipsolar
    pipsolar_id: pip8048
    charging_discharging_controls:
      id: charging_discharging_controls_select 
      name: charging_discharging_controls_select
      optionsmap:
        "Charging enable/discharging enable": "PBATCD111"
        "Charging disable/discharging enable": "PBATCD110"
        "Charging enable/discharging disable": "PBATCD011"
        "Charging disable/discharging disable": "PBATCD010"
      statusmap:
        "0": "Charging enable/discharging enable"
        "1": "Charging disable/discharging enable"
        "2": "Charging enable/discharging disable"
        "3": "Charging disable/discharging disable"

SeByDocKy avatar May 03 '22 06:05 SeByDocKy

Hallo, I have problem with compilation PIP8048 branch. This is error:

INFO Reading configuration /config/esphome/fv-menic.yaml...
INFO Updating https://github.com/syssi/esphome-pipsolar.git@pip8048
INFO Detected timezone 'Europe/Prague'
INFO Generating C++ source...
INFO Compiling app...
Processing fv-menic (board: d1_mini; framework: arduino; platform: platformio/espressif8266 @ 2.6.3)
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 2.0.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266WiFi> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <noise-c> 0.1.4
|   |-- <libsodium> 1.10018.1
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/api_connection.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/api_frame_helper.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/api_pb2.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/api_pb2_service.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/api_server.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/list_entities.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/proto.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/subscribe_state.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/user_services.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/api/util.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/binary_sensor/automation.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/binary_sensor/binary_sensor.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/binary_sensor/filter.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/esp8266/core.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/esp8266/gpio.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/esp8266/preferences.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/homeassistant/time/homeassistant_time.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/json/json_util.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/logger/logger.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/md5/md5.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/mdns/mdns_component.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/mdns/mdns_esp32_arduino.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/mdns/mdns_esp8266.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/mdns/mdns_esp_idf.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/network/util.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/ota/ota_backend_arduino_esp32.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/ota/ota_backend_arduino_esp8266.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/ota/ota_backend_esp_idf.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/ota/ota_component.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/output/automation.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/output/float_output.cpp.o
Compiling /data/fv-menic/.pioenvs/fv-menic/src/esphome/components/pipsolar/pipsolar.cpp.o
In file included from src/esphome/components/pipsolar/pipsolar.cpp:1:0:
src/esphome/components/pipsolar/pipsolar.h:7:64: fatal error: esphome/components/pipsolar/select/pipsolar_select.h: No such file or directory
 #include "esphome/components/pipsolar/select/pipsolar_select.h"
                                                                ^
compilation terminated.
*** [/data/fv-menic/.pioenvs/fv-menic/src/esphome/components/pipsolar/pipsolar.cpp.o] Error 1
========================= [FAILED] Took 28.45 seconds =========================

PetrDubi avatar Jun 22 '22 17:06 PetrDubi

Please try a clean build:

esphome clean fv-menic.yaml
esphome run fv-menic.yaml

And please make sure you are using the latest ESPHome version. It looks like your ESPHome install is a bit outdated and probably doesn't support select entities yet.

syssi avatar Jun 22 '22 17:06 syssi

Thank you for your repply. I was use esphome version 2021.10.x which is last in Home Assistant. Today I install last stable version from github (2022.6.2), use Clean build files and Install. Now it has compile without problems. Thank you

PetrDubi avatar Jun 23 '22 16:06 PetrDubi

Good evening, I have one more problem. Sensor battery_discharge_current have value 0.0A for all time and not respond with reality. Can you help me? Inverter is Easun SMW 8k (aka Axpert MAX 8). In manual is:

QPIGS: Device general status parameters inquiry Computer: QPIGS <CRC> Device: (BBB.B CC.C DDD.D EE.E FFFF GGGG HHH III JJ.JJ KK K OOO TTTT EE. E UUU.U WW.WW PPPPP b7b6b5b4b3b2b1b0 QQ VV MMMMM b10b9b8 Y ZZ AAAA <CRC><

PPPPP Battery discharge current P is an Integer ranging from 0 to 9. The units is A.

Thank you Petr

PetrDubi avatar Jun 24 '22 18:06 PetrDubi

Good afternoon, I have one question. Do you plan in future add querry for PV generated energy and output load energy? Best regards

PetrDubi avatar Jun 28 '22 11:06 PetrDubi

Could you provide example requests and responses of the values you are looking for?

syssi avatar Jun 28 '22 12:06 syssi

Query total PV generated energy
Computer: QET<CRC><cr>
Device: (NNNNNNNN<CRC><cr>
Generated energy, N: 0~9, unit: Wh Generated energy,

Query PV generated energy of year
Computer: QEYyyyy<cr>
Device: (NNNNNNNN<CRC><cr>
yyyy: Year, y: 0~9
NNNNNNNN: Generated energy. N: 0~9, unit: Wh

Query PV generated energy of month
Computer: QEMyyyymm <CRC><cr>
Device: (NNNNNNNN<CRC><cr>
yyyy: Year, y: 0~9
mm: Month, m: 0~9 
NNNNNNNN: Generated energy, N: 0~9, unit: Wh

Query PV generated energy of day
Computer: QEDyyyymmdd<CRC><cr>
Device: (NNNNNNNN<CRC><cr>
yyyy: Year, y: 0~9
mm: Month, m: 0~9
dd: Day,  d: 0~9
NNNNNNNN: Generated energy, N: 0~9, unit: Wh

Query total output load energy
Computer: QLT<CRC><cr>
Device: (NNNNNNNN<CRC><cr>
NNNNNNNN: Output load energy, N: 0~9, unit: Wh

Query output load energy of year
Computer: QLYyyyy<cr>
Device: (NNNNNNNN<CRC><cr>
yyyy: Year, y: 0~9
NNNNNNNN: Output load energy, N: 0~9, unit: Wh

Query output load energy of month
Computer: QLMyyyymm <CRC><cr>
Device: (NNNNNNNN<CRC><cr>
yyyy: Year, y: 0~9
mm: Month, m: 0~9 
NNNNNNNN: Output load energy, N: 0~9, unit: Wh

Query output load energy of day
Computer: QLDyyyymmdd<CRC><cr>
Device: (NNNNNNNN<CRC><cr>
yyyy: Year, y: 0~9
mm: Month, m: 0~9
dd: Day,  d: 0~9
NNNNNNNN: Output load energy, N: 0~9, unit: Wh

For year, month and day is required date and I suggest querry for this year, this month and today.

PetrDubi avatar Jun 28 '22 12:06 PetrDubi

Hi @syssi,

I solved my problem of bad wiring and also tested my fork to integrate the GPIGS2 command. It works perfectly.... Your code is just incredible :)

Could you elaborate your bad wiring? I have this exact same problem with my inverter but I've tried three different TTL converters and all possible wiring and config options. I can't believe I've missed something but you never know...

AtarianComputing avatar Jul 13 '22 15:07 AtarianComputing

I think the custom select written by @andreashergert1984 could be modified to add the PBATCD with something like

  - platform: pipsolar
    pipsolar_id: pip8048
    charging_discharging_controls:
      id: charging_discharging_controls_select 
      name: charging_discharging_controls_select
      optionsmap:
        "Charging enable/discharging enable": "PBATCD111"
        "Charging disable/discharging enable": "PBATCD110"
        "Charging enable/discharging disable": "PBATCD011"
        "Charging disable/discharging disable": "PBATCD010"
      statusmap:
        "0": "Charging enable/discharging enable"
        "1": "Charging disable/discharging enable"
        "2": "Charging enable/discharging disable"
        "3": "Charging disable/discharging disable"

Hi all, recently I moved fron my old axpert VMII 24V to a MAXII 8KW, than you so much for make my life good doing this. Now I guess if you finally managed to control the charger of the inverter, would be great if it coud be controlled to charge the battery in case low voltage or just cheap grid price. Thanks for your great job guys.

rem72 avatar Nov 22 '22 23:11 rem72

I will try to modify the custom select in order to add & test the chargin/discharging options... Not sure it will work.....

SeByDocKy avatar Nov 23 '22 11:11 SeByDocKy