Skip to content

Latest commit

 

History

History
88 lines (64 loc) · 4.69 KB

Control_HTTP.md

File metadata and controls

88 lines (64 loc) · 4.69 KB

HTTP Control Module

Introduction

The HTTP Control module allows control of the TWCManager Tesla Wall Charger controller via an in-built HTTP web server.

The web-server is multi-threaded (ie, it can be managed by multiple clients simultaneously), but does not support HTTPS encryption. It listens on Port 8080 by default; see Configuration below.

HTTP Control Module vs IPC Web Interface

HTTPControl is TWCManager's built-in web interface, and the only one TWCManager ships. The WebIPC module lets external scripts control TWCManager (see WebIPC).

Benefits of HTTPControl

  • Tightly integrated with the TWCManager controller. Less development lead-time to add functions.

Drawbacks of HTTPControl

  • Does not support HTTPS encryption.

Status

Detail Value
Module Name HTTPControl
Module Type Status
Status In Development

Configuration

The following table shows the available configuration parameters for the MQTT Control module.

Parameter Value
enabled required Boolean value, true or false. Determines whether we will enable HTTP control.
listenPort optional HTTP Web Server port. Defaults to port 8080.

JSON Configuration Example

"control": {
  "HTTP": {
    "enabled": true,
    "listenPort": 8080
  }
}

Using the HTTP Web Interface

If you have enabled HTTPControl, access it via the specified port. For example if your TWCManager machine is 192.168.1.1 and listenPort is 8080, access the HTTP interface with the following URL:

http://192.168.1.1:8080/

Using the API Interface

The HTTPControl web server provides an API interface under the /api URL root. The following methods are used when interacting with the API interface:

  • GET requests for requesting information or parameters
  • POST requests for performing actions or providing data

The following API endpoints exist:

Endpoint Method Description
addConsumptionOffset POST Add or Edit a Consumption Offset value
cancelChargeNow POST Cancels active chargeNow configuration
chargeNow POST Instructs charger to start charging at specified rate
deleteConsumptionOffset POST Delete a Consumption Offset value
getActivePolicyAction GET Provides the active policy's action: 1 charge at a fixed rate, 2 do not charge, 3 track green energy
getConfig GET Provides the current configuration
getConsumptionOffsets GET List configured offsets
getHistory GET Provides the charging history of the last two days, in 5 minute steps
getLastTWCResponse GET Provides the last response to a debug command
getPolicy GET Provides the policy configuration
getSlaveTWCs GET Provides a list of connected Slave TWCs and their state
getStatus GET Provides the current status (Charge Rate, Policy)
getUUID GET Provides a unique ID for this particular master, based on the physical MAC address
saveSettings POST Saves settings to settings file
sendDebugCommand POST Sends a debug command to the TWCs (used by the Debug page)
sendStartCommand POST Sends the Start command to all Slave TWCs
sendTeslaAPICommand POST Sends a vehicle command through the command order, for the car named by vehicleVIN (used by the Debug page)
setConsumptionOffset POST Sets the green energy offset in amps (offset)
setLatLon POST Sets the home location (lat, lon)
setPolicy POST Selects a policy by name (policy)
setSetting POST Set settings directly via API
sendStopCommand POST Sends the Stop command to all Slave TWCs
setScheduledChargingSettings POST Saves Scheduled Charging settings --> can be retrieved with getStatus