Heres what i’m trying to do
SMA SBS5 battery invertor, to instruct invertor to charge battery from grid.
I am successfully reading using modbus various modbus register addresses getting all sorts of data on the battery invertor including charge%, charge/discharge wattage, current running mode, temperature of invertor etc etc
Where i am stuck is trying to fathom the modbus.write register service in Hassio and how to configure
I have been given the following write register information from SMA the invertor manufacturer
----snip----
To enable manual charging set points you need to do the following.
- Using register 40151 and enabling the function to charge via modbus.
Value ranges as follows
802: Active (Act)
803: Inactive (Ina)
2.Using register 40149 and entering the value, positive for discharge and negative for charging
----snip----
I have tried the following in the service dev tool
service: modbus.write_register
data:
address: 40151
hub: thames23ss
value: 802
unit: 3
not sure whether i am on the right track here, and whether the values themselves are correct
- the hub name is defined in configuration.yaml.
- the unit value in service dev tool suggests this is the “address of the modbus unit”, so i assume this is the slave address?
- address i assume is the holding register address?
- value i assume is the value defined above in the explanation
In my log with the above values when i attempt to call the service, i get an error in the log as follows
Pymodbus: Exception Response(134, 6, IllegalAddress)
so something is amiss in my configuration on the service dev tool
Anyone with some experience in utilising modbus write registers able to point me in the right direction?
Why am i trying to achieve this?
In winter i would like to charge battery from grid during off peak tariff of 11c kwh, and stop charging once shoulder tariff of 18ckwh, only if the ac is running.
Ive got all the pieces of the puzzle in place,
- I can see the ac is running from its pwoer consumption being greter than 400w
- I can read all the modbus values of the battery invertor, eg: soc (state of charge %) and charge or discharge load
- i have a temperature sensor of the room so that ac only kicks in when below threshold temperature
however am stuck on the modbus write register for the battery invertor to instruct it to go into charge if all my conditions above are met.
eg: ac running during off peak tariff (before 7am), charge for 12 minutes at 5000w until shoulder period, then stop charging battery and allow to discharge once shoulder period commences at 7am.