Skip to content

Arsalan134/AppleHome-TempHumidity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ ๐ŸŒก๏ธ Apple HomeKit Temperature & Humidity Station

HomeKit ESP8266 C++ Arduino License

Transform your home into a smart environment with native Apple HomeKit integration! ๐ŸŽ

๐Ÿš€ Features โ€ข ๐Ÿ“ฑ HomeKit Setup โ€ข ๐Ÿ”ง Installation โ€ข ๐Ÿ“Š Sensors โ€ข ๐Ÿค Contributing


๐ŸŒŸ What is This?

Turn your ESP8266 into a professional Apple HomeKit Weather Station! This project creates a native HomeKit accessory that appears directly in your iPhone's Home app - no additional apps required!

๐ŸŽฏ The Magic

  • Native HomeKit Integration ๐Ÿ  - Appears directly in Apple Home app
  • Dual Sensor Support ๐Ÿ“Š - DHT11 + BMP280 for redundancy
  • Real-time Monitoring โฑ๏ธ - Live temperature and humidity updates
  • Zero Configuration โœจ - Automatic HomeKit discovery and pairing

๐Ÿš€ Features

๐Ÿ  Apple HomeKit Native

  • No Bridge Required: Direct HomeKit accessory (not Homebridge!)
  • Home App Integration: Shows up automatically in iOS/macOS Home app
  • Siri Compatible: "Hey Siri, what's the temperature in the living room?"
  • Automation Ready: Trigger scenes based on temperature/humidity thresholds

๐ŸŒก๏ธ Professional Sensors

  • DHT11 Sensor: Temperature (-40ยฐC to +80ยฐC) & Humidity (5%-95%)
  • BMP280 Sensor: High-precision temperature backup & atmospheric pressure
  • Sensor Redundancy: Automatically switches between sensors for reliability
  • Calibrated Readings: Factory-calibrated sensors for accuracy

โšก Smart Features

  • Auto-Discovery: Appears in HomeKit setup automatically
  • Low Power: Efficient ESP8266 implementation
  • OTA Updates: Over-the-air firmware updates (future feature)
  • Status LED: Visual feedback for connection status

๐Ÿ“ฑ HomeKit Benefits

  • Multi-Device Access: iPhone, iPad, Mac, Apple Watch, Apple TV
  • Secure Connection: End-to-end encryption via HomeKit protocol
  • Remote Access: Control from anywhere via Apple TV/HomePod hub
  • Automation Engine: Create complex scenes and automations

๐Ÿ“ฑ HomeKit Setup

๐Ÿ” Adding to Home App

  1. Open Home App on your iPhone/iPad
  2. Tap "+" โ†’ Add Accessory
  3. Scan QR Code or enter setup code manually
  4. Follow Setup Wizard - Name your station and assign to a room

๐Ÿ“Š What You'll See

๐Ÿ  Home App Display:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Meteo Station        โ”‚
โ”‚  ๐ŸŒก๏ธ 23.4ยฐC   ๐Ÿ’ง 65%     /
โ”‚     Living Room         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽ™๏ธ Siri Commands

  • "Hey Siri, what's the temperature?"
  • "Hey Siri, what's the humidity in the living room?"
  • "Hey Siri, is it humid inside?"

๐Ÿ  Automation Ideas

  • Turn on humidifier when humidity < 40%
  • Send notifications when temperature exceeds 26ยฐC
  • Control smart thermostat based on room temperature
  • Turn on fans when humidity > 70%

๐Ÿ”ง Installation

๐Ÿ“ฆ Hardware Requirements

Component Model Purpose Price
Microcontroller ESP8266 (NodeMCU/Wemos D1) Main controller ~$3
Temperature/Humidity DHT11 Primary sensor ~$2
Pressure/Temp Backup BMP280 Secondary sensor ~$3
Breadboard Half-size Prototyping ~$2
Jumper Wires Male-to-Male Connections ~$2
Power Supply USB 5V 1A Power source ~$3

๐Ÿ’ฐ Total Project Cost: ~$15

๐Ÿ”Œ Wiring Diagram

ESP8266 NodeMCU  โ†’  DHT11 Sensor
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
3.3V             โ†’  VCC
GND              โ†’  GND  
D5 (GPIO14)      โ†’  DATA

ESP8266 NodeMCU  โ†’  BMP280 Sensor
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
3.3V             โ†’  VCC
GND              โ†’  GND
D1 (GPIO5)       โ†’  SCL
D2 (GPIO4)       โ†’  SDA

๐Ÿ’ป Software Setup

1. Prerequisites

# Install PlatformIO
pip install platformio

# Or use VS Code with PlatformIO extension

2. Clone & Configure

git clone https://github.com/Arsalan134/AppleHome-TempHumidity.git
cd AppleHome-TempHumidity

3. WiFi Configuration

Create src/wifi_info.h:

#ifndef WIFI_INFO_H_
#define WIFI_INFO_H_

const char* wifi_ssid = "YourWiFiName";
const char* wifi_password = "YourWiFiPassword";

#endif

4. Build & Upload

# Build the project
pio run

# Upload to ESP8266
pio run --target upload

# Monitor serial output
pio device monitor --baud 115200

๐Ÿ“Š Sensors

๐ŸŒก๏ธ DHT11 Temperature & Humidity

  • Temperature Range: -40ยฐC to +80ยฐC (ยฑ2ยฐC accuracy)
  • Humidity Range: 5% to 95% RH (ยฑ5% accuracy)
  • Response Time: 6-15 seconds
  • Power: 3-5V, 2.5mA max current

๐ŸŒ BMP280 Pressure & Temperature

  • Temperature Range: -40ยฐC to +85ยฐC (ยฑ1ยฐC accuracy)
  • Pressure Range: 300-1100 hPa (ยฑ1 hPa accuracy)
  • Interface: I2C/SPI (using I2C)
  • Power: 1.71-3.6V, 2.7ฮผA current

๐Ÿ”„ Sensor Redundancy Logic

// Smart sensor switching for reliability
if (dht_reading_valid) {
    use_dht11_temperature();
} else {
    fallback_to_bmp280_temperature();
}

๐Ÿ› ๏ธ Configuration

โš™๏ธ HomeKit Settings

Located in my_accessory.c:

// Customize your device info
HOMEKIT_CHARACTERISTIC(NAME, "Meteo Station"),
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "Arsalan"),
HOMEKIT_CHARACTERISTIC(MODEL, "MyTemperatureSensor"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "1.0"),

๐Ÿ“ก Update Intervals

// Adjust reporting frequency (in main.cpp)
static uint32_t next_report_millis = 0;
const uint32_t REPORT_INTERVAL = 10000; // 10 seconds

๐Ÿ”ง Pin Configuration

// Change sensor pins if needed
#define DHTPIN D5        // DHT11 data pin
// BMP280 uses I2C: D1(SCL), D2(SDA)

๐Ÿ” Troubleshooting

โ— Common Issues

Problem Solution
Device not found in Home app Check WiFi connection, reset HomeKit pairing
"No Response" in Home app Verify ESP8266 is powered and connected to WiFi
Inaccurate readings Check sensor wiring, ensure proper power supply
Constant sensor errors Verify DHT11 connections, try different pins

๐Ÿ”„ Reset HomeKit Pairing

// Add this to setup() function
homekit_storage_reset(); // Clears existing HomeKit pairings

๐Ÿ“Š Serial Debug Output

Temperature: 23.4ยฐC
Humidity: 65.2%
HomeKit client connected
Characteristic updated: Temperature

๐ŸŽฏ Advanced Features

๐Ÿ”ฎ Future Enhancements

  • OTA Updates: Wireless firmware updates
  • Web Interface: Browser-based configuration
  • Data Logging: Store historical data to SD card
  • Multiple Sensors: Support for additional sensor types
  • Battery Power: Low-power mode for battery operation

๐Ÿ—๏ธ Hardware Expansions

  • Display Module: OLED/LCD for local readings
  • External Antenna: Better WiFi range
  • Weatherproof Case: Outdoor installation
  • Solar Panel: Self-powered operation

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

๐Ÿ› ๏ธ Development Areas

  • ๐Ÿ”ง Add support for more sensor types (DHT22, SHT30, etc.)
  • ๐Ÿ“ฑ Improve HomeKit integration features
  • โšก Optimize power consumption
  • ๐ŸŒ Add web-based configuration interface
  • ๐Ÿ“Š Implement data logging capabilities

๐Ÿ“ How to Contribute

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐ŸŽ HomeKit Compatibility

This project uses the open-source HomeKit implementation and is compatible with Apple's HomeKit ecosystem without requiring MFi certification.


๐Ÿ™‹โ€โ™‚๏ธ Author

Arsalan Iravani


๐Ÿš€ About Me

I'm an iOS Developer and Smart Home Enthusiast passionate about bridging Apple's ecosystem with custom hardware. This project showcases the power of native HomeKit integration without expensive commercial solutions.

Other Projects: ๐Ÿ“ฑ iOS Apps โ€ข ๐Ÿ  HomeKit Accessories โ€ข ๐Ÿš— Automotive Electronics โ€ข ๐Ÿ›ฉ๏ธ Drone Technology


๐Ÿ”— Related Projects


๐ŸŒŸ Star this repo if you found it helpful! ๐ŸŒŸ

Made with โค๏ธ and lots of โ˜• for the Apple HomeKit community

"The best smart home is the one that works seamlessly with your existing devices"

About

๐Ÿ ๐ŸŒก๏ธ Apple HomeKit Temperature & Humidity Station

Resources

License

Stars

Watchers

Forks