A sensor for ESPHome to allow the use of a rotary phones dial as a sensor to trigger automations in Home Assistant
By default the dial will operate in a Pull Down mode to allow for wake interrupts to be generated by the dial, there is code commented out if you would instead like to switch to a Pull Up system.
There are three pins required, your setup may vary depending on your telephones region of manufacture:
- Live / positive pin
- Control Pin - this breaks connection when the dial is 'live'
- Rotary Pin - this makes connection to register a pulse
Here is a rough picture of what I ended up with, my ESP had issues pulling down the contactors quickly enough for the next pulse to be detected so I added large resistors to assist, you may find these are not necessary in your setup.
Include the custom_component in your ESPHome YAML usinig:
esphome:
includes:
- custom_components/RotaryPhoneSensor.h
And then add the sensor using:
sensor:
- platform: custom
lambda: |-
auto rotary_phone_sensor = new RotaryPhoneSensor();
App.register_component(rotary_phone_sensor);
return {rotary_phone_sensor};
sensors:
name: "Rotary Dial"
You should now see the Rotary Dial appear under 'sensors' in your ESP Device
Turning the dial will count the pulses, triggering the sensor to update to the correct number, before resetting to zero. this allows Home Assistant to trigger Automations by 'Dialling' numbers.
see ExampleHomeAssistantAutomationTrigger for an example of how to set this up