Introduction: Arduino for a Wired Home Assistant Network
Wifi components like the various Sonoff, Tasmota and ESP8266 are very easy to configure and use, but things often are not easy as they appear.
In industrial/business environments wireless automation is not so common. Wireless components are less reliable than their wired counterparts.
Would you use a wireless smoke sensor in a factory? I don't think so. And why use a wifi magnetic door sensor in your home?
Wired sensors/actuators are very more reliable, don't need battery, no radio waves in your home.
What i did is an hardware component that can be connected via RS-485 to a home assistant controller (via the Modbus platform). It's based on an arduino. It's similar to the Sonoff switch/relay, but it's wired.
It can act as a light controller (via a relay and an input for the buttons).
It can act as a remote switch (via a relay and an input for the buttons).
It can act as a thermostat.
It can act as a temperature sensor.
A single arduino board can be all these things at the same time, with many input/outputs connected.
Step 1: Build the Hardware Part
You need an arduino board.
I've used an arduino nano but others will be ok.
Connect the Rs-485 converter, a display if you plan to use it, relay(s) and set it up for push buttons.
Step 2: Flash the Firmware
Code can be found at https://github.com/andrea1388/ArduinoModBusHomeAssistant
Don't forget to configure it before copiling. You need to set up the pins used as input, outputs, if it have a Temperature sensor, a display and so on
Step 3: Configure Home Assistant
Edit the configuration.yaml
- platform: modbus name: Thermostat slave: 1 target_temp_register: 0 current_temp_register: 2 data_count: 2 precision: 1 unit_of_measurement: °C data_type: float
Step 4: Connect the Arduino With the Raspberry Running Home Assistant
Usa a RS-485 USB dongle. You can find it on ebay or amazon. It's very cheap.
Step 5: Restart Home Assistant
Now you can see the temperature set point and control it. Set point can be controlled via automation script and from other components. Using a google assistant you can modify the temperature via vocal commands.