justme-1968 / homebridge-fhem

a fhem platform plugin for homebridge
https://wiki.fhem.de/wiki/Homebridge_einrichten
79 stars 16 forks source link
fhem homebridge

homebridge-fhem

verified-by-homebridge npm npm GitHub last commit

a fhem platform plugin for homebridge

uses longpoll and an internal cache to avoid roundtrips to fhem. a debug browser is available at port 8282 (or 8283).

add one (or more) FHEM platforms to config.json and set the filter(s) to a fhem devspec that includes the devices that should be bridged to homekit.

directly (automatically) supports:

simple config

for devices that are not correctly identified use the genericDeviceType attribute to configure the device type. supported values are: security,ignore,switch,outlet,light,blind,thermometer,thermostat,contact,garage,window,lock this is probably mostly used for differentiating between switches and lights.

enhanced config

for devices that don't use the autodetected readings and commands or for devices that mix readings from different devices use the homebridgeMapping attribute. it is parsed from left to right and works as follows:

this would define a thermostat device with a command target to set the desired temperature, a reading target that indicates the desired target temperature, the desired min, max and step values and a current temeprature comming from the temperature reading of the device myTemp.

the names for the stadard service and characteristic types can be found here: .../hap-nodejs/lib/gen/HomeKitTypes.js

Currently supported values for Characteristic names are:

FHEM -> Homekit parameters:

e.g.:

PositionState=motor,values=/^up/:INCREASING;/^down/:DECREASING;/.*/:STOPPED On=state,valueOn=/on|dim/,valueOff=off

the order of the transformations is as follows: eventMap, part, threshold, values, valueOn/valueOff, factor, max, maxValue/minValue/minStep, invert

instead of using the transformation chain reading2homekit can be set to the name of a js function that is imported from a file named by the jsFunctions config option. relative paths are relative to the same path the config file is located in. the function it will be called with mapping and reading value as parameters and has to return the value to be used with homekit.

for custom characterisitcs the additional parameters name, format and unit have to be set. e.g.:

00000027-0000-1000-8000-0026BB765291=Volume::Volume,name=Volume,format=UINT8,unit=PERCENTAGE,minValue=0,maxValue=0,minStep=1

adding a history characteristic will try to use fakegato-history to create Eve compatible history entries for ContactSensor and TemperatureSensor services:

history:size=1024

Homekit -> FHEM parameters:

spaces in commands have to be replaced by +

e.g.:

TargetHeatingCoolingState=...,cmds=OFF:desired-temp+off;HEAT:controlMode+day;COOL:controlMode+night;AUTO:controlMode+auto

the order of the transformations is as follows: invert, factor, max/maxValue precedence for mapping of homekit value to commands is in increasing order: cmd, cmdOn/cmdOff, cmds

instead of using the transformation chain homekit2reading can be set to the name of a js function that is imported from a file named by the jsFunctions config option. relative paths are relative to the same path the config file is located in. the function it will be called with mapping and the homekit value as parameters and has to return the value to be used with the fhem set command.

a dummy with a setList of exactly two entries will be mapped to a On characteristic where the first entry will be mapped to on and the second to off.

examples:

instead of the format described above homebridgeMapping can also contain the same data encoded as json this has to be used if any of the separators above are used in an command or value. at the moment the json version replaces all build in defaults for a device. e.g.:

{ "PositionState": { "reading": "motor", "values": [...] }, "On": { "reading": "state", "valueOn": "/on|dim/", "valueOff": "off" } }