fhempy


Namefhempy JSON
Version 0.1.727 PyPI version JSON
download
home_pagehttps://github.com/fhempy/fhempy
SummaryPython binding for FHEM to support Python modules
upload_time2024-03-16 08:07:06
maintainer
docs_urlNone
authorDominik Karall
requires_python>=3.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Download](https://img.shields.io/pypi/dm/fhempy)](https://pypistats.org/packages/fhempy)
[![python](https://img.shields.io/badge/python-3.9+-critical)](https://github.com/fhempy/fhempy)
[![Version](https://img.shields.io/pypi/v/fhempy)](https://pypi.org/project/fhempy/)
[![LastCommit](https://img.shields.io/github/last-commit/fhempy/fhempy)](https://github.com/fhempy/fhempy/commits/master)
[![BuyCoffee](https://img.shields.io/badge/buycoffee-thx-blue)](https://paypal.me/todominik)

# Attention (12/2023)
Please make sure that you have python3-venv installed before you do an update!

`sudo apt install python3-venv`

# fhempy

fhempy allows the usage of Python 3 (NOT 2!) language to write FHEM modules. Python 3.9 or higher is required, therefore I recommend using bullseye.

This repository includes following working modules:

|Module | Description|
|-------|--------------|
|[aktionsfinder](FHEM/bindings/python/fhempy/lib/aktionsfinder/)|Keep informed about product promotions|
|[arp_presence](FHEM/bindings/python/fhempy/lib/arp_presence/)|ARP based presence detection, works also for iOS|
|[ble_monitor](FHEM/bindings/python/fhempy/lib/ble_monitor/README.md)|Supports a lot of BLE devices|
|[ble_presence](FHEM/bindings/python/fhempy/lib/ble_presence/README.md)|Presence detection incl. RSSI for Bluetooth Low Energy|
|[ble_reset](FHEM/bindings/python/fhempy/lib/ble_reset/README.md)|Resets all Bluetooth interfaces every X hours|
|[bt_presence](FHEM/bindings/python/fhempy/lib/bt_presence/README.md)|Presence detection incl. RSSI for Bluetooth|
|[blue_connect](FHEM/bindings/python/fhempy/lib/blue_connect/README.md)|Blue Connect|
|[ddnssde](FHEM/bindings/python/fhempy/lib/ddnssde/)|Dynamic DNS updater for free ddnss.de service|
|discover_mdns|Discover mDNS (e.g. googlecast) devices|
|discover_ble|Discover Bluetooth LE devices|
|discover_upnp|Discover UPnP devices|
|dlna_dmr|Control DLNA MediaRenderer devices|
|[energie_gv_at](FHEM/bindings/python/fhempy/lib/energie_gv_at/)|Retrieve current Austrian energy status|
|[eq3bt](FHEM/bindings/python/fhempy/lib/eq3bt/README.md)|Control EQ3 Bluetooth thermostat|
|[erelax_vaillant](FHEM/bindings/python/fhempy/lib/erelax_vaillant/README.md)|Control eRelax Vaillant|
|[esphome](FHEM/bindings/python/fhempy/lib/esphome/README.md)|Installs and starts the ESP Home dashboard for easy ESP Home device management|
|[fusionsolar](FHEM/bindings/python/fhempy/lib/fusionsolar/README.md)|Retrieve data from FusionSolar|
|[geizhals](FHEM/bindings/python/fhempy/lib/geizhals/README.md)|Retrieve prices from geizhals|
|gfprobt|Control GF Pro Bluetooth irrigation control|
|[github_backup](FHEM/bindings/python/fhempy/lib/github_backup/)|Backup FHEM config to github|
|[github_restore](FHEM/bindings/python/fhempy/lib/github_restore/)|Restore FHEM config from github|
|[goodwe](FHEM/bindings/python/fhempy/lib/goodwe/)|Get data from GoodWe inverters|
|[googlecast](FHEM/bindings/python/fhempy/lib/googlecast/README.md)|Control Cast devices and stream Spotify|
|[google_weather](FHEM/bindings/python/fhempy/lib/google_weather/README.md)|Retrieve weather from Google|
|[gree_climate](FHEM/bindings/python/fhempy/lib/gree_climate/README.md)|Control gree HVAC devices|
|helloworld|Hello World example for developers to start writing their own module|
|[homekit](FHEM/bindings/python/fhempy/lib/homekit/README.md)|Control homekit devices|
|[huawei_modbus](FHEM/bindings/python/fhempy/lib/huawei_modbus/)|Retrieve data from Huawei inverter, requires Python 3.10 or higher|
|[ikos](FHEM/bindings/python/fhempy/lib/ikos/README.md)|Check prices for ikos resorts|
|[kia_hyundai](FHEM/bindings/python/fhempy/lib/kia_hyundai/README.md)|Control your Kia/Hyundai car|
|[meross](FHEM/bindings/python/fhempy/lib/meross/README.md)|Control Meross devices|
|[miscale](FHEM/bindings/python/fhempy/lib/miscale/README.md)|Xiaomi Mi Scale V1/2 support|
|[miflora](FHEM/bindings/python/fhempy/lib/miflora/README.md)|Xiaomi BLE Plant Sensor|
|[miio](FHEM/bindings/python/fhempy/lib/miio/README.md)|Control Xiaomi WiFi devices|
|[mitemp](FHEM/bindings/python/fhempy/lib/mitemp/README.md)|Xiaomi BLE Temperature/Humidity Sensor|
|[mqtt_ha_discovery](FHEM/bindings/python/fhempy/lib/mqtt_ha_discovery/)|Support HomeAssistant MQTT discovery|
|[nefit](FHEM/bindings/python/fhempy/lib/nefit/README.md)|Control nefit devices|
|[nespresso_ble](FHEM/bindings/python/fhempy/lib/nespresso_ble/README.md)|Nespresso Bluetooth coffee machine|
|[object_detection](FHEM/bindings/python/fhempy/lib/object_detection/README.md)|TensorFlow Lite object detection|
|[piclock](FHEM/bindings/python/fhempy/lib/piclock/README.md)|Create a LED clock with MAX7219|
|[prusalink](FHEM/bindings/python/fhempy/lib/prusalink/README.md)|Prusa 3D printer, requires Python 3.10 or higher|
|[pyit600](FHEM/bindings/python/fhempy/lib/pyit600/README.md)|Control Salus iT600 devices|
|[rct_power](FHEM/bindings/python/fhempy/lib/rct_power/README.md)|RCT Power inverter|
|[ring](FHEM/bindings/python/fhempy/lib/ring/README.md)|Ring doorbell/chime/cam|
|[tibber](FHEM/bindings/python/fhempy/lib/tibber/README.md)|Get consumption data from tibber|
|[seatconnect](FHEM/bindings/python/fhempy/lib/seatconnect/README.md)|Control your Seat/Cupra car|
|[spotify](FHEM/bindings/python/fhempy/lib/spotify/README.md)|Control Spotify Connect and use FHEM as Spotify Connect player|
|[skodaconnect](FHEM/bindings/python/fhempy/lib/skodaconnect/README.md)|Control your skoda car|
|[tuya](FHEM/bindings/python/fhempy/lib/tuya/README.md)|Recommended: Control tuya devices localy incl. real-time updates (only WiFi devices)|
|[tuya_cloud](FHEM/bindings/python/fhempy/lib/tuya_cloud/README.md)|Control tuya devices via cloud incl. real-time updates (WiFi & ZigBee)|
|[tuya_smartlife](FHEM/bindings/python/fhempy/lib/tuya_smartlife/README.md)|Recommended: Control tuya devices via cloud incl. real-time updates (WiFi & ZigBee)|
|[warema](FHEM/bindings/python/fhempy/lib/warema/)|Control Warema devices|
|[websitetests](FHEM/bindings/python/fhempy/lib/websitetests/)|Do some basic website checks|
|[wienerlinien](FHEM/bindings/python/fhempy/lib/wienerlinien/README.md)|Wiener Linien departure times|
|[wienernetze_smartmeter](FHEM/bindings/python/fhempy/lib/wienernetze_smartmeter/)|Retrieve data from Wiener Netze smartmeter|
|[xiaomi_gateway3](FHEM/bindings/python/fhempy/lib/xiaomi_gateway3/README.md)|Xiaomi Gateway V3 (only V3\!)|
|[xiaomi_tokens](FHEM/bindings/python/fhempy/lib/xiaomi_tokens/README.md)|Retrieve all Xiaomi Tokens from Cloud|
|[volvo](FHEM/bindings/python/fhempy/lib/volvo/)|Retrieve infos from your Volvo car (only new API)|
|[volvo_software_update](FHEM/bindings/python/fhempy/lib/volvo_software_update/README.md)|Get notified about Volvo software updates|
|[zigbee2mqtt](FHEM/bindings/python/fhempy/lib/zigbee2mqtt/README.md)|Install, update and run Zigbee2MQTT server|

## Installation
Python >=3.9 is required, Python 2 won't work\!

### Console
#### Debian 11/12 (Bullseye/Bookworm)
Copy & paste this command if you are running Debian Bullseye.
```
sudo apt install python3 python3-pip python3-dev python3-venv libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libglib2.0-dev libdbus-1-dev bluez libbluetooth-dev git libprotocol-websocket-perl
```

#### Others
Use the following 2 commands if you run Debian 10 (Buster) or older (e.g. stretch, jessie, ...).
```
sudo apt install python3 python3-pip python3-dev libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libglib2.0-dev libdbus-1-dev bluez libbluetooth-dev git
```
```
sudo cpan Protocol::WebSocket
```

### FHEM
```
update add https://raw.githubusercontent.com/fhempy/fhempy/master/controls_pythonbinding.txt
```
```
update
```
```
shutdown restart
```
```
define fhempy_local BindingsIo fhempy
```

Wait a few minutes until fhempy is installed. **This might take up to 15 minutes!** fhempy_local will show up with a green circle when finished.
All further requirements are installed automatically via pip as soon as the specific module is used the first time.
 
## Usage in FHEM (examples)
This are just a few examples for some modules, please see the modules readme linked in the table above for more details
 - `define castdevice fhempy googlecast "Living Room"`
 - `define eq3bt fhempy eq3bt 00:11:22:33:44:66:77`
 - `define upnp fhempy discover_upnp`

## fhempy peers (e.g. extend Bluetooth range)
fhempy allows to run modules locally (same device as FHEM runs on) or on remote peers. Those remote peers only make sense if you want to extend the range of bluetooth or want to distribute the load of some modules to other more powerfull devices (e.g. video object detection).


### Peer setup (short version)
Only on remote peers, do not run this commands on the FHEM instance. Run this commands with user "pi".

```
### WARNING: DO THIS COMMAND ONLY ON REMOTE PEER, NOT ON YOUR FHEM INSTANCE ###
# systemd service installation
curl -sL https://raw.githubusercontent.com/fhempy/fhempy/master/install_systemd_fhempy.sh | sudo -E bash -
```

### Peer setup (long version)
Only needed if you didn't run Peer setup (short version). The following steps are only needed if you want to install fhempy on a remote peer, you should not run them on your FHEM installation.

- Setup virtual environment for fhempy: `python3 -m venv .fhempy/fhempy_venv`
- Activate venv: `source .fhempy/fhempy_venv/bin/activate`
- Install fhempy with user pi: `pip3 install --upgrade fhempy`
- Make sure your main fhempy instance (within FHEM) is running
- Test fhempy by just running it with user pi, type `fhempy` and enter. Wait a few seconds until it gets discovered and you see the incoming FHEM connection.
- Systemd configuration for autostart
  - `curl -sL https://raw.githubusercontent.com/fhempy/fhempy/master/install_systemd_fhempy.sh | sudo -E bash -`
  - fhempy is run with user pi, you can change that in the fhempy.service file in /etc/systemd/system/
- FHEM configuration
  - The remote peer is autodiscovered and will show up in FHEM as device e.g. fhempy_peer_192_168_1_50
  - You can move any device to the remote peer by changing the IODev of the device.
  - If autodiscovery doesn't work (it's based on zeroconf), you can define it with `define fhempy_peer_IP BindingsIo IP:15733 fhempy`

### Log file
`journalctl -u fhempy.service -f`

### Update
Just do `set remote_pybinding update` and the remote peer will install the new package via pip and restart afterwads.

## Functionality

### 10_BindingsIo
This module is a DevIo device which builds a language neutral communicaton bridge in JSON via websockets.
### 10_fhempyServer
This module just starts the fhempy server instance
### 10_fhempy
This module is used as the bridge to BindingsIo. It calls BindingsIo with IOWrite.
### fhempy
This is the Python server instance which handles JSON websocket messages from BindingsIo. Based on the message it executes the proper function and replies to BindingsIo via websocket.

### Call flow
This example shows how Define function is called from the Python module.
 1. define castdevice fhempy googlecast "Living Room"
 2. fhempy sends IOWrite to BindingsIo
 3. BindingsIo sends a JSON websocket message to fhempy
 4. fhempy loads the corresponding module (e.g. googlecast), creates an instance of the object (e.g. googlecast) and calls the Define function on that instance
 5. Define function is executed within the Python context, as long as the function is executed, FHEM waits for the answer the same way as it does for Perl modules
 6. Python Define returns the result via JSON via websocket to BindingsIo

At any time within the functions FHEM functons like readingsSingleUpdate(...) can be called by using the fhem.py module (fhem.readingsSingleUpdate(...)). There are just a few functions supported at the moment.

![Flow Chart](/flowchart.png)

## Write your own module
Check helloworld example for writing an own module. Be aware that no function which is called from FHEM is allowed to run longer than 1s. In general no blocking code should be used with asyncio. If you want to call blocking code, use utils.run_blocking.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/fhempy/fhempy",
    "name": "fhempy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Dominik Karall",
    "author_email": "dominik.karall@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/74/c7/4c8fa78eab3b532c62c474185131c5b49eb33d63e356edbc29b25a7adba9/fhempy-0.1.727.tar.gz",
    "platform": null,
    "description": "[![Download](https://img.shields.io/pypi/dm/fhempy)](https://pypistats.org/packages/fhempy)\n[![python](https://img.shields.io/badge/python-3.9+-critical)](https://github.com/fhempy/fhempy)\n[![Version](https://img.shields.io/pypi/v/fhempy)](https://pypi.org/project/fhempy/)\n[![LastCommit](https://img.shields.io/github/last-commit/fhempy/fhempy)](https://github.com/fhempy/fhempy/commits/master)\n[![BuyCoffee](https://img.shields.io/badge/buycoffee-thx-blue)](https://paypal.me/todominik)\n\n# Attention (12/2023)\nPlease make sure that you have python3-venv installed before you do an update!\n\n`sudo apt install python3-venv`\n\n# fhempy\n\nfhempy allows the usage of Python 3 (NOT 2!) language to write FHEM modules. Python 3.9 or higher is required, therefore I recommend using bullseye.\n\nThis repository includes following working modules:\n\n|Module | Description|\n|-------|--------------|\n|[aktionsfinder](FHEM/bindings/python/fhempy/lib/aktionsfinder/)|Keep informed about product promotions|\n|[arp_presence](FHEM/bindings/python/fhempy/lib/arp_presence/)|ARP based presence detection, works also for iOS|\n|[ble_monitor](FHEM/bindings/python/fhempy/lib/ble_monitor/README.md)|Supports a lot of BLE devices|\n|[ble_presence](FHEM/bindings/python/fhempy/lib/ble_presence/README.md)|Presence detection incl. RSSI for Bluetooth Low Energy|\n|[ble_reset](FHEM/bindings/python/fhempy/lib/ble_reset/README.md)|Resets all Bluetooth interfaces every X hours|\n|[bt_presence](FHEM/bindings/python/fhempy/lib/bt_presence/README.md)|Presence detection incl. RSSI for Bluetooth|\n|[blue_connect](FHEM/bindings/python/fhempy/lib/blue_connect/README.md)|Blue Connect|\n|[ddnssde](FHEM/bindings/python/fhempy/lib/ddnssde/)|Dynamic DNS updater for free ddnss.de service|\n|discover_mdns|Discover mDNS (e.g. googlecast) devices|\n|discover_ble|Discover Bluetooth LE devices|\n|discover_upnp|Discover UPnP devices|\n|dlna_dmr|Control DLNA MediaRenderer devices|\n|[energie_gv_at](FHEM/bindings/python/fhempy/lib/energie_gv_at/)|Retrieve current Austrian energy status|\n|[eq3bt](FHEM/bindings/python/fhempy/lib/eq3bt/README.md)|Control EQ3 Bluetooth thermostat|\n|[erelax_vaillant](FHEM/bindings/python/fhempy/lib/erelax_vaillant/README.md)|Control eRelax Vaillant|\n|[esphome](FHEM/bindings/python/fhempy/lib/esphome/README.md)|Installs and starts the ESP Home dashboard for easy ESP Home device management|\n|[fusionsolar](FHEM/bindings/python/fhempy/lib/fusionsolar/README.md)|Retrieve data from FusionSolar|\n|[geizhals](FHEM/bindings/python/fhempy/lib/geizhals/README.md)|Retrieve prices from geizhals|\n|gfprobt|Control GF Pro Bluetooth irrigation control|\n|[github_backup](FHEM/bindings/python/fhempy/lib/github_backup/)|Backup FHEM config to github|\n|[github_restore](FHEM/bindings/python/fhempy/lib/github_restore/)|Restore FHEM config from github|\n|[goodwe](FHEM/bindings/python/fhempy/lib/goodwe/)|Get data from GoodWe inverters|\n|[googlecast](FHEM/bindings/python/fhempy/lib/googlecast/README.md)|Control Cast devices and stream Spotify|\n|[google_weather](FHEM/bindings/python/fhempy/lib/google_weather/README.md)|Retrieve weather from Google|\n|[gree_climate](FHEM/bindings/python/fhempy/lib/gree_climate/README.md)|Control gree HVAC devices|\n|helloworld|Hello World example for developers to start writing their own module|\n|[homekit](FHEM/bindings/python/fhempy/lib/homekit/README.md)|Control homekit devices|\n|[huawei_modbus](FHEM/bindings/python/fhempy/lib/huawei_modbus/)|Retrieve data from Huawei inverter, requires Python 3.10 or higher|\n|[ikos](FHEM/bindings/python/fhempy/lib/ikos/README.md)|Check prices for ikos resorts|\n|[kia_hyundai](FHEM/bindings/python/fhempy/lib/kia_hyundai/README.md)|Control your Kia/Hyundai car|\n|[meross](FHEM/bindings/python/fhempy/lib/meross/README.md)|Control Meross devices|\n|[miscale](FHEM/bindings/python/fhempy/lib/miscale/README.md)|Xiaomi Mi Scale V1/2 support|\n|[miflora](FHEM/bindings/python/fhempy/lib/miflora/README.md)|Xiaomi BLE Plant Sensor|\n|[miio](FHEM/bindings/python/fhempy/lib/miio/README.md)|Control Xiaomi WiFi devices|\n|[mitemp](FHEM/bindings/python/fhempy/lib/mitemp/README.md)|Xiaomi BLE Temperature/Humidity Sensor|\n|[mqtt_ha_discovery](FHEM/bindings/python/fhempy/lib/mqtt_ha_discovery/)|Support HomeAssistant MQTT discovery|\n|[nefit](FHEM/bindings/python/fhempy/lib/nefit/README.md)|Control nefit devices|\n|[nespresso_ble](FHEM/bindings/python/fhempy/lib/nespresso_ble/README.md)|Nespresso Bluetooth coffee machine|\n|[object_detection](FHEM/bindings/python/fhempy/lib/object_detection/README.md)|TensorFlow Lite object detection|\n|[piclock](FHEM/bindings/python/fhempy/lib/piclock/README.md)|Create a LED clock with MAX7219|\n|[prusalink](FHEM/bindings/python/fhempy/lib/prusalink/README.md)|Prusa 3D printer, requires Python 3.10 or higher|\n|[pyit600](FHEM/bindings/python/fhempy/lib/pyit600/README.md)|Control Salus iT600 devices|\n|[rct_power](FHEM/bindings/python/fhempy/lib/rct_power/README.md)|RCT Power inverter|\n|[ring](FHEM/bindings/python/fhempy/lib/ring/README.md)|Ring doorbell/chime/cam|\n|[tibber](FHEM/bindings/python/fhempy/lib/tibber/README.md)|Get consumption data from tibber|\n|[seatconnect](FHEM/bindings/python/fhempy/lib/seatconnect/README.md)|Control your Seat/Cupra car|\n|[spotify](FHEM/bindings/python/fhempy/lib/spotify/README.md)|Control Spotify Connect and use FHEM as Spotify Connect player|\n|[skodaconnect](FHEM/bindings/python/fhempy/lib/skodaconnect/README.md)|Control your skoda car|\n|[tuya](FHEM/bindings/python/fhempy/lib/tuya/README.md)|Recommended: Control tuya devices localy incl. real-time updates (only WiFi devices)|\n|[tuya_cloud](FHEM/bindings/python/fhempy/lib/tuya_cloud/README.md)|Control tuya devices via cloud incl. real-time updates (WiFi & ZigBee)|\n|[tuya_smartlife](FHEM/bindings/python/fhempy/lib/tuya_smartlife/README.md)|Recommended: Control tuya devices via cloud incl. real-time updates (WiFi & ZigBee)|\n|[warema](FHEM/bindings/python/fhempy/lib/warema/)|Control Warema devices|\n|[websitetests](FHEM/bindings/python/fhempy/lib/websitetests/)|Do some basic website checks|\n|[wienerlinien](FHEM/bindings/python/fhempy/lib/wienerlinien/README.md)|Wiener Linien departure times|\n|[wienernetze_smartmeter](FHEM/bindings/python/fhempy/lib/wienernetze_smartmeter/)|Retrieve data from Wiener Netze smartmeter|\n|[xiaomi_gateway3](FHEM/bindings/python/fhempy/lib/xiaomi_gateway3/README.md)|Xiaomi Gateway V3 (only V3\\!)|\n|[xiaomi_tokens](FHEM/bindings/python/fhempy/lib/xiaomi_tokens/README.md)|Retrieve all Xiaomi Tokens from Cloud|\n|[volvo](FHEM/bindings/python/fhempy/lib/volvo/)|Retrieve infos from your Volvo car (only new API)|\n|[volvo_software_update](FHEM/bindings/python/fhempy/lib/volvo_software_update/README.md)|Get notified about Volvo software updates|\n|[zigbee2mqtt](FHEM/bindings/python/fhempy/lib/zigbee2mqtt/README.md)|Install, update and run Zigbee2MQTT server|\n\n## Installation\nPython >=3.9 is required, Python 2 won't work\\!\n\n### Console\n#### Debian 11/12 (Bullseye/Bookworm)\nCopy & paste this command if you are running Debian Bullseye.\n```\nsudo apt install python3 python3-pip python3-dev python3-venv libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libglib2.0-dev libdbus-1-dev bluez libbluetooth-dev git libprotocol-websocket-perl\n```\n\n#### Others\nUse the following 2 commands if you run Debian 10 (Buster) or older (e.g. stretch, jessie, ...).\n```\nsudo apt install python3 python3-pip python3-dev libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libglib2.0-dev libdbus-1-dev bluez libbluetooth-dev git\n```\n```\nsudo cpan Protocol::WebSocket\n```\n\n### FHEM\n```\nupdate add https://raw.githubusercontent.com/fhempy/fhempy/master/controls_pythonbinding.txt\n```\n```\nupdate\n```\n```\nshutdown restart\n```\n```\ndefine fhempy_local BindingsIo fhempy\n```\n\nWait a few minutes until fhempy is installed. **This might take up to 15 minutes!** fhempy_local will show up with a green circle when finished.\nAll further requirements are installed automatically via pip as soon as the specific module is used the first time.\n \n## Usage in FHEM (examples)\nThis are just a few examples for some modules, please see the modules readme linked in the table above for more details\n - `define castdevice fhempy googlecast \"Living Room\"`\n - `define eq3bt fhempy eq3bt 00:11:22:33:44:66:77`\n - `define upnp fhempy discover_upnp`\n\n## fhempy peers (e.g. extend Bluetooth range)\nfhempy allows to run modules locally (same device as FHEM runs on) or on remote peers. Those remote peers only make sense if you want to extend the range of bluetooth or want to distribute the load of some modules to other more powerfull devices (e.g. video object detection).\n\n\n### Peer setup (short version)\nOnly on remote peers, do not run this commands on the FHEM instance. Run this commands with user \"pi\".\n\n```\n### WARNING: DO THIS COMMAND ONLY ON REMOTE PEER, NOT ON YOUR FHEM INSTANCE ###\n# systemd service installation\ncurl -sL https://raw.githubusercontent.com/fhempy/fhempy/master/install_systemd_fhempy.sh | sudo -E bash -\n```\n\n### Peer setup (long version)\nOnly needed if you didn't run Peer setup (short version). The following steps are only needed if you want to install fhempy on a remote peer, you should not run them on your FHEM installation.\n\n- Setup virtual environment for fhempy: `python3 -m venv .fhempy/fhempy_venv`\n- Activate venv: `source .fhempy/fhempy_venv/bin/activate`\n- Install fhempy with user pi: `pip3 install --upgrade fhempy`\n- Make sure your main fhempy instance (within FHEM) is running\n- Test fhempy by just running it with user pi, type `fhempy` and enter. Wait a few seconds until it gets discovered and you see the incoming FHEM connection.\n- Systemd configuration for autostart\n  - `curl -sL https://raw.githubusercontent.com/fhempy/fhempy/master/install_systemd_fhempy.sh | sudo -E bash -`\n  - fhempy is run with user pi, you can change that in the fhempy.service file in /etc/systemd/system/\n- FHEM configuration\n  - The remote peer is autodiscovered and will show up in FHEM as device e.g. fhempy_peer_192_168_1_50\n  - You can move any device to the remote peer by changing the IODev of the device.\n  - If autodiscovery doesn't work (it's based on zeroconf), you can define it with `define fhempy_peer_IP BindingsIo IP:15733 fhempy`\n\n### Log file\n`journalctl -u fhempy.service -f`\n\n### Update\nJust do `set remote_pybinding update` and the remote peer will install the new package via pip and restart afterwads.\n\n## Functionality\n\n### 10_BindingsIo\nThis module is a DevIo device which builds a language neutral communicaton bridge in JSON via websockets.\n### 10_fhempyServer\nThis module just starts the fhempy server instance\n### 10_fhempy\nThis module is used as the bridge to BindingsIo. It calls BindingsIo with IOWrite.\n### fhempy\nThis is the Python server instance which handles JSON websocket messages from BindingsIo. Based on the message it executes the proper function and replies to BindingsIo via websocket.\n\n### Call flow\nThis example shows how Define function is called from the Python module.\n 1. define castdevice fhempy googlecast \"Living Room\"\n 2. fhempy sends IOWrite to BindingsIo\n 3. BindingsIo sends a JSON websocket message to fhempy\n 4. fhempy loads the corresponding module (e.g. googlecast), creates an instance of the object (e.g. googlecast) and calls the Define function on that instance\n 5. Define function is executed within the Python context, as long as the function is executed, FHEM waits for the answer the same way as it does for Perl modules\n 6. Python Define returns the result via JSON via websocket to BindingsIo\n\nAt any time within the functions FHEM functons like readingsSingleUpdate(...) can be called by using the fhem.py module (fhem.readingsSingleUpdate(...)). There are just a few functions supported at the moment.\n\n![Flow Chart](/flowchart.png)\n\n## Write your own module\nCheck helloworld example for writing an own module. Be aware that no function which is called from FHEM is allowed to run longer than 1s. In general no blocking code should be used with asyncio. If you want to call blocking code, use utils.run_blocking.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python binding for FHEM to support Python modules",
    "version": "0.1.727",
    "project_urls": {
        "Bug Tracker": "https://github.com/fhempy/fhempy/issues",
        "Homepage": "https://github.com/fhempy/fhempy",
        "Sponsorship": "https://github.com/sponsors/fhempy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7dd9d7fecf31da05eecf56ff4c5d5a34b446012aef642d2ca691cd09be5d47ef",
                "md5": "64c61112aafaa7f8878606c155ecef24",
                "sha256": "b9b51b55733af8d6374b1c1d044cf42abd43f752a04708ed85b1c77188c20911"
            },
            "downloads": -1,
            "filename": "fhempy-0.1.727-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64c61112aafaa7f8878606c155ecef24",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4464882,
            "upload_time": "2024-03-16T08:06:58",
            "upload_time_iso_8601": "2024-03-16T08:06:58.362308Z",
            "url": "https://files.pythonhosted.org/packages/7d/d9/d7fecf31da05eecf56ff4c5d5a34b446012aef642d2ca691cd09be5d47ef/fhempy-0.1.727-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74c74c8fa78eab3b532c62c474185131c5b49eb33d63e356edbc29b25a7adba9",
                "md5": "60d09c1d8de14bb4b99b8f98bf5dddc2",
                "sha256": "3cc0aacf2e8400cf0d278a49c999153880e9e7812d17595d86f0b0322268cb1b"
            },
            "downloads": -1,
            "filename": "fhempy-0.1.727.tar.gz",
            "has_sig": false,
            "md5_digest": "60d09c1d8de14bb4b99b8f98bf5dddc2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 4359726,
            "upload_time": "2024-03-16T08:07:06",
            "upload_time_iso_8601": "2024-03-16T08:07:06.487062Z",
            "url": "https://files.pythonhosted.org/packages/74/c7/4c8fa78eab3b532c62c474185131c5b49eb33d63e356edbc29b25a7adba9/fhempy-0.1.727.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-16 08:07:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fhempy",
    "github_project": "fhempy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "fhempy"
}
        
Elapsed time: 0.22854s