wills106 / homeassistant-config

My Home Assistant Config as it evolves
37 stars 15 forks source link

SolaX X1 - modbus platform changes in HomeAssistant 2021.7.0 #12

Closed thedrjones closed 3 years ago

thedrjones commented 3 years ago

Hi.

Many thanks for sharing your HA configuration, it is an valuable reference to me in my Home Assistant journey.

There were changes to the modbus platform in 2021.7.0+, which have caused problems with your SolaX X1 configuration working. I have been using this for some time and was the trigger for my Home Assistant usage.

I have modified the modbus config at packages/solax_x1_hybrid_g3_group_read.yaml, using this as my guide. You may have already resolved this in your config and not updated it here yet, but thought I'd add it for others who may draw inspiration from your configs!

modbus:
  name: SolaX
  type: tcp # Comment out for RS485
  host: !secret inverter_ip # Comment out for RS485
  port: 502 # Comment out for RS485
  timeout: 5

  sensors:
    # Holding Registers
    - name: SolaX Group h1
      address: 139
      count: 19
      data_type: custom
      structure: ">19H"
      scan_interval: 2

    - name: SolaX Group h2
      address: 180
      count: 8
      data_type: custom
      structure: ">8H"
      scan_interval: 2

    # Input Registers
    - name: SolaX Group i1
      address: 0
      input_type: input
      count: 30
      data_type: custom
      structure: ">H2h5Hh3Hh7H3hHh5H"

    - name: SolaX Group i2
      address: 70
      input_type: input
      count: 14
      data_type: custom
      structure: ">2h10HI"

sensor:
  - platform: template
    sensors:
      # SolaX Group H1
      solax_charger_use_mode:
        friendly_name: "SolaX Charger Use Mode"
        value_template: "{{ states('sensor.solax_group_h1').split(',')[0] }}"
#and so on#

As the rest of the sensors are derived from the 4 groups, the holding ones (h1 and h2) certainly work, I've not tried the input ones yet as I don't (yet) automate overnight charging of the battery. That's a project for another day.

wills106 commented 3 years ago

I have not migrated to 2021.7.x yet as the ModBus implementation is messed up at the min, so waiting for that to be resolved first.

Glad my setup has been of use to you.

mfcltd commented 3 years ago

I’m glad I read this email. I won’t update HA until this is fixed!

Max

From: wills106 @.> Sent: 09 July 2021 13:14 To: wills106/homeassistant-config @.> Cc: Subscribed @.***> Subject: Re: [wills106/homeassistant-config] SolaX X1 - modbus platform changes in HomeAssistant 2021.7.0 (#12)

I have not migrated to 2021.7.x yet as the ModBus implementation is messed up at the min, so waiting for that to be resolved first.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/wills106/homeassistant-config/issues/12#issuecomment-877142454, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AETXC5BCEIJC565VTWF357DTW3RYDANCNFSM5ACUSAXA.

wills106 commented 3 years ago

It's ok if you have a single ModBus instance from what I can tell. But if you have say two SolaX Inverters you only get readings from one of them, it's ignoring the second device. There are 3 or 4 issues open at the min on the GitHub for HA Core ModBus integration.

MJP-76 commented 3 years ago

@thedrjones

I migrated to 2021.7.0 and it royaly screwed mine. I have two inverters and looks likes it not assigng the right hub/sensor to the correct slave/address

see here (https://github.com/home-assistant/core/issues/52765) and here (https://github.com/home-assistant/core/issues/52706)

Here is my config that works for both in 2021.6.6 ` modbus:

Both work fine until I upgrade to 2021.7.x then I get the issue's reported

I migrated to a single yaml with just the modbus in it but then only the figures from whatever the second listed invert is in both inverters so had to downgrade

MJP-76 commented 3 years ago

It's ok if you have a single ModBus instance from what I can tell. But if you have say two SolaX Inverters you only get readings from one of them, it's ignoring the second device. There are 3 or 4 issues open at the min on the GitHub for HA Core ModBus integration.

Apparently happens when you have two of more modbus hubs you are reading. It only takes the last one

Should work fine if a single hub only

You can always downgrade ha core to 2021.6.6 and wait it out until its fixed :)

Anxiumer commented 3 years ago

I've managed to swap to the above configuration format OK - I wasn't previously using the groups so needed to tweak things a little because the names were different from my original register names.

MJP-76 commented 3 years ago

I've managed to swap to the above configuration format OK - I wasn't previously using the groups so needed to tweak things a little because the names were different from my original register names.

even without the "groups" you just needed to move yours sensors in a indentation and move the scan_interval - I think thats all that needed doing

Oh, yhea, remove hub: xxx

nikito7 commented 3 years ago

All stuff fixed in next 2021.7.x or 2021.8 ...

MJP-76 commented 3 years ago

I have not tested in 2021.7.3 yet but according to the issue the fix for two hubs/multiple modbus devices did not make it into 2021.7.3 so am waiting as thats my issue

wills106 commented 3 years ago

I have finally migrated over to 2021.7.x So I have uploaded the new configuration style.

MJP-76 commented 3 years ago

Yep, Upgraded to 2021.7.3 and all fixed for me. Been on the new config since 6.6