-
Notifications
You must be signed in to change notification settings - Fork 2
Using virtual buttons with Eltako FAM14
This is from the excellent post by @tbarbette in aseracorp/HA_enoceanmqtt#16 (https://github.com/aseracorp/HA_enoceanmqtt/discussions/16#discussioncomment-6281088).
I've got the exact same setup.
First launch the enoceanmqtt with the default enoceanmqtt.conf correctly configured but don't bother adding buttons or else. The idea is to recover the baseid of your USB300 in the MQTT integration.
You'll have normally one device, look for that :
And get the base id there :
Then, with the base ID you can invent some sender IDs to create virtual switch buttons, exactly like the physical ones you probably have. Add the following for each light (yes, it will be long). My base id is 0xFFEDA9XX. I used the number of my relays as last digits.
[relay/PorchLight]
address = 0xFFFFFFFF
sender = 0xFFEDA921
rorg = 0xF6
func = 0x02
type = 0x01
virtual = 1
Then, the button will appear in Home Assistant.
A0, A1, B0, B1 are basically like pressing the 4 buttons of the physical switches. You can start the learning process on your F4SR14-LED like the physical switches, one by one. Yes it's long and painful.
Basically now it should work, but the buttons are not very convenient... So what you want is to create virtual "template" switch. But first, for those button to reflect the state of your light, you want also to integrate the feedback from the FAM14. After actionning each interruptor (virtual or physical), you'll get a message in "response" to the switch being pressed in the enoceanmqtt log.
Why? Even if you manage to record the state when you interact with relays from HA, the physical buttons are still there and you want their feedback too.
Create "state" entities in enoceanmqtt.conf with the address, one by one:
[relay_state/Porch]
rorg = 0xf6
func = 0x02
type = 0x01
address = 0xFFE80D01
The funny part is that it's the same device type. The reason is the FAM14 basically echo the datagram with the current state of the relay. So it appears as a switch... But it actually reflects the state of the relay :)
Okay, you get the "actioner", and the "state", let's build a nice button out of that :
switch:
- platform: template
switches:
porch_light:
friendly_name: Porch power
value_template: "{{ is_state('binary_sensor.e2m_relay_state_porch_bo_pressed', 'on') }}"
turn_on:
- service: select.select_option
data:
option: AO
target:
entity_id: select.e2m_relay_porchlight_action
turn_off:
- service: select.select_option
data:
option: AI
target:
entity_id: select.e2m_relay_porchlight_action
And tadaaam :
A bit painfull to create 24 relays, but once done it works like a charm :)