reinhard-brandstaedter / solarflow-control

A tool to automatically control Zendure's Solarflow hub with more flexibility to match home power demand
67 stars 10 forks source link

Support for Zendure Hyper 2000 #272

Open maxp1256 opened 2 months ago

maxp1256 commented 2 months ago

Hello!

are there any plans for supporting the new Hyper 2000? I've an Shelly 3EM, a photovoltaik without an hybrid inverter and the awattar.at hourly tariff. I would expect to be able to use the cheap hours in the night (2-5) to load the batteries, skip the rise in the morning hours (6-9) with zero net usage, continue reloading&flatting burst peaks (washing mashine/dishwasher heating or cooking) during the day with pv and skip the next high during 18-21 until batteries are empty.

I don't expect that it's possible to cover this with the standard app so I would be happy to have a very simple possibility to set mode (charge/discharge) and wattage locally, fast, reliable and without cloud/internet demand.

Edit: Another Idea: Do you know how the shelly integration is working? Is it possible to emulate a Shelly 3EM device locally to do every controlling with the power values?

reinhard-brandstaedter commented 2 months ago

Servus, I have no other device available than my own SFHub 1.2k. So I can’t tell you exactly. You might be able to disconnect the Hyper from Zendure Cloud the same way as the SF hubs with the sf-bt-manager and then you would get all data reported to a local MQTT broker, which is also used to relay commands to the Hyper2000 (given it works similar to the other SF products). It could be though that Zendure has implemented secure MQTT by now which could be an issue.

The shelly integration is likely a data exchange on the zendure backend between their mqtt and shelly cloud. But even so, if your hub is using a local mqtt you likely can also steer it via simulated shelly reporting (smart matching mode)

ralf-koe commented 1 month ago

Does that

you likely can also steer it via simulated shelly reporting (smart matching mode)

mean, that I can write Shelly (fake) data via MQTT?

maxp1256 commented 1 month ago

Hello,

a local mqtt service/proxy which modifies the real shelly em data sounds very promising. Do you know how it's working currently? (the marketing documents from zendure are talking about a link between shelly and zendure cloud) but I don't think that this would work because of instable internet connectivity and WAN delays. Probably the "linking" is only the interchange of the local mqtt endpoint (IP+Port)?

reinhard-brandstaedter commented 1 month ago

No, the original Zendure/Shelly integration can only happen via the public clouds. So both your devices (shelly & solarflow) have to be online. For users like me (shellies are only reporting locally) this wouldn't work. The hub has a input property smartPower which I assume is used to provide the readings of a Shelly (or any other power meter device) which then is used to adjust the outputLimit. Also the smartMode will control in which. mode (smart matching) the hub is working.

image

So if you want to try your approach you'll need to set the smartMode accordingly (check values by setting it from the App) and then publish data via the smartPower property. If I'm correct the hub will then adjust it's outputLimit. There are for sure some ramifications, like how often that limit can be updated (the hub was never the fastest in switching), ..

Raudi1 commented 1 week ago

Today I finally had some time to try solarflow-control on my Hyper 2000. Taking it offline worked, but I couldn't really get it to work completely. That's expected, since the device is different from the hub, but I'd really like to have local control of my Hyper 2000. I'm sadly no developer and can only do a bit of coding, so I'd only be able to help. Ideally this software would control the integrated inverter to charge the Hyper2000 with excess energy and to discharge it when there's power taken from the utility. I'd be happy with being able to set the charge/discharge power via MQTT though. Then I could let EVCC or Home Assistant handle it. After taking the Hyper2000 offline, there's no MQTT data aside from this: image Here's what the log shows

