Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/predbat/fox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,14 @@ async def publish_data(self):

self.dashboard_item(entity_id, state=state, attributes=attributes, app="fox")

def lattice_fragment(self):
"""Read-only Lattice fragment: FoxESS cloud devices (topology + sensor inventory)."""
from lattice import device_fragment

serials = [d.get("deviceSN") for d in (getattr(self, "device_list", None) or []) if isinstance(d, dict) and d.get("deviceSN")]
devices = [{"serial": str(s), "device_type": "fox", "sensors": [{"capability": "soc", "unit": "%"}, {"capability": "battery_power", "unit": "W"}]} for s in serials]
return device_fragment(devices, provider="fox-cloud", name="FoxESS Cloud", transport="https", preference=1, locality="cloud")

async def write_setting_from_event(self, entity_id, value, is_number=False):
"""
Handle write events
Expand Down
7 changes: 7 additions & 0 deletions apps/predbat/solax.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,13 @@ async def switch_event(self, entity_id, service):
if "_battery_schedule_" in entity_id:
await self.write_battery_schedule_event(entity_id, service)

def lattice_fragment(self):
"""Read-only Lattice fragment: Solax cloud plants (topology + sensor inventory)."""
from lattice import device_fragment

devices = [{"serial": str(p), "device_type": "solax", "sensors": [{"capability": "soc", "unit": "%"}]} for p in getattr(self, "plant_list", []) or []]
return device_fragment(devices, provider="solax-cloud", name="Solax Cloud", transport="https", preference=1, locality="cloud")

async def write_battery_schedule_event(self, entity_id, value):
"""
Write a battery schedule based on an event
Expand Down
7 changes: 7 additions & 0 deletions apps/predbat/solis.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,13 @@ async def decode_time_windows_v2(self, inverter_sn):
self.log("Solis API: Decoded time windows v2 for {}: {}".format(inverter_sn, result)) # Debug log
return result

def lattice_fragment(self):
"""Read-only Lattice fragment: Solis cloud inverters (topology + sensor inventory)."""
from lattice import device_fragment

devices = [{"serial": str(s), "device_type": "solis", "sensors": [{"capability": "soc", "unit": "%"}, {"capability": "battery_power", "unit": "W"}]} for s in getattr(self, "inverter_sn", []) or []]
return device_fragment(devices, provider="solis-cloud", name="Solis Cloud", transport="https", preference=1, locality="cloud")

async def reset_charge_windows_if_needed(self, inverter_sn):
"""
Predbat only uses 1 slot so disable the others to avoid conflicts.
Expand Down