Skip to content

Latest commit

 

History

1,760 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HomematicIP REST API

A Python 3 wrapper for the homematicIP REST API (Access Point Based) Since there is no official documentation about this API everything was done via reverse engineering. Use at your own risk.

Any help from the community through e.g. pull requests would be highly appreciated.

PyPI download month PyPI version fury.io Discord Tests Coverage PyPI - Python Version License

Using Home Assistant?

Home Assistant's Homematic IP Cloud integration is built on this library. If your question is about entities, devices or automations inside Home Assistant, start with the integration documentation. This README is about the library itself and its command line tools.

A device has to be supported here before Home Assistant can expose it, so if your device is missing entirely, see New devices and config dump.

Get Help / Discord

If you want to get in contact with me or need help with the library, you can get in touch with me via discord. There is a discord server and my discord tag is agonist#6159

📖 Documentation

The documentation is at https://hahn-th.github.io/homematicip-rest-api and is generated from the docs/ folder of this repository. It covers getting started, the API reference and the changelog.

Support me

❤️ If you want to say thank you or want to support me, you can do that via PayPal. https://paypal.me/thomas08154711

Thanks

Kudos and a big thank you to @coreGreenberet, who created this library.

Installation

To install the package, run:

pip install -U homematicip

Usage

Generate a token

If you are about to connect to a HomematicIP HCU1 you have to press the button on top of the device, before running the script. From now, you have 5 Minutes to complete the registration process.

After that, run hmip_generate_auth_token (from the command line) to get an auth token for your access point. It will generate a config.ini in your current directory.

Use the CLI

You can send commands to homematicIP using the hmip_cli script. To get an overview, use -h or --help param. To address devices, use the argument -d in combination with the 24-digit ID (301400000000000000000000) from --list-devices.

A few examples:

  • hmip_cli --help to get help
  • hmip_cli --list-devices to get a list of your devices.
  • hmip_cli -d <id-from-device-list> --toggle-garage-door to toggle the garage door with HmIP-WGC.
  • hmip_cli --list-events to listen to events and changes in your homematicIP system
  • hmip_cli -d <id> --set-lock-state LOCKED --pin 1234 to lock a door with HmIP-DLD
  • hmip_cli --dump-configuration --anonymize to dump the current config and anonymize it.

Examples

All examples assume a config.ini created by hmip_generate_auth_token, see Paths for config.ini for where it is looked up.

Connect and list your devices:

import homematicip
from homematicip.home import Home

config = homematicip.find_and_load_config_file()

home = Home()
home.init(config.access_point, config.auth_token)
home.get_current_state()

for device in home.devices:
    print(f"{device.id}  {device.label}  ({device.modelType})")

Read a value. Devices are containers; the readings live on their functional channels, and which channel carries what depends on the device:

device = home.search_device_by_id("3014F711A000000000000001")

for channel in device.functionalChannels:
    print(channel.index, channel.functionalChannelType)

# on a wall thermostat, channel 1 is the WALL_MOUNTED_THERMOSTAT_PRO_CHANNEL
print(device.functionalChannels[1].actualTemperature)

Switch something on. The write methods live on the device and on the channel:

device = home.search_device_by_id("3014F711A000000000000001")
device.turn_on()

The library is async underneath. Every method has an _async counterpart, and Home wraps those for synchronous use. In an async application use AsyncHome directly:

import asyncio

import homematicip
from homematicip.async_home import AsyncHome


async def main():
    config = homematicip.find_and_load_config_file()

    home = AsyncHome()
    await home.init_async(config.access_point, config.auth_token)
    await home.get_current_state_async()

    for device in home.devices:
        print(device.label)


asyncio.run(main())

Events

It is also possible to receive push notifications over a websocket connection. Events are only delivered while the connection is open, so this has to run inside an event loop:

import asyncio

import homematicip
from homematicip.async_home import AsyncHome


def print_events(event_list):
    for event in event_list:
        print(f"EventType: {event['eventType']} Data: {event['data']}")


async def main():
    config = homematicip.find_and_load_config_file()

    home = AsyncHome()
    await home.init_async(config.access_point, config.auth_token)
    await home.get_current_state_async()

    home.onEvent += print_events
    await home.enable_events()

    try:
        while True:
            await asyncio.sleep(1)
    finally:
        await home.disable_events_async()


asyncio.run(main())

Paths for config.ini

The scripts will look for a config.ini in 3 different locations depending on your OS. Copy the file to one of these locations so that it will be accessible for the scripts.

  • General
    • current working directory
  • Windows
    • %APPDATA%\homematicip-rest-api
    • %PROGRAMDATA%\homematicip-rest-api
  • Linux
    • ~/.homematicip-rest-api/
    • /etc/homematicip-rest-api/
  • MAC OS
    • ~/Library/Preferences/homematicip-rest-api/
    • /Library/Application Support/homematicip-rest-api/

