panasonic-comfort-cloud-client
v2.1.5
Published
[](https://www.npmjs.com/package/panasonic-comfort-cloud-client) [Login to Panasonic Comfort Cloud with username and password will return a random token. This token is stored internally in a variable and sent with every request.
Groups and Devices
import {
Device,
Group,
ComfortCloudClient,
} from 'panasonic-comfort-cloud-client'
await client.login(username, password)
// List of groups representing different homes, containing a list of devices
const groups = await client.getGroups()
// Get device by guid. Containing readable and writable properties.
const device = await comfortCloudClient.getDevice(guid)Writable properties of device
import {
Device,
ComfortCloudClient,
//enums for writable properties
Power,
AirSwingLR,
AirSwingUD,
FanAutoMode,
EcoMode,
OperationMode,
FanSpeed,
} from 'panasonic-comfort-cloud-client'
await client.login(username, password)
const device = await comfortCloudClient.getDevice(guid)
// writable properties of device. Use the enums for the correct numbers.
device.operate = Power.On
device.operationMode = OperationMode.Auto
device.ecoMode = EcoMode.Auto
device.temperatureSet = 22
device.airSwingUD = AirSwingUD.Mid
device.airSwingLR = AirSwingLR.Mid
device.fanAutoMode = FanAutoMode.AirSwingAuto
device.fanSpeed = FanSpeed.Auto
// use parameter setter to send specific properties or use the device setter to send all parameter
await comfortCloudClient.setParameters(device.guid, device.parameters)
await comfortCloudClient.setDevice(device)History Data
import {
ComfortCloudClient,
DataMode
} from 'panasonic-comfort-cloud-client'
// ... login ...
// Get history data for specific device (Day, Week, Month, Year)
const history = await client.getDeviceHistoryData(device.guid, new Date(), DataMode.Day)CLI
The package comes with a command line interface to control your devices or debug the API.
$ comfort-cloud-client-clior if you haven't installed it globally:
$ npx panasonic-comfort-cloud-clientFollow the interactive prompts to login and control your devices.
Usage Example
? App Version (default: 1.20.0) 1.21.0
? Username [email protected]
? Password [hidden]
Login successful.
? Select a package manager Get groups
Found 1 groups.
? Select a group My Home
Found 2 devices.
? Select a device or print group Living Room AC
? Select command for device Living Room AC. Get history
? Select data mode Day
{
"energyConsumptionHeating": 0,
"energyConsumptionCooling": 2.5,
...
}Changelog
2.1.5
- Fix: Fixed
getDeviceHistoryDatadate formatting logic to always useYYYYMMDDformat forDataMode.MonthandDataMode.Year, resolving errors. - Feature: Improved CLI error logging: Now catches errors and logs full
ServiceErrordetails, includingaxiosresponse data for better debugging.
2.1.3
- Feature: Allow selecting DataMode (Day, Week, Month, Year) in CLI history command.
2.1.2
- Fix: Added check to filter out invalid devices (e.g. Heat Pumps) that do not provide parameters, preventing crashes (PR #22).
2.1.1
- Feature: Added
getDeviceHistoryDatawith full type support (HistoryDataResponse) for better developer experience. - Feature: CLI now prompts for App Version on startup (defaults to current known version).
- Fix: Corrected various types and examples in
README.md. - Fix: Improved timezone handling in history data requests.
- Internal: Major test refactoring: Switched to full mocking (removed dependency on
auth_data.json), extracted fixtures, and added realistic data scenarios.
2.1.0
- Feature: Support for login with refresh token.
- Feature: Added
CFCGenerator.
2.0.x
- Feature: Added OAuth support.
- Feature: Introduced Command Line Interface (CLI).
- Tech: Upgrade to ES2022.
- Fix: Auto-refresh token fixes.
1.1.0
- Feature: Added support for inside/outside temperature.
- Feature: Added support for nanoe mode.
