I really wanted to get some 433MHz wall switch buttons to work and I wasn’t able to get existing solutions to work. I don’t think this will work for very many use cases, but I’m posting it as it might come useful for someone and it’s made to work with HA.
The first version supports listening to interrupts from a cheap 433MHz module on a GPIO Raspberry Pi 2 pin. It only supports the NewKaku protocol, however with some work it could probably be extended to others as it’s fairly flexible.
The way I approached it might be stupid and too much processing, but it seems fairly robust as it works on configurable statistical probability.
See the GitHub page for more information.
Releases: https://github.com/SmilyOrg/rfmqtt/releases
Source: https://github.com/SmilyOrg/rfmqtt
Here’s are some example HA automations that I’m using to interface with this tool. They use the momentary switch functionality to allow for long press and stateless switching.
binary_sensor:
- platform: mqtt
name: "Top Right"
state_topic: "switch/topRight"
- platform: mqtt
name: "Bottom Right"
state_topic: "switch/bottomRight"
- platform: mqtt
name: "Top Left"
state_topic: "switch/topLeft"
- platform: mqtt
name: "Bottom Left"
state_topic: "switch/bottomLeft"
automation:
- alias: "Bedroom lights on"
trigger:
- platform: state
entity_id: binary_sensor.top_left
from: "off"
to: "on"
action:
service: light.turn_on
entity_id: group.bedroom
- alias: "Bedroom lights off"
trigger:
- platform: state
entity_id: binary_sensor.bottom_left
from: "off"
to: "on"
action:
service: light.turn_off
entity_id: group.bedroom
- alias: "Bedroom infinity light on"
trigger:
- platform: state
entity_id: binary_sensor.top_right
from: "off"
to: "on"
action:
service: light.turn_on
entity_id: light.infinity
- alias: "Bedroom infinity light off"
trigger:
- platform: state
entity_id: binary_sensor.bottom_right
from: "off"
to: "on"
action:
service: light.turn_off
entity_id: light.infinity
- alias: "Long top press bed time"
trigger:
- platform: state
entity_id: binary_sensor.top_left, binary_sensor.top_right
from: "off"
to: "on"
for:
seconds: 2
action:
service: scene.turn_on
entity_id: scene.bed_time
- alias: "Long bottom press sleep time"
trigger:
- platform: state
entity_id: binary_sensor.bottom_left, binary_sensor.bottom_right
from: "off"
to: "on"
for:
seconds: 2
action:
service: scene.turn_on
entity_id: scene.sleep
And the devices part of the config.yaml on the rfmqtt side.
devices:
- address: 0xC0FFEE
topics:
- unit: 1
onoff: 1
name: switch/topLeft
- unit: 1
onoff: 0
name: switch/bottomLeft
- unit: 2
onoff: 1
name: switch/topRight
- unit: 2
onoff: 0
name: switch/bottomRight