Skip to content

shpala/homey-electrasmart

Repository files navigation

Electra Smart AC for Homey Pro

Control your Electra Smart air conditioner units with Homey Pro.

Features

  • Full control over your Electra AC units
  • Set temperature (16-30°C)
  • Control AC modes: Cool, Heat, Fan, Dry, Auto, Standby
  • Adjust fan speed: Low, Medium, High, Auto
  • Monitor current room temperature
  • Automatic status updates every 60 seconds
  • Works with existing IMEI and Token credentials

Prerequisites

You need one of the following:

Option 1: Phone Number (Recommended - Easiest!)

  • Your phone number registered with Electra Smart (e.g., 0524001234)
  • The app will send you an OTP code via SMS during pairing

Option 2: Existing Credentials

  • IMEI - Your Electra device IMEI (format: 2b950000xxxxxxxx)
  • Token - Your authentication token

If you don't have IMEI/Token but want to generate them manually, you can use the included Node.js script:

Then copy the returned IMEI and Token

The script will:
- Send an OTP code to your phone via SMS
- Verify the code and retrieve your IMEI and Token
- Test the credentials to ensure they work
- Display your AC devices

**Note:** The app has built-in phone number authentication during pairing, so you only need manual credentials if you prefer to skip the OTP flow in the app!

## Installation

### Option 1: Install from Homey App Store (Recommended)

1. Open the Homey app
2. Go to "More" → "Apps"
3. Search for "Electra Smart AC"
4. Click "Install"

### Option 2: Install via Homey CLI (For Development)

1. Install Homey CLI:

```bash
npm install -g homey
  1. Login to your Homey account:
homey login
  1. Navigate to the app directory:
cd homey-electra-ac
  1. Install dependencies:
npm install
  1. Run the app on your Homey:
homey app install

Adding Your AC to Homey

  1. In the Homey app, go to "Devices" → "Add Device"
  2. Select "Electra Smart AC"
  3. Choose your authentication method:

Method 1: Phone Number (Recommended)

  1. Select "Phone Number"
  2. Enter your registered phone number (e.g., 0524001234)
  3. Click "Next"
  4. Click "Send OTP Code"
  5. You'll receive an SMS with a 4-digit OTP code
  6. Enter the OTP code and click "Verify Code"
  7. Select the AC units you want to add
  8. Click "Add" to complete pairing

Method 2: IMEI & Token

  1. Select "IMEI & Token"
  2. Enter your credentials:
    • IMEI: Your device IMEI (e.g., 2b950000xxxxxxxx)
    • Token: Your authentication token
  3. Click "Next"
  4. Select the AC units you want to add
  5. Click "Add" to complete pairing

Usage

Once added, your Electra AC will appear as a device in Homey with the following controls:

Device Capabilities

  • Power: Turn the AC on/off
  • Target Temperature: Set desired temperature (16-30°C)
  • Current Temperature: Monitor room temperature (read-only)
  • AC Mode: Select operating mode
    • Cool
    • Heat
    • Fan
    • Dry
    • Auto
    • Standby
  • Fan Speed: Control fan speed
    • Low
    • Medium
    • High
    • Auto

Automation with Flows

You can use your AC in Homey Flows for automation:

Example Flow: "Cool down when hot"

  • When: Temperature is above 26°C
  • Then: Turn on AC, set to Cool mode, 24°C

Example Flow: "Turn off at night"

  • When: Time is 11:00 PM
  • Then: Turn off AC

Example Flow: "Energy saving"

  • When: Nobody is home
  • Then: Set AC to 28°C or turn off

Troubleshooting

Device is unavailable

  • Check your internet connection
  • Verify your IMEI and Token are correct
  • Try removing and re-adding the device

Temperature not updating

  • The AC unit must be powered on to report temperature
  • Temperature updates every 60 seconds
  • Some AC models may not support temperature reporting

Commands not working

  • Ensure the AC unit is connected to Wi-Fi
  • Check the Electra cloud service is operational
  • Try restarting the Homey app

Invalid credentials error

  • Double-check your IMEI and Token
  • Tokens may expire - generate new credentials using node get-credentials.js <phone>
  • Ensure your phone number is registered with Electra

Technical Details

API Communication

This app communicates with the Electra cloud service at https://app.ecpiot.co.il/mobile/mobilecommand. Commands are sent via JSON over HTTPS.

Session Management

  • Session IDs (SID) are automatically generated and renewed
  • Minimum refresh interval: 60 seconds
  • Automatic retry with SID renewal on API failures

Status Polling

  • Device status is fetched every 60 seconds
  • Temperature readings use intelligent sensor selection (I_RAT → I_CALC_AT → I_RCT)
  • Only valid temperature readings (-5°C to 42°C) are displayed

Device Model Detection

The app automatically detects your AC model capabilities:

  • Models with dedicated ON/OFF flag
  • Models using standby mode for power control

Development

Project Structure

homey-electra-ac/
├── .homeycompose/          # App manifest components
│   ├── app.json           # App metadata
│   ├── capabilities/      # Custom capability definitions
│   └── drivers/           # Driver configurations
├── lib/                   # Core libraries
│   ├── ElectraAPI.js     # API client
│   └── ElectraDevice.js  # Device management
├── drivers/               # Device drivers
│   └── electra-ac/
│       ├── driver.js     # Driver logic
│       └── device.js     # Device logic
├── app.js                # Main app class
├── package.json          # Dependencies
└── README.md            # This file

Building the App

To compile the app manifest:

homey app build

To validate the app:

homey app validate

Testing

To run the app in development mode:

homey app run

View logs:

homey app log

Helper Scripts

The project includes helper scripts for testing and obtaining credentials:

Get Credentials (get-credentials.js)

Obtain IMEI and Token using phone number OTP authentication:

# Send OTP
node get-credentials.js 0524001234

# Verify OTP and get credentials
node get-credentials.js 0524001234 1234

Test Credentials (test-credentials.js)

Validate existing IMEI and Token credentials:

node test-credentials.js <IMEI> <TOKEN>

This will:

  • Generate a session ID
  • List your AC devices
  • Fetch status from the first device
  • Verify all API communication works

Credits & Acknowledgments

This project was made possible by the research and work of:

Original API Research

  • ElectraSmart Python API Client by Yonatan Perry
    • Original reverse engineering of the Electra Smart API
    • Foundation for understanding the API protocol and communication flow

Special Thanks

  • The Electra Smart API research community for their contributions to understanding the protocol
  • All contributors who helped improve and test the authentication flows

License

MIT License - See LICENSE file for details

This project is licensed under the MIT License, allowing free use, modification, and distribution with proper attribution.

Support

For issues and feature requests, please open an issue on GitHub or contact the developer.

Changelog

Version 1.1.0

  • New: Phone number authentication with OTP (SMS code)
  • New: 4-digit OTP support
  • Improved: Restore last AC settings when turning on
  • 🔧 Fixed: OTP verification waits for token before proceeding
  • 🔧 Fixed: Manual navigation control for better reliability
  • 📝 Updated: Cleaner codebase with reduced logging

Version 1.0.0

  • Initial release
  • Basic AC control (power, temperature, mode, fan speed)
  • Automatic status updates
  • Device pairing with IMEI and Token
  • Support for multiple AC units

About

Unofficial Electra Smart AC driver for Homey Pro

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published