New devices and config dump

If your device is missing from the list below, or is listed but does not do what you need, open an issue with a configuration dump attached. A dump is what makes a device implementable without owning the hardware.

From Home Assistant, which is the shortest path if you use it: open Settings > Devices & services > Homematic IP Cloud, use the three-dot menu next to your access point and choose Download diagnostics. The result is already redacted and contains everything needed.

From this library, if you have it set up:

hmip_cli --dump-configuration --anonymize

--anonymize replaces the identifying values with placeholders: every GUID, every SGTIN serial number, the refresh token, and your city and coordinates. It does not touch the names you gave your devices and groups, so check the output before posting it publicly.

Please include:

  • the model number as printed on the device, for example HmIP-WGRC
  • what the device should do that the library cannot do yet
  • the dump itself, as a gist if it is long

Device support

A checked box means the model is mapped to a device class here, so its readings and commands are available. An unchecked box means the model is known but not implemented, usually because nobody has sent a dump for it yet, see New devices and config dump.

Radio and wired devices are in one list; wired models carry the HMIPW prefix. Entries marked *powered by HmIP are third-party devices speaking the Homematic IP protocol.

  • ALPHA-IP-RBG (Alpha IP Wall Thermostat Display)
  • ALPHA-IP-RBGa (Alpha IP Wall Thermostat Display analog)
  • ELV-SH-AI8 (Alarmline Interface 8x Inputs) *powered by HmIP
  • ELV-SH-BS2 (Switch Actuator for brand switches 2x channels) *powered by HmIP
  • ELV-SH-CTH (Temperature and Humidity Sensor Compact) *powered by HmIP
  • ELV-SH-CTV Tilt Vibration Sensor Compact
  • ELV-SH-GVI (Garden valve interface) *powered by HmIP
  • ELV-SH-IRS8 (Infrared Remote control - 8x channels) *powered by HmIP
  • ELV-SH-PSMCI (Switch Measuring Cable Indoor) *powered by HmIP
  • ELV-SH-PTI2 (Temperature Difference Sensor 2 - Platin) *powered by HmIP
  • ELV-SH-SB8 (Status Board) *powered by HmIP
  • ELV-SH-SMSI (Soil Moisture Sensor Interface) *powered by HmIP
  • ELV-SH-SPS25 (Switchable Power Supply) *powered by HmIP
  • ELV-SH-SW1-BAT (2x Actuator Switch for 30V/1A with 2xAA Batteries) *powered by HmIP
  • ELV-SH-TACO (Temperature, Tilt and Vibration Sensor) *powered by HmIP
  • ELV-SH-WSC (2x Servo Controls, 5v - 12V) *powered by HmIP
  • ELV-SH-WSM (Watering Actuator) *powered by HmIP
  • ELV-SH-WUA (Dimming Actuator, 0-10/1-10-V-Control inputs, 8A 230V) *powered by HmIP
  • HMIP-ASIR (Alarm Siren - indoor)
  • HMIP-ASIR-2 (Alarm Siren - indoor) New Version
  • HMIP-ASIR-B1 (Alarm Siren - indoor) Silvercrest Edition
  • HMIP-ASIR-O (Alarm Siren - outdoor)
  • HMIP-BBL (Blind Actuator for brand switches)
  • HMIP-BBL-2 (Blind Actuator for brand switches) New Version
  • HMIP-BDT (Dimming Actuator for brand switches)
  • HMIP-BRC2 (Remote Control for brand switches – 2x channels)
  • HMIP-BROLL (Shutter Actuator - brand-mount)
  • HMIP-BROLL-2 (Shutter Actuator - brand-mount) New Version
  • HMIP-BSL (Switch Actuator for brand switches – with signal lamp)
  • HMIP-BSM (Brand Switch and Meter Actuator)
  • HMIP-BSM-I (Brand Switch and Meter Actuator, International)
  • HMIP-BWTH (Wall Thermostat Display with switching output – for brand switches, 230V)
  • HMIP-BWTH24 (Wall Thermostat Display with switching output – for brand switches, 24V)
  • HMIP-DBB (Doorbell Push-Button)
  • HMIP-DLD (Door Lock Drive)
  • HMIP-DLP (Door Lock Drive Pro)
  • HMIP-DLS (Door Lock Sensor)
  • HMIP-DRBLI4 (Blind Actuator for DIN rail mount – 4 channels)
  • HMIP-DRDI3 (Dimming Actuator Inbound 230V – 3x channels, 200W per channel) electrical DIN rail
  • HmIP-DRG-DALI (Dali Gateway - readonly at the moment)
  • HMIP-DRSI1 (Switch Actuator for DIN rail mount – 1x channel)
  • HMIP-DRSI4 (Switch Actuator for DIN rail mount – 4x channels)
  • HMIP-DSD-PCB (Door Signal Detector PCB)
  • HMIP-ESI (Energy Sensors Interface)
  • HMIP-eTRV (Heating-Thermostat with Display)
  • HMIP-eTRV-2 (Heating-Thermostat with Display) New Version
  • HMIP-eTRV-2 I9F (Heating-Thermostat with Display) New Version
  • HMIP-eTRV-2-UK (UK Version not tested, but it should work)
  • HMIP-eTRV-3 (Heating-Thermostat pure, white)
  • HMIP-eTRV-B (Heating-Thermostat basic with Display)
  • HMIP-eTRV-B-2 (Heating-Thermostat basic with Display) New Version
  • HMIP-eTRV-B-2 R4M (Heating-Thermostat basic with Display) New Version
  • HMIP-eTRV-B-UK (UK Version not tested, but it should work)
  • HMIP-eTRV-B1 (Heating-Thermostat basic with Display) Silvercrest Edition
  • HMIP-eTRV-C (Heating-Thermostat compact without display)
  • HMIP-eTRV-C-2 (Heating-Thermostat compact without display) New Version
  • HmIP-eTRV-CL (Heating-thermostat compact with display)
  • HMIP-eTRV-E (Heating-Thermostat Design Evo New Generation, white)
  • HMIP-eTRV-E-A (Heating-Thermostat Design Evo New Generation, anthracite)
  • HMIP-eTRV-E-S (Heating-Thermostat Design Evo New Generation, silver)
  • HMIP-eTRV-F (Heating-Thermostat flex, white)
  • HMIP-FAL230-C10 (Floor Heating Actuator – 10x channels, 230V)
  • HMIP-FAL230-C6 (Floor Heating Actuator – 6x channels, 230V)
  • HMIP-FAL24-C10 (Floor Heating Actuator – 10x channels, 24V)
  • HMIP-FAL24-C6 (Floor Heating Actuator – 6x channels, 24V)
  • HMIP-FALMOT-C12 (Floor Heating Actuator – 12x channels, motorised)
  • HMIP-FALMOT-C8 (Floor Heating Actuator – 8x channels, motorised)
  • HMIP-FBL (Blind Actuator - flush-mount)
  • HMIP-FCI1 (Contact Interface flush-mount – 1x channel)
  • HMIP-FCI6 (Contact Interface flush-mount – 6x channels)
  • HMIP-FDC (Full Flush Door Controller / Türöffner-Aktor)
  • HMIP-FDT (Dimming Actuator - flush-mount)
  • HMIP-FLC (Full Flush Lock Controller)
  • HMIP-FROLL (Shutter Actuator - flush-mount)
  • HMIP-FSI16 (Switch Actuator with Push-button Input 230V, 16A)
  • HMIP-FSI6 (Full Flush Input Switch Compact)
  • HMIP-FSM (Switch Actuator and Meter 5A – flush-mount)
  • HMIP-FSM16 (Switch Actuator and Meter 16A – flush-mount)
  • HMIP-FWI (Wiegand Interface)
  • HMIP-HAP (Cloud Access Point)
  • HMIP-HAP-B1 (Cloud Access Point) Silvercrest Edition
  • HMIP-HAP2 (Access Point 2)
  • HMIP-HCU (Home Control Unit)
  • HMIP-HDM1 (Hunter Douglas & erfal window blinds)
  • HMIP-HDRC (Hunter Douglas & erfal window blinds remote control)
  • HMIP-K-DRBLI4 (Blinds Actuator – 4x channels, 230V, 2,2A / 500W per channel) electrical DIN rail
  • HMIP-K-DRDI3 (Dimming Actuator Inbound 230V – 3x channels, 200W per channel) electrical DIN rail
  • HMIP-K-DRSI1 (Actuator Inbound 230V – 1x channel) electrical DIN rail
  • HMIP-K-DRSI4 (Switch Actuator – 4x channels, 16A per channel) electrical DIN rail
  • HmIP-KRC-K (Key Ring Remote Control for KeyMatic - 4x buttons)
  • HMIP-KRC4 (Key Ring Remote Control - 4x buttons)
  • HMIP-KRCA (Key Ring Remote Control & Alarm)
  • HMIP-LSC (Light Strip Controller)
  • HMIP-MIO16-PCB (Multi Analog/Digital Interface - Switch Circuit Board)
  • HMIP-MIOB (Multi IO Box for floor heating & cooling)
  • HMIP-MOD-HO (Garage Door Module for Hörmann)
  • HMIP-MOD-OC8 (Open Collector Module Receiver - 8x)
  • HMIP-MOD-RC8 (Open Collector Module Sender - 8x)
  • HMIP-MOD-TM (Garage Door Module for Novoferm and Tormatic door operators)
  • HMIP-MP3P (Combination Signalling Device MP3)
  • HMIP-P-DRG-DALI (DALI Lights Gateway)
  • HMIP-PCBS (Switch Circuit Board - 1x channel)
  • HMIP-PCBS-BAT (Switch Circuit Board with Battery - 1x channel)
  • HMIP-PCBS2 (Switch Circuit Board - 2x channels)
  • HMIP-PDT (Plugable Dimmer)
  • HMIP-PDT-UK (UK Version not tested, but it should work)
  • HMIP-PMFS (Plugable Power Supply Monitoring)
  • HMIP-PS (Plugable Switch)
  • HMIP-PS-2 (Plugable Switch) New Version
  • HMIP-PSM (Plugable Switch Measuring, Type F - Standard for Homematic)
  • HMIP-PSM-2 (Plugable Switch Measuring, Type F - Standard for Homematic) New Version
  • HMIP-PSM-CH (Plugable Switch Measuring, Type J)
  • HMIP-PSM-IT (Type L not tested, but it should work)
  • HMIP-PSM-PE (Type E not tested, but it should work)
  • HMIP-PSM-UK (Type G not tested, but it should work)
  • HMIP-PSMCO (Schalt-Mess-Kabel – außen)
  • HMIP-RC8 (Remote Control - 8x buttons)
  • HMIP-RCB1 (Remote Control - 1x button)
  • HMIP-RGBW (RGB Led Controller - Readonly at the moment)
  • HMIP-SAM (Acceleration Sensor)
  • HMIP-SCI (Contact Interface Sensor)
  • HMIP-SCTH230 (CO2, Temperature and Humidity Sensor 230V)
  • HMIP-SFD (Fine Dust Sensor)
  • HMIP-SLO (Light Sensor - outdoor)
  • HMIP-SMI (Motion Detector with Brightness Sensor - indoor)
  • HMIP-SMI55 (Motion Detector with Brightness Sensor and Remote Control - 2x buttons)
  • HMIP-SMI55-2 (Motion Detector with Brightness Sensor and Remote Control - 2x buttons) New Version
  • HMIP-SMO (Motion Detector with Brightness Sensor - outdoor)
  • HMIP-SMO-2 (Motion Detector with Brightness Sensor - outdoor) New Version
  • HMIP-SMO-A (Motion Detector with Brightness Sensor - outdoor, anthracite)
  • HMIP-SMO-A-2 (Motion Detector with Brightness Sensor - outdoor, anthracite) New Version
  • HmIP-SMO230-A
  • HMIP-SPDR (Passage Sensor with Direction Recognition)
  • HMIP-SPI (Presence Sensor - indoor)
  • HMIP-SRD (Rain Sensor)
  • HMIP-SRH (Window Rotary Handle Sensor)
  • HMIP-STE2-PCB (Temperature Difference Sensors - 2x sensors)
  • HMIP-STH (Temperature and Humidity Sensor without display - indoor)
  • HMIP-STHD (Temperature and Humidity Sensor with display - indoor)
  • HMIP-STHO (Temperature and Humidity Sensor - outdoor)
  • HMIP-STHO-A (Temperature and Humidity Sensor – outdoor, anthracite)
  • HMIP-STV (Inclination and vibration Sensor)
  • HMIP-SWD (Water Sensor)
  • HMIP-SWDM (Door / Window Contact - magnetic)
  • HMIP-SWDM-2 (Door / Window Contact - magnetic) New Version
  • HMIP-SWDM-B2 (Door / Window Contact - magnetic) Silvercrest Edition
  • HMIP-SWDO (Shutter Contact Optical)
  • HMIP-SWDO-2 (Shutter Contact Optical) New Version
  • HMIP-SWDO-I (Shutter Contact Optical Invisible)
  • HMIP-SWDO-PL (Shutter Contact Optical Plus)
  • HMIP-SWDO-PL-2 (Shutter Contact Optical Plus) New Version
  • HMIP-SWO-B (Weather Sensor - Basic)
  • HMIP-SWO-PL (Weather Sensor – Plus)
  • HMIP-SWO-PR (Weather Sensor – Pro)
  • HMIP-SWSD (Smoke Detector)
  • HMIP-SWSD-2 (Smoke Detector with Siren)
  • HMIP-USBSM (USB Switching Measurement Actuator)
  • HMIP-WGC (Garage Door Button)
  • HMIP-WGT (Wall Thermostat with Glass Display)
  • HMIP-WGTC (Wall Mounted Glass Thermostat with Carbon Dioxide Sensor)
  • HMIP-WHS2 (Switch Actuator for heating systems – 2x channels)
  • HMIP-WKP (Keypad)
  • HMIP-WLAN-HAP (WLAN Access Point)
  • HmIP-WLAN-HAP-B
  • HMIP-WRC2 (Wall-mount Remote Control - 2x buttons)
  • HMIP-WRC6 (Wall-mount Remote Control - 6x buttons)
  • HmIP-WRC6-230 (Wall-mount Remote Control - 6x buttons, 230V, with LED)
  • HMIP-WRCC2 (Wall-mount Remote Control – flat)
  • HMIP-WRCD (Wall-mount Remote Control - E-Paper-Status display)
  • HMIP-WRCR (Wall-mount Remote Control - Rotary)
  • HMIP-WT (Wall Mounted Thermostat without adjusting wheel) #probably only prototype for WTH-B and was not released
  • HMIP-WTH (Wall Mounted Thermostat Pro with Display)
  • HMIP-WTH-1 (Wall Mounted Thermostat Pro with Display Newest Version - successor of WTH-2 - really)
  • HMIP-WTH-2 (Wall Mounted Thermostat Pro with Display)
  • HMIP-WTH-B (Wall Mounted Thermostat basic without adjusting wheel)
  • HMIP-WTH-B-2 (Wall Mounted Thermostat basic without adjusting wheel) New Version
  • HMIP-WUA (Dimming Actuator, 0-10/1-10-V-Control inputs, 8A 230V)
  • HMIPW-BRC2 (Homematic IP Wired Remote Control for brand switches – 2x channels)
  • HMIPW-DRAP (Homematic IP Wired Access Point)
  • HMIPW-DRBL4 (Homematic IP Wired Blinds Actuator – 4x channels)
  • HMIPW-DRD3 (Homematic IP Wired Dimming Actuator – 3x channels)
  • HMIPW-DRI16 (Homematic IP Wired Inbound module – 16x channels)
  • HMIPW-DRI32 (Homematic IP Wired Inbound module – 32x channels)
  • HMIPW-DRS4 (Homematic IP Wired Switch Actuator – 4x channels)
  • HMIPW-DRS8 (Homematic IP Wired Switch Actuator – 8x channels)
  • HMIPW-FAL230-C10 (Homematic IP Wired Floor Heating Actuator – 10x channels, 230V)
  • HMIPW-FAL230-C6 (Homematic IP Wired Floor Heating Actuator – 6x channels, 230V)
  • HMIPW-FAL24-C10 (Homematic IP Wired Floor Heating Actuator – 10x channels, 24V)
  • HMIPW-FAL24-C6 (Homematic IP Wired Floor Heating Actuator – 6x channels, 24V)
  • HMIPW-FALMOT-C12 (Homematic IP Wired Floor Heating Actuator – 12x channels, motorised)
  • HMIPW-FIO6 (Homematic IP Wired IO Module flush-mount – 6x channels)
  • HMIPW-SCTHD (Homematic IP Wired CO2, Temperature and Humidity Sensor with Display)
  • HMIPW-SMI55 (Homematic IP Wired Motion Detector with Brightness Sensor and Remote Control - 2x buttons)
  • HMIPW-SPI (Homematic IP Wired Presence Sensor - indoor)
  • HMIPW-STH (Homematic IP Wired Temperature and Humidity Sensor without display - indoor)
  • HMIPW-STHD (Homematic IP Wired Temperature and Humidity Sensor with display - indoor)
  • HMIPW-WGD (Homematic IP Wired Wall-mount Glas Display - black edition)
  • HMIPW-WGD-PL (Homematic IP Wired Wall-mount Glas Display Play - black edition)
  • HMIPW-WRC2 (Homematic IP Wired Wall-mount Remote Control - 2x channels)
  • HMIPW-WRC6 (Homematic IP Wired Wall-mount Remote Control - 6x channels)
  • HMIPW-WTH (Homematic IP Wired Wall Mounted Thermostat Pro with Display)

About

A python wrapper for the homematicIP REST API (Access Point Based)

Topics

Resources

Code of conduct

Stars

239 stars

Watchers

27 watching

Forks

Releases

Packages

Used by

Contributors

Languages