Advice from a Sonoff RF Bridge (ESPurna FW) user sought

Hoping there is somebody who’s already done this and can point me to a better way.

I have a Sonoff RF Bridge running on ESPurna firmware. The Bridge has been setup (via code learning) to detect a wireless door bell press, and it passes that fine to HA via MQTT just fine as a ‘switch’.
The use of a door bell which sends the same code (not On or Off like an RF lamp or fan controller) is a bit different to what ESPurna was created for (i.e. switches, not sensors).

In hass.io the door bell is being shown as a switch icon because ESPurna treats and reports it as a switch, and hassio holds it’s last switch state until the bell is pressed again, in other words it toggles it.
By what methods can I change the switch icon in hassio to go back to ‘Off’’ after say 5 seconds ( or change it to be treated as a sensor instead) ?

I hope the question makes sense. Perhaps somebody who has used the ESPurna FW Sonoff RF Bridge (or RFLink bridge) to detect door or window RF sensors or wireless PIR’s for home security or presence detection will know what I mean…

Maybe just create an automation that switches it off after 2 seconds? Simple solution.

  trigger:
    platform: state
    entity_id: switch.sonoff_rf
    to: 'on'
    for:
      seconds: 2
  action:
    service: switch.turn_off
    entity_id: switch.sonoff_rf

You might not need to display a doorbell on the front end as it just is on for a few seconds. you can use your switch as a doorbell sensor for automation by watching the state change and not for the state it goes to.

Also, you can change it to a sensor if you need to.

SWITCH AS SENSOR
Some movement sensors and door/window sensors will appear as a switch. By using a Template Binary Sensor, the switch can be displayed as a binary sensors. The original switch can then be hidden by customizing.

Thanks kanga_who, that would probably work, but will generate a MQTT command to the RF Bridge which will ring the doorbell from itself 2s after the original press (and hey two rings might not be a bad thing).

Thanks RobDIY, that info is probably what I was seeking. I’ll have a read and try that approach too. At the moment I’m not much conversant with the value template coding, so it’s going to be a bit of head scratching tonight.

It occurs to me now that to a newish HA user coming into HA like me the term I was looking for a was probably ‘momentary switch’ and how one copes or configures a momentary switch reported via MQTT as a sensor.

Have you managed to achieve the desired result?
I’m trying to do similar thing with DW1/PIR2 sensor, but the automation bit to change relay state to 0 does not work.

I did get a usable result by using a state automation with a blank state trigger.
i.e. the From and To fields left blank. This now sends a notification on any state change.

Actually my Sonoff RF Bridge is off line now, it went crazy, sending random mqtt notifications and RF controls.
It might just be corrupted firmware, but it was a trigger to try out RFlink instead…

Pity your RF bridge is playing up. Mine is fine.
And I managed to configure HA so it treats DW1 and PIR2 as sensors, not as relays/switches. Works as needed with hass-custom-alarm.

By the way, you can make one yourself and connect it via Ethernet like this guy did.

Can you post your sensor solution code block from your config, I’d be interested in how easy or hard that is to do ?

It’s easy. Here is my solution for the DW1, you only need to change name if you add more DW1s, and sensor_class to motion for PIR2s(optionally).

If you have plenty of sensors, is screams for a template to make the process of declaring identical sensors less redundant, but I’m still too new to HA and don’t know if or how to implement it.

Ah, I have a small problem with the solution. RFlink component doesn’t use MQTT so I’m not sure how the syntax would be for a 433Mhz binary door sensor that was auto configured by RFlink. Shows my lack of understanding probably.
All I have access to I believe is the entity ID of the ‘light’ that is actually the door opening switch.
i.e. ev1527_0a8072_01

i took mine offline as i had it controlling some lights, my place ended up like a disco going crazy.

Sounds very similar to what my RF bridge did leepark. Was yours OK for some days or weeks before that occured ?
I’m no coder but I wonder if terms like memory leak apply to these small MCU’s.

it was ok for a few days. one problem i had was that the on and off code for a light were the same, and it seems that the espurna must have periodically sent out a command to ensure that the switch or light was in the correct state. So you can imagine that how happy my wife was when the under bed leds were turning on and off randomly. I found that the Espurna Sonoff RF bridge would disconnect from the wifi quite regular too.

1 Like

Hi mr.seezy, I found this thread from a search on how to bridge RF sensors and MQTT using the Sonoff RF Bridge. Would you mind sharing what features have to be enable in the ESPurna firmware to have this working?
Thank you!

No. I have now been using Tasmota firmware with the RF bridge for a long while now, not Espurna. Apart from doing OTA firmware updates I don’t play around with it firmware wise, and it gives me no trouble.