Migration from FHEM / FS20

This is my first post. Hello to all!

I’m running FHEM now on a Raspberry Pi 4 and use FHEM for ELV FS20 numerous equipment (approx. 100 pieces). I am using two CULfw USB sticks.

Most of my equipment I intend to replace with ZigBee. Especially the battery less switches seem to be a good ídea, of which I will need dozens. Also the LED 1-10V power drivers, I will replace with TCI zigbee drivers. I want to change because FHEM was too complicated for me an I am not an IT specialist.

First off all I’d like to integrate my existing FS20 gear into HA.
As FS20 ist not directly supported by HA, I’d like to ask the community, which is the best way to migrate?
Better temporarily with a raspberrymatic installation (more work to identify 100+ triggers…) or may be better direct from FHEM? Via MQTT? As FS20 is not coded, do I need RaspberryMatic or can HA read FS20 signals direct from a USB-CUL-Stick or should I buy a new transmitter? Which?

I intend to install HA on a Raspberry Pi 4. Can HA be on the same hardware as MQTT or the same RaspberyyMatic-Server?

Which kind of installation should I choose (better HA OS or supervised)?

Sorry for the long intro and so many questions… . Found a lot of posts, but nothing really suitable.

regards Roy

1 Like

Just to keep others informed, ntending to migrate from FHEM to Home Assistant: I foung a solution without touching any code.

Probably “around one more corner” than neccessary, but very smple and working.

I struggled hard with dozens of posts in the FHEM forum setting up a MQTT connection. And it is not just the connection. “Publish”, “retain”, “attributes”… a lot of reading and n the end, just by chance I found the easy way. Only wth Home Assistant integrations, no HA add ons required, no coding required on any side… . So it can run with FHEM on the same raspberry (or whatever hardware you are using).

Short explanation: FHEM === Homebridge === Home Assistant
And… f you want use Apple Homekit, run the Homekit integration in HA.

I had a Homebridge installation on my raspberry (running also with FHEM and Home Assistant at the same time). Homebridge s very easy to install and… it has a FEHM plugin with a simple click configuration!
Homebridge: Homebridge installation

To use the GUI of homebridge, you will have to install the GUI extra:

Homebridge UI-X GUI installation

In the Hoembridge GUI go to “Plugins” and search for FHEM and choose the FHEM plugin.
Name “FHEM”, server “localhost” (if on the same machine), FHEM port 8083, Filter: suggested by the plugin is “siriName=.+”, then only devces with a sri name are imported; leave this feld empty and ALL FHEM devices will be imported in one go! If you have a special user and password for the FHEM web interface, then enter this (I had nothing). Press “Save” and restart Homebridge servce at the on/off button in the upper right corner. Click at “Devices” and you should see all yout FHEM devices coming up on the GUI. Click on “Homebridge” upper left corner and you will see a barcode. Note that code xxx-xx-xxx. You will need in Home Assistant. Now you are done with Homebridge.

In Home Assistant goto “Settings” lower left corner. Choose "devices and “services”, click “Integrations” at the top and choose “HomeKit”. Add your HomeBridge data here (IP, code…), You will be asked, which devices shall be shown: excludes nothing. In the last windows enable both switches to activate new found devices. This should find ALL Homebridge devices, resp. all FHEM devices.

n the end, I had in Home Assistant one integraton with “Home Bridge” and two entries with one service each and one “Homekit Devce” with multiple devces (alle FHEM devices). In "messages at the lower left corner, you’ll find a bar code which you can use to publish ALL devices in Home Assistant to your Apple “Home” app (“add device” and scan the code). You’re done.

This might not be the "cleanest way of bringing your FHEM devices to Home Assistant, but it needed nothing on the FHEM side, no coding in HomeAssistant and in Homebridge you will have to copy and paste a pieces to a config.json file and you are done.

What is being imported and how does t work?

Alle FHEM devices are now in HomeAssistant with their full funcionality, also dimmers, switches, thermostats (I use MAX) as I could see up now. Everything can be operated no matter, ig in FHEM, Homebridge, Home Assistant or in Apple Home - it works.