2024-08-24 13:59:55,579:INFO: MQTT Host: 192.168.1.1:1883
2024-08-24 13:59:55,579:INFO: MQTT User: MQTT/secret
2024-08-24 13:59:55,579:INFO: Solarflow Hub: ja72U0ha/xxxxxxx
2024-08-24 13:59:55,579:INFO: Limit via inverter: False
2024-08-24 13:59:55,579:INFO: Control Parameters:
2024-08-24 13:59:55,579:INFO:   MIN_CHARGE_POWER = 10
2024-08-24 13:59:55,579:INFO:   MAX_DISCHARGE_LEVEL = 800
2024-08-24 13:59:55,579:INFO:   MAX_INVERTER_LIMIT = 800
2024-08-24 13:59:55,579:INFO:   MAX_INVERTER_INPUT = 1190
2024-08-24 13:59:55,579:INFO:   SUNRISE_OFFSET = 60
2024-08-24 13:59:55,579:INFO:   SUNSET_OFFSET = 60
2024-08-24 13:59:55,579:INFO:   DISCHARGE_DURING_DAYTIME = True
2024-08-24 13:59:55,691:INFO: IP Address: xxx.xxx.xxx.xxx
2024-08-24 13:59:55,691:INFO: Location: Secret, North Rhine-Westphalia, Germany
2024-08-24 13:59:55,691:INFO: Coordinates: (Lat: xx, Lng: xx)
2024-08-24 13:59:55,693:INFO: No config setting found for option "control_bypass" in section solarflow!
2024-08-24 13:59:55,694:INFO: Publishing Homeassistant templates...
2024-08-24 13:59:55,732:INFO: Published 33 Homeassistant templates.
2024-08-24 13:59:55,732:INFO: Triggering telemetry update: iot/ja72U0ha/xxxx/properties/read
2024-08-24 13:59:55,732:INFO: Using OpenDTU: Base topic: solar/xxxx, Limit topic: solar/xxxx/cmd/limit_nonpersistent_absolute, SF Channels: [3], AC Limit: 1200
2024-08-24 13:59:55,732:INFO: No config setting found for option "scaling_factor" in section smartmeter!
2024-08-24 13:59:55,732:INFO: Using Smartmeter: Base topic: shellypro3em/status/em:0, Current power accessor: total_act_power, Total power accessor: total_aprt_power, Rapid change diff: 500W, Zero offset: 20W, Scaling factor: 1
2024-08-24 13:59:55,732:INFO: Connected to MQTT Broker!
2024-08-24 13:59:55,733:INFO: Hub subscribing: /ja72U0ha/xxxx/properties/report
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/solarInputPower
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/electricLevel
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/outputPackPower
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/packInputPower
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/outputHomePower
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/outputLimit
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/inverseMaxPower
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/masterSoftVersion
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/pass
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/passMode
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/batteries/+/socLevel
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/telemetry/batteries/+/totalVol
2024-08-24 13:59:55,733:INFO: Hub subscribing: solarflow-hub/xxxx/control/#
2024-08-24 13:59:55,733:INFO: Turning hub buzzer OFF
2024-08-24 13:59:55,733:INFO: DTU subscribing: solar/xxxx/0/powerdc
2024-08-24 13:59:55,733:INFO: DTU subscribing: solar/xxxx/0/efficiency
2024-08-24 13:59:55,734:INFO: DTU subscribing: solar/xxxx/+/power
2024-08-24 13:59:55,734:INFO: DTU subscribing: solar/xxxx/status/producing
2024-08-24 13:59:55,734:INFO: DTU subscribing: solar/xxxx/status/reachable
2024-08-24 13:59:55,734:INFO: DTU subscribing: solar/xxxx/status/limit_absolute
2024-08-24 13:59:55,734:INFO: DTU subscribing: solar/xxxx/status/limit_relative
2024-08-24 13:59:55,734:INFO: DTU subscribing: solarflow-hub/+/control/dryRun
2024-08-24 13:59:55,734:INFO: Smartmeter subscribing: shellypro3em/status/em:0
2024-08-24 13:59:55,777:INFO: Taking over bypass control: False
2024-08-24 13:59:55,778:INFO: Updating SUNRISE_OFFSET to 60 minutes
2024-08-24 13:59:55,778:INFO: Updating SUNSET_OFFSET to 60 minutes
2024-08-24 13:59:55,778:INFO: Updating MIN_CHARGE_POWER to 10 W
2024-08-24 13:59:55,778:INFO: Updating MAX_DISCHARGE_POWER to 1200 W
2024-08-24 13:59:55,778:INFO: Updating DISCHARGE_DURING_DAYTIME to True
2024-08-24 13:59:57,964:INFO: Rapid rise in demand detected, clearing buffer!
2024-08-24 13:59:57,966:INFO: HUB: S:-1.0W [ ], B: -1% (-1), V:-1.0V (-1.0), C: 0W, P:False (manual, possible), F:-1.0h, E:-1.0h, H: -1W, L: -1W
2024-08-24 13:59:57,966:INFO: INV: AC:800W, DC:1150.8W (285.2|304.9|290.8|269.9), L:800W (500.0W/channel) [ -1W]
2024-08-24 13:59:57,966:INFO: SMT: T:Smartmeter P:3304.0W [ 3304.0,3304.0,3304.0 ]
2024-08-24 13:59:57,967:INFO: SMT triggers limit function: 3304.0 -> 3304.0: executed
2024-08-24 14:00:14,469:INFO: Determined inverter's max capacity: 2000.0

I

welli2009 commented 1 week ago

Hi Vrabetz,

Your logs do not contain the necessary informations needed to develop your control. Try using MQTT Explorer to gather the necessary informations and attach screenshots from MQTT Explorer with the topics.

welli

Raudi1 commented 1 week ago

Hi Vrabetz, Your logs do not contain the necessary informations needed to develop your control. Try using MQTT Explorer to gather the necessary informations and attach screenshots from MQTT Explorer with the topics. welli

I'll try, but currently I can't connect to the Zendure MQTT. Was working earlier this day. Apparently the Hyper2000 uses the same data as the Hub and extends it: https://github.com/Zendure/developer-device-data-report?tab=readme-ov-file#the-fields-extended-by--hyper2000--ace-1500-based-on-solarflow The topic is always the same ja72U0ha/"DeviceID"/state and the JSON only contains part of the values. Here's a few examples from the official cloud API:

'{"hubState":0,"remainInputTime":59940,"packState":2,"sn":"xxxxx","remainOutTime":281}'
'{"heatState":0,"sn":"xxxx"}'
'{"hyperTmp":3131,"sn":"xxxx"}'
'{"inverseMaxPower":600,"inputLimit":116,"outputLimit":30,"acMode":1,"sn":"xxxx"}' #acMode 1 is input from the grid; 2 is output
'{"outputHomePower":261,"packInputPower":270,"electricLevel":75,"sn":"xxxx"}'
'{"hyperTmp":3141,"sn":"xxxx"}'