GithubHelp home page GithubHelp logo

ha_solis_modbus's People

Contributors

fboundy avatar finalbillybong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha_solis_modbus's Issues

MODBUS TCP/IP Issue with S2-WL-ST data loggers and older firmware

Whilst this is a self resolved issue, I thought it worthwhile sharing it, in the hope it will help others save a lot of wasted time!

I have been working with Solis on a problem with MODBUS TCP/IP not functioning on some of our S2-WL-ST data loggers with older firmware (firmware version10010106 in my case). Once the firmware of the S2-WL-ST was upgraded to one of the current versions (Version 10010117 in our case) MODBUS TCP/IP functionality worked correctly and reliably, so there is definitely a problem with the older firmware. For reference, the very latest firmware (10010119) would not install on the sticks with the old (10010106) firmware and crashed the stick (Fixed Red & Amber LED) whenever the upgrade was attempted by Solis support, they then tried the 10010117 firmware and it installed correctly and MODBUS TCP/IP functioned correctly, so all in all rather painful!

S2-WL-ST - DataLogger Limitations

Thanks for the great work @fboundy

Has anyone experienced issues with cloud disconnecting whenever you start using an integration - no matter if this one, I mean any integration that connects to port 502?

Solis Daily Import/Export no longer appear to reset

Having just updated to HA Core 2024.4.0 yesterday, I've just this morning noticed that my Solis Daily Import/Export entities have continued to increment beyond midnight.

Screenshot 2024-04-05 at 04 46 40

I'm not sure if this is a quirk, coincidence, or if I've just caught HA at the wrong time, but historical data showed a clear reset to zero at midnight.

I'm very much open to this being an ill-timed HA update, but otherwise - Thoughts welcome!

Possible missing sensor from latest solis.yaml

Francis

Just reviewing your latest v2.0.1 code. I can see you have updated solis.yaml with a set of sensor registers for read/write of the inverters time, but i couldnt see a RO register for the seconds. Following your pattern, I am guessing it would be:

- name: Solis Second RO
- address: 33027

Hope this helps

Sean

Where is sensor.solis_eco7_time_remaining?

I ran into this error related to automations before I realised I couldn't find a reference to sensor.solis_eco7_time_remaining.