One issue wth FS20 devices (whch has nothing to do this “dirty way of integraton”):
Very often, I use one button toggle switches with FS20, which means, that with a 4-button switch, I can control 4 seperate lamps, including on/off/dimming up/dimming down. This works wth the “toggle” command in FS20. As FS20 is a one-directional system and not bi-directional, nor the switch or the (blind) remote operator knows, what state the device has. Toggling changes from on to off without feedback. “Lost” commands lead to a wrong indication in FHEM, Homebridge, Home Assistant anmd Apple Home. So these devices should not be used remotely, but only when you are present. In FHEM, you can use the “set” command to definitely put the device in a definite conditon instead of toggling it. f would change this in the device in FHEM, t would work all other platforms correctly, but I would loose the dimming capablty then.

1 Like

Thanks for the guide. I’m searching for an easy and generic way to integrate my fhem devices for a while now.

Do you still using this approach? Due to homeassistant doesn’t need homebridge anymore, I couldn’t find a way to conntect HA to HB. I thoght I could use the homekit device integration, but it says no unpaired devices.
If I first add the homekit bridge and try to add a homekit device afterwards it says invalid homekit code.

Nevermind, I changed the mDns advertiser of homebridge from Bonjour to avahi and it got autodetected in homeassistant.

Maybe even the restart did the trick.

Hi @RoMaDur ,
ich bin tatsächlich den Weg über MQTT gegangen. Funktioniert stabil in beide Richtungen. Über den Weg habe ich auch Fensterkontakte (CUL_FHTTK) als Binärsensoren, Temperatur/Luftfeuchtigkeitssensoren (CUL_WS) als Sensoren eingebungen.
Heizungssteuerung über FHT80b funktioniert bei mir leider nicht, aber das kann ich verkraften. Da ich aber eine ganze Menge dieser FS20/FHT Geräte habe, würde ich mich sehr freuen, wenn jemand mal die HA-Integration dafür bauen würden. Ich biete gerne an, daran mitzuarbeiten, Python ist kein Problem, aber ich bin noch zu neu in HA, als dass ich mich an so ein Projekt alleine wagen würde.

Es scheint da auch bereits Versuche gegeben zu haben:

Mein Setup:
in FHEM:

Voraussetzung: lokal laufender MQTT Server (bei mir im Docker Container)

define mqtt MQTT2_CLIENT 127.0.0.1:1883

Beispieldevice: FS20_LichtKueche

define FS20_LichtKueche FS20 dc69 00

usw…


  • neues Gerät, wandelt FS20 zu MQTT um:
define MQTT2_hass_FS20_LichtKueche MQTT2_DEVICE hassLichtKueche
attr MQTT2_hass_FS20_LichtKueche devStateIcon .*ON:ios-switch-on .*OFF:ios-switch-off
attr MQTT2_hass_FS20_LichtKueche readingList fhem/light/FS20_LichtKueche/state:.* state
attr MQTT2_hass_FS20_LichtKueche setList on fhem/light/FS20_LichtKueche/state:r on\
off fhem/light/FS20_LichtKueche/state:r off

  • neues Gerät, wandelt generell MQTT von HA zu FS20 um (wichtig ist die Benamung der Geräte, weil hier per Regex die Gerätenamen getauscht werden (s/MQTT2_hass_FS20_/FS20_/g):
define notifyhassLichtMQTT notify MQTT2_hass_FS20.*:.* {  \
	my $NEWNAME = $NAME;;;;  \
	$NEWNAME =~ s/MQTT2_hass_FS20_/FS20_/g;;;;   \
	fhem("set $NEWNAME $EVENT");;;;   \
}

in Home Assistant:
sofern noch nicht geschehen, in der configuration.yaml die MQTT Devices anlegen

Beispiel

mqtt:
  switch: !include_dir_merge_list mqtt/switch/

Dann das MQTT-Device anlegen in der Datei ./homeassistant/data/mqtt/switch/mqtt_fs20.yaml

- unique_id: fhem_switch_lichtkueche
  name: "Licht Küche" 
  state_topic: "fhem/light/FS20_LichtKueche/set" 
  command_topic: "fhem/light/FS20_LichtKueche/state" 
  device_class: switch
  qos: 1
  optimistic: false
  payload_on: "on" 
  payload_off: "off" 
  retain: false 
  icon: mdi:lightbulb
  device:
    suggested_area: Licht
    identifiers: Licht Küche
    model: FS20
    manufacturer: ELV

Verbesserungsvorschläge sind gerne willkommen