Skip to content

CLI — Raw API Methods

The franklinwh-cli raw command provides direct passthrough to all 48+ API methods.

Usage

# List all available methods
franklinwh-cli raw list

# Call a method (no args)
franklinwh-cli raw get_stats

# Call with positional arguments
franklinwh-cli raw get_tariff_detail 4329

# JSON output
franklinwh-cli raw get_stats --json

# Pipe JSON payload via stdin
echo '[{"startHourTime":"0:00","endHourTime":"24:00","waveType":1}]' \
  | franklinwh-cli raw get_custom_dispatch_list

# Show timing info
franklinwh-cli raw get_stats --timings

# Show response headers
franklinwh-cli raw get_stats --headers

Available Methods

Power & Stats

Method Args Description
get_stats — Current power flows and daily totals
get_runtime_data — Runtime data log
get_power_by_day YYYY-MM-DD Power for a specific day
get_power_details type date Power aggregated (type 1-5)

Operating Modes

Method Args Description
get_mode — Current operating mode
get_mode_info — Mode configuration details
get_all_mode_soc — Reserve SoC for all modes (TOU/Self/Emergency)

Weather & Storm

Method Args Description
get_weather — Current weather conditions
get_storm_settings — Storm hedge settings
get_storm_list — Storm event history

Power Control

Method Args Description
get_grid_status — Grid on/off status
get_power_control_settings — PCS control settings
get_power_info — Relay and power hardware info

Devices & Network

Method Args Description
get_device_composite_info — Full device composite data
get_agate_info — aGate hardware info
get_apower_info — aPower battery hardware info
get_device_info — Device detail info
get_smart_circuits_info — Smart circuit configuration
get_bms_info serial_no BMS info for a specific aPower
get_connectivity_overview — Unified view of primary/backup connections
get_network_state — Which transport the aGate is on right now — composes cmdType 317+339+341
scan_wifi_networks_ranked scan_time, min_rssi, dedupe, usable_rssi Scan sorted by signal, SSIDs deduped
get_network_info — aGate network config (via sendMqtt)
get_wifi_config — WiFi SSID, AP config (via sendMqtt)
scan_wifi_networks — Raw scan trigger (via sendMqtt) — prefer scan_wifi_networks_ranked
get_connection_status — Router/AWS connectivity (via sendMqtt)
get_network_switches — Interface on/off: WiFi/Eth/4G (via sendMqtt)

Reading connectivity. get_network_state() is the one to call — it returns the active transport, every interface with its link state and address, cloud reachability, and both transport sets used for write-safety checks:

state = await client.get_network_state()
state["active"]["label"]          # 'WiFi'
state["active"]["ip"]             # '192.168.0.110'
state["linked_transports"]        # ['wifi']        — carrying traffic right now
state["available_transports"]     # ['wifi', '4g']  — enabled AND able to take over
state["redundant"]                # True

The two differ because the aGate parks the transports it is not using: cellular can sit with an active SIM and good reception while reporting no link.

available answers "would this carry traffic if the one in use stopped?", and the two families are judged differently:

Transport Available when
4G enabled + SIM Active + reception. It is the by-design fallback and holds no IP while idle.
WiFi / Ethernet enabled + linked + holding an address (static or DHCP). Signal or a plugged cable is not enough.

WiFi associated with good signal but no DHCP lease is a candidate to switch to (see scan_wifi_networks_ranked), never a fallback to rely on — that exact state has twice left the aGate with no working path.

Any write-safety check must use available_transports, and must subtract the interface being modified — not the active one:

survivors = set(state["available_transports"]) - {"wifi"}   # rewriting WiFi
if not survivors:
    raise RuntimeError("no fallback would survive this write")

⚠️ active is the transport the aGate selected for itself, not a user-configured primary. The gateway re-selects autonomously — observed live moving 4G → WiFi with no command issued. Never present it as "configured primary", and never treat a change in it as proof a write succeeded. See Network Connectivity & WiFi Switching.

Setters. There are no network write methods yet. This is a gap in this SDK, not in the FranklinWH API — the setters exist on the wire as the same cmdTypes with the opt flag flipped (337 opt=1 sets SSID/password, 317 optType=1 writes interface config). See §2.5 of the design doc for the confirmed payloads and the MQTT catalog for the command table. Implementation is Phase 2 and is gated on live validation because a bad write can strand the gateway.

Account & Site

Method Args Description
get_home_gateway_list — Home gateway list
siteinfo — Site / account info
get_entrance_info — Customer entrance config
get_unread_count — Unread notification count
get_notification_settings — Notification settings
get_warranty_info — Warranty information
get_alarm_codes_list — Alarm codes history
get_site_and_device_info — Site and device list
get_equipment_location — Equipment location
get_grid_profile_info — Grid compliance profile
get_programme_info — VPP/utility programmes
get_benefit_info — Benefit/savings earnings
get_gateway_alarm — Active gateway alarms
get_site_detail — Site name, address, location
get_device_detail — Device/gateway address
get_device_overall_info — aPower count, total power
get_personal_info — User profile info

TOU / Tariff

Method Args Description
get_gateway_tou_list — TOU schedule list
get_charge_power_details — Charge power details
get_tou_dispatch_detail — TOU dispatch detail
get_utility_companies countryId provinceId Search utility companies
get_tariff_list companyId List tariffs for a utility
get_tariff_detail tariffId Full tariff template detail
get_tou_detail_by_id touId TOU config by ID
get_bonus_info — TOU bonus/incentive info
get_vpp_tip — VPP tips for TOU updates
calculate_expected_earnings JSON via stdin Projected savings for tariff template

Billing & Savings

Method Args Description
get_electric_data type date Electricity kWh arrays
get_charge_history — Battery charge/discharge history

Stdin JSON Input

Methods that need structured payloads accept JSON via stdin:

# Custom dispatch list
echo '[{"startHourTime":"0:00","endHourTime":"24:00","waveType":1}]' \
  | franklinwh-cli raw get_custom_dispatch_list --json

# Expected earnings calculator
cat template.json | franklinwh-cli raw calculate_expected_earnings --json