Error while processing template: Template<template=({{( ((states('input_number.solis_battery_capacity') | int * 1000) * ((states('input_number.eco7_target_soc') | int) - (states('sensor.solis_battery_soc') | int)) ) / 10 / (states('sensor.solis_eco7_time_remaining') | float) / (states('sensor.solis_battery_voltage_bms') | float) ) | int / 10 }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1888, in forgiving_float_filter
    return float(value)
ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 539, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2130, in _render_with_context
    return template.render(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1891, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1589, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{( ((states('input_number.solis_battery_capacity') | int * 1000) * ((states('input_number.eco7_target_soc') | int) - (states('sensor.solis_battery_soc') | int)) )  / 10 /  (states('sensor.solis_eco7_time_remaining') | float) / (states('sensor.solis_battery_voltage_bms') | float) ) | int / 10 }}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 660, in async_render_to_info
    render_info._result = self.async_render(variables, strict=strict, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 541, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{( ((states('input_number.solis_battery_capacity') | int * 1000) * ((states('input_number.eco7_target_soc') | int) - (states('sensor.solis_battery_soc') | int)) )  / 10 /  (states('sensor.solis_eco7_time_remaining') | float) / (states('sensor.solis_battery_voltage_bms') | float) ) | int / 10 }}' but no default was specified

I am admittedly new at home assistant programming although I am quite experienced with software dev.

Cannot set : Scripts: Solis Set Eco7 Times

Hi,

I simply cannot get it to run without an error.
I am sure you are too busy to resolve & imagine dozens of possibilites but I am really struggling & run out of Ideas, is there any quick direction you can point me in to at least try.

I have all the script, template yaml's etc. I am sure exactly as you have in your lists
the two, input_datetime.economy_7_start & end have values from an entity on a page.
I can read all the sensors, just cannot set any.
I tried direct from setting/scripts, however it does say "failed to call service" whereas running the automation, on change of value start or end, I get the process below & then the error.

Triggered manually at 21 June 2023 at 15:21:14
Scripts: Solis Set Eco7 Times
Solis Set Eco7 Times (script.solis_set_eco7_times) started
(script.solis_set_eco7_times) turned on
Solis Write Holding Register (script.solis_write_holding_register) started
(script.solis_write_holding_register) turned on
(script.solis_write_holding_register) turned off
(script.solis_set_eco7_times) turned off
Stopped because an error was encountered at 21 June 2023 at 15:21:14 (runtime: 0.02 seconds)
'solis'

Indents sure correct, I have Visual Studio & the helper so does show problems.

Copy as below direct from your repository plus the rest, I have not included below but is in my yaml.
solis_set_eco7_times: alias: Solis Set Eco7 Times sequence: - service: script.solis_write_holding_register data: register_addr: 43143 register_value: "{{(states('input_datetime.economy_7_start')).split(':')[0] | int}}" - service: script.solis_write_holding_register data: register_addr: 43144 register_value: "{{(states('input_datetime.economy_7_start')).split(':')[1] | int}}" - service: script.solis_write_holding_register data: register_addr: 43145 register_value: "{{(states('input_datetime.economy_7_end')).split(':')[0] | int}}" - service: script.solis_write_holding_register data: register_addr: 43146 register_value: "{{(states('input_datetime.economy_7_end')).split(':')[1] | int}}" mode: single icon: mdi:battery-clock-outline

Connection refused

Hi,
I have a Solis inverter - RHI-5k-48ES - with a wired datalogger stick - S2-WL-ST. I’m trying to get it to talk to my home assistant install. I added the solis.yaml file to my HA install and added the IP address to the secrets.yaml file and added modbus: !include solis.yaml to my configuration.yaml file

I’ve restarted my HA and my log files are filling up with this error

2023-10-30 11:59:43.906 ERROR (SyncWorker_4) [pymodbus.logging] Connection to (192.168.2.232, 502) failed: [Errno 111] Connection refused.

I’ve confirmed that the IP address listed above is the correct IP - I can access to via the web admin. I've removed the datalogger from my SolisCloud account to rule out any potential conflicts and I've tried both port 502 and port 8899. Not sure if I've missed a step somewhere along the way. Do I need to add credentials somewhere?

Thanks.

Modbus Unpack Errors

I am using the script against a Solis Hybrid invertor and most sensors are working, but I see the following sensors which are not updating correctly:

Solis Total Generation
Solis Timed Discharge 2 End Minute
Solis Temperature
Solis Grid Active Power

Which are all showing as unavailable (they are sometimes intermittent)

I am also seeing messages of the type:

2023-02-06 17:26:05.303 ERROR (MainThread) [homeassistant.components.modbus.base_platform] Received 20 bytes, unpack error unpack requires a buffer of 2 bytes
2023-02-06 17:26:05.305 ERROR (MainThread) [homeassistant.components.modbus.base_platform] Received 20 bytes, unpack error unpack requires a buffer of 2 bytes
2023-02-06 17:26:05.308 ERROR (MainThread) [homeassistant.components.modbus.base_platform] Received 20 bytes, unpack error unpack requires a buffer of 2 bytes
2023-02-06 17:26:11.059 ERROR (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: solis: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)

In the log for Modbus and getting one python error as follows:

2023-02-06 17:26:38.354 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/modbus/sensor.py", line 100, in async_update
raw_result = await self._hub.async_pymodbus_call(
File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 409, in async_pymodbus_call
result = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 386, in _pymodbus_call
result = entry.func(address, value, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/mixin.py", line 104, in read_holding_registers
return self.execute(
File "/usr/local/lib/python3.10/site-packages/pymodbus/client/base.py", line 195, in execute
return self.transaction.execute(request)
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 168, in execute
response, last_exception = self._transact(
File "/usr/local/lib/python3.10/site-packages/pymodbus/transaction.py", line 288, in _transact
packet = self.client.framer.buildPacket(packet)
File "/usr/local/lib/python3.10/site-packages/pymodbus/framer/socket_framer.py", line 226, in buildPacket
data = message.encode()
File "/usr/local/lib/python3.10/site-packages/pymodbus/register_read_message.py", line 31, in encode
return struct.pack(">HH", self.address, self.count)

I am having difficulty debugging beyond this and wondered if you could shed any light on how to debug?

lazy_error_count key

It seems "lazy_error_count" will be depreciated. I received the warning below today.

Please remove the lazy_error_count key from the modbus entry in your configuration.yaml file and restart Home Assistant to fix this issue. All errors will be reported, as lazy_error_count is accepted but ignored

Extra charge/discharge slots

Apologies if 'issues' isn't the right place to put this, but I thought this info might be helpful.

After some guidance from you in the Solis Facebook group, I've got some extra bits working. My inverter has 3 charge and 3 discharge time slots. I've found the following so far:

43141 charge current
43142 discharge current
43143 charge hour start 1
43144 charge min start 1
43145 charge hour end 1
43146 charge min end 1
43147 discharge hour start 1
43148 discharge min start 1
43149 discharge hour end 1
43150 discharge min end 1
43151
43152
43153 charge hour start 2
43154 charge min start 2
43155 charge hour end 2
43156 charge min end 2

I suspect they then follow on in the same pattern. I'm not sure if 43151 and 43152 are left blank so that the next bank of slots are exactly 10 registers up, or for some other reason.

I'm on Octopus Intelligent which means I get 6 hours at the cheap rate guaranteed - 23:30 -05:30. But I also sometimes get the cheap rate outside of those times. This is decided by Octopus when I plug my car in. So I needed to be able to detect this and stop my house batteries discharging in to the car. To achieve this I leave charge times for slot 1 set to my guaranteed off peak times, and manipulate slot 2 when their are extras. I do this in quite a basic way. There is an Octopus Intelligent HA integration which has a switch that reflects if your account is currently benefitting from the cheap rate. I use this to trigger a script that sets the 'charge 2' slot to 05:31-23:29 if the current time is outside of the usual cheap window. Effectively forcing it to charge.

alias: Battery Force Charge
description: Forces battery to charge when Octopus intelligent rate is cheap
trigger:
  - type: turned_on
    platform: device
    device_id: 52eae951b4976236251ea7c7c31698f4
    entity_id: binary_sensor.octopus_intelligent_slot
    domain: binary_sensor
condition:
  - condition: time
    after: "05:30:00"
    before: "23:30:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
action:
  - service: script.solis_force_charge_on
    data: {}
mode: single

With a similar automation to turn it off again.
The script is based on your economy 7 one:

solis_force_charge_on:                          
  alias: Solis Force Charge On                        
  sequence:                                     
  - service: script.solis_write_holding_register         
    data:                                       
      register_addr: 43153                      
      register_value: 05                                                         
  - service: script.solis_write_holding_register
    data:                                                  
      register_addr: 43154                                                       
      register_value: 30                        
  - service: script.solis_write_holding_register
    data:                                                      
      register_addr: 43155                      
      register_value: 23                        
  - service: script.solis_write_holding_register          
    data:                                       
      register_addr: 43156                                                           
      register_value: 29                              
  mode: single                                  
  icon: mdi:battery-clock-outline                         

Again, with another to set the times all back to 00 when the cheap rate ends.

Nothing revolutionary, but thought it might help someone! Thanks again for your great work.

Missing input?

Hey. Great work on this. Thank you!

The template below references 'input_number.solis_battery_capacity'

- sensor:       
    name: "Solis Eco7 Charge Current"
    unique_id: "Solis Eco7 Charge Current"
    device_class: current
    state_class: measurement
    unit_of_measurement: A
    state: >-
      {{(
      ((states('input_number.solis_battery_capacity') | int * 1000) *
      ((states('input_number.eco7_target_soc') | int) - (states('sensor.solis_battery_soc') | int))
      ) 
      / 10
      / 
      (states('sensor.solis_eco7_time_remaining') | float)
      / (states('sensor.solis_battery_voltage_bms') | float) ) | int / 10
      }}

But I cannot see that in the inputs.yaml? My HA throws the error 'Template error: int got invalid input 'unknown' when rendering'.

Modbus failing after upgrade to HA 2023.9

I've raised the issue elsewhere as I believe that HA 2023.9 is where the issue really lies, but have been asked to point the question back to yourself.

Whilst running:

Home Assistant 2023.9.1
Supervisor 2023.08.3
Operating System 10.5
Frontend 20230908.0 - latest

I'm repeatedly finding that modbus trips up:

2023-09-09 08:51:30.434 ERROR (SyncWorker_1) [homeassistant.components.modbus.modbus] Pymodbus: solis: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2023-09-09 08:59:51.205 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus solis communication closed
2023-09-09 09:00:07.420 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus solis communication closed
2023-09-09 09:00:07.715 ERROR (SyncWorker_18) [pymodbus.logging] Connection to (IP ADDRESS, 502) failed: [Errno 111] Connection refused
2023-09-09 09:01:22.378 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus solis communication closed

I've increased lazy error count to 10 on each of the sensors to see if it lasts a little longer with a mixed bag of results. It first bought me five minutes but has been stable for ~ 5 hours since. In each instance, the problem is resolved with a config reload.

No issues with the dongle, which can be accessed via its IP address, restarted etc.

Any help would be appreciated.

script.yaml - any value under exampled e.g. example: 50 - shows teh numebr as an error

Hi,

I think I have asked too early, should be able figure more out so ignore below, I guess the example it to be ignored/removed & use the input value to be set in HA.

Really sorry to ask this as guess should be obvious & does NOT prevent from starting but have found any errors marked can cause problems later on.
on all the numbers after "example:" are marked as an error. red squiggle under each number.
using VS HA helper.
e.g.
solis_set_charge_current:
alias: Solis Set Charge Current
fields:
solis_set_charge_current:
description: Fixed time charge current (A)
example: 50

I am actually struggling to get it to work at all from HA, I can read all the data from previous info. great, no problems.
Just trying to set up to send.

Update Inverter time?

Is it possible to include sensors and scripts to read/write the inverter time? I've tried modifying the supplied timed discharge hour/minute (etc) sensors already included to registers 33025-7 (System Time) or 43003-5 ('Real time') is fruitless and HA reports sensor value is unknown/unavailable. When using the Solis cloud app, I found my inverter time tended to drift, but the app included a way to copy the phone's time. I'd like to automate this in HA to periodically correct the inverter's timekeeping.

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.