New Sun Synk Connect Account and Inverter Binding

Hi

I think this is because you have used .postUpdate() and not .sendCommand()

Google is your friend: check out the documentation:

When the result of the commandString is to cause some action (e.g. turn on a light, change a thermostat to a new temperature, etc.) then use sendCommand. When interacting with widgets on the user interfaces commands are sent to the Items.

You should see in the logs, if debug is switched on for the binding, DEBUG org.openhab.binding.sunsynk.internal.api.DeviceController Trying to send commands to inverter: xxxxxxx between the token message and get STATE message as below:

INFO openhab.event.ItemStateChangedEvent
Item 'Interval2GridCapacity' changed from 93 to 90
...
DEBUG
org.openhab.binding.sunsynk.internal.api.AccountController
Account configuration token not expired.
DEBUG	
org.openhab.binding.sunsynk.internal.api.DeviceController
Trying to send commands to inverter: xxxxx
DEBUG	
org.openhab.binding.sunsynk.internal.api.DeviceController
Will get STATE for Inverter inverterName serial xxxxxx

You get the same result as .sendCommand if you use the Main GUI
Go to the Inverter Thing channels and check show advanced, click on the ‘V’ for the channel you want to change. Then click on the drop down, then click on the ‘Item’ and you should see a control for the item, change that and watch your logs.

Also don’t forget this from the SunSynk binding documentaion:

Commands sent (from openHAB) to Sun Synk are buffered up until the next refresh interval and as they take a while to propagate through to your inverter, some channels are not refreshed (read back) from Sun Synk Connect until the next minute.

so don’t check the SunSynk Connect App until a short while after you see Trying to send commands to inverter: xxxxxxx

Hope that sorts it for you.

@LeeC77 Many thanks - stupid error on my side! You are correct and sendCommand is what I should have been using. Sorry to have bothered you unnecessarily.

Glad it worked for you.

Good Afternoon,

I think I may have jumped the gun a bit and have done some more testing and it is not working for me.

I run (manually via a test script) the following to update the charge target (number)

SunSynk_Inverter_Interval_4_Charge_Target.sendCommand(95)

and the resulting log output is:

12:12:33.277[INFO] [openhab.event.ItemCommandEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' received command 95 (source: org.openhab.core.automation.module.script)
12:12:33.279[INFO] [openhab.event.ItemStatePredictedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' predicted to become 95
12:12:33.285[INFO] [openhab.event.ItemStateChangedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' changed from 100 % to 95 % (source: org.openhab.core.autoupdate.optimistic)
12:13:24.330[INFO] [openhab.event.ItemStateChangedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' changed from 95 % to 100 % (source: org.openhab.core.thing$sunsynk:inverter:97fc9b6a4b:E47W248005422502132030:interval-4-grid-capacity)

I get exactly the same results if I use:

SunSynk_Inverter_Interval_4_Charge_Target.sendCommand("95%")

However changing, say the grid_charge (switch) from ON to OFF or visa versa does work as expected, and the ‘value’ does not temporarily bounce to the new required value and then back to the original value:

12:19:19.832[INFO] [openhab.event.ItemCommandEvent] - Item 'SunSynk_Inverter_Interval_4_Grid_Charge' received command OFF (source: org.openhab.core.automation.module.script)
12:19:19.835[INFO] [openhab.event.ItemStatePredictedEvent] - Item 'SunSynk_Inverter_Interval_4_Grid_Charge' predicted to become OFF
12:19:19.838[INFO] [openhab.event.ItemStateChangedEvent] - Item 'SunSynk_Inverter_Interval_4_Grid_Charge' changed from ON to OFF (source: org.openhab.core.autoupdate.optimistic)

Turning on Debug logging reveals an error being reported:

12:29:02.556[INFO] [openhab.event.ItemCommandEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' received command 95 % (source: org.openhab.core.automation.module.script)
12:29:02.557[INFO] [openhab.event.ItemStatePredictedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' predicted to become 95 %
12:29:02.560[INFO] [openhab.event.ItemStateChangedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' changed from 100 % to 95 % (source: org.openhab.core.autoupdate.optimistic)
12:29:02.566[ERROR] [org.openhab.core.internal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.sunsynk.internal.handler.SunSynkInverterHandler@777d760f': For input string: "95 %"
12:29:30.886[DEBUG] [org.openhab.binding.sunsynk.internal.api.AccountController] - Account configuration token not expired.
12:29:30.887[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Will get STATE for Inverter [INVERTERNAME] serial [SERIALNUMBER]
12:29:30.887[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Trying Common Settings
12:29:30.919[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Trying Grid Real Time Settings
12:29:30.991[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Trying Battery Real Time Settings
12:29:31.056[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Trying Temperature History
12:29:31.193[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Trying Real Time Solar
12:29:31.297[DEBUG] [org.openhab.binding.sunsynk.internal.api.DeviceController] - Trying Plant Summary
12:29:31.330[DEBUG] [org.openhab.binding.sunsynk.internal.handler.SunSynkInverterHandler] - Successfully got and parsed new data for Inverter [INVERTERNAME] serial [SERIALNO] at plant [PLANTNAME]0 504235
12:29:31.330[DEBUG] [org.openhab.binding.sunsynk.internal.handler.SunSynkInverterHandler] - Retrieved state of inverter [INVERTERNAME].
12:29:31.334[DEBUG] [org.openhab.binding.sunsynk.internal.handler.SunSynkInverterHandler] - Updating Channels
12:29:31.361[INFO] [openhab.event.ItemStateChangedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' changed from 95 % to 100 % (source: org.openhab.core.thing$sunsynk:inverter:97fc9b6a4b:E47W248005422502132030:interval-4-grid-capacity)

(Note I have changed the inverter name, serial number and plant name in the log as I’m unsure if these should be visible generally)

Would be really grateful for any ideas / ways to overcome this. Many Thanks.

Looks correct, command shoud be of the form: Interval4GridCapacity.sendCommand(95)

I have tested your specific command and it works for me. I use the binding all the time without issue, doesn’t mean your fault is not real, but need more info.

In your logs you get an error for sendCommand("95 %") don’t use this form.

2:29:02.566[ERROR] [org.openhab.core.internal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.sunsynk.internal.handler.SunSynkInverterHandler@777d760f': For input string: "95 %"

Looks like you are on latest release openHAB 5.1.0, it includes the offical release of the binding? Are you using the official binding or the .jar from my github.

Are you logged into the Sun Synk App at the same time you are doing the tests? I have had some funnies with that.

Perhaps you could test some more:

  • Update to openHAB 5.1.0 binding not the .jar in your addons.
  • Keep the Sun Synk App closed for at least a minute since your last sendComand() once you have checked the value in the App close it?
  • Is there something about timing, does it happen every time.
  • Do you see the log DEBUG entry Trying to send commands to inverter: and Sent command: to inverter
14:28:55.104	DEBUG	
org.openhab.binding.sunsynk.internal.api.AccountController
Account configuration token not expired.
14:28:55.105	DEBUG	
org.openhab.binding.sunsynk.internal.api.DeviceController
Trying to send commands to inverter: XXXXX
14:28:55.212	DEBUG	
org.openhab.binding.sunsynk.internal.api.DeviceController
Sent command: to inverter XXXXX.
14:28:55.213	DEBUG	
org.openhab.binding.sunsynk.internal.api.DeviceController
Will get STATE for Inverter XXXXX serial XXXXX

**Known issue: At the moment values changed in the Sun Synk App for the battery settings are not always syncing back with openHAB.**
  • Yes, I’m on the latest 5.1.0
  • Have (now) removed the .jar from the addons and am using the official one included in 5.1.0 installed via the addons page
  • SunSynk App / Website are not open / logged in
  • Yes - It happens every time
  • No - Do not see the Trying to send or Sent messages

running

SunSynk_Inverter_Interval_4_Charge_Target.sendCommand(90)

log shows:

16:20:17.408[INFO] [openhab.event.ItemCommandEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' received command 90 (source: org.openhab.core.automation.module.script)
16:20:17.410[INFO] [openhab.event.ItemStatePredictedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' predicted to become 90
16:20:17.413[INFO] [openhab.event.ItemStateChangedEvent] - Item 'SunSynk_Inverter_Interval_4_Charge_Target' changed from 15 % to 90 % (source: org.openhab.core.autoupdate.optimistic)
16:20:17.420[ERROR] [org.openhab.core.internal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.sunsynk.internal.handler.SunSynkInverterHandler@25f7e388': For input string: "90 %"

I have no idea why its stating “90 %” as that’s definitely not what is being passed in the sendCommand

SunSynk_Inverter_Interval_4_Charge_Target.sendCommand(90)

Item:


Thanks.

Is your item defined to be a set point.

Number:Dimensionless Interval4GridCapacity “Charge Target Interval 4 [%s]” (SunSynkInverterControls) [Setpoint] { channel=“sunsynk:inverter:a5fb8ca2fd:EXXXXXXXXX:interval-4-grid-capacity”, listWidget=“oh-slider-item” [subtitle=“Set % SOC”, title=“Target SOC”], widget=“oh-slider-card” }

If your not using the .items file:
Use the Semantic Model: Edit the Item and set the “Point” tag to “Setpoint”. This tells openHAB that the value is intended to be changed, and it will often automatically provide a slider or stepper widget.

Thanks,

That made no difference but I noticed that mine, for some reason, had the ‘unit’ set tp % where I could not see that on your screen shot:


Removed the unit, and now it works perfectly.

Thanks again for all your work on this binding, and for your assistance personally.

Great you have it sorted.