You should see output like `{'restart': {'Restart': 'Restarting'}, 'download': 200}` and the device will restart.
With older Tasmota versions, download the [`.tapp` file](https://link.frontmatter.ai/haco/tapp) on a desktop computer,
upload it to your device as `haco.tapp` and restart manually.
Once the device restarts, you should see the following among your Tasmota startup logs (in the regular console, not the
Berry one):
```
HACO: The haco daemon has started. Hostname: tasmota-test, MAC: 04:74:77:9B:CB:CC. Listening for configuration...
```
### Home Assistant
You can now install the Home Assistant Add-On:
[](https://link.frontmatter.ai/haco/add-on)
Once the Add-On is installed, click into its Configuration tab, you'll see a setting called `assignments`:
```yaml
- config: null
identifier: null
```
#### Assigning a configuration module to a device
Now we're ready to assign a configuration module to our Tasmota device. For now, we can use a built-in test
module `test`. The `identifer` value should be the hostname (or MAC) of your Tasmota device. So for our example it
should look like this:
```yaml
- config: test
identifier: tasmota-test # Hostname of Tasmota device
```
Saving the Configuration will restart the Add-On. After the restart, you should see the following in the Add-On logs:
```
Device "Tasmota Test Device" successfully configured. Hostname: tasmota-test MAC: 04:74:77:9B:CB:CC.
```
In Home Assistant, find the device in the Devices section. You should now see a test Select (pulldown) control called "
Greeter".
Selecting the greetings from the pulldown, you should see them appear in your Tasmota Berry console, e.g.
```console
haco says: Hello World!
```
This means `haco` is set up and working properly. Good! You can now use `haco` to assign configuration modules to your
Tasmota devices.
## Configuration Modules
Configuration modules are a little like drivers, that tell `haco` how to communicate with a Tasmota device, what
controls to expose to Home Assistant, etc.
So far we've only used the `test` configuration module, that exposed the Greeter pulldown, but to control
real-world devices, you'll need to assign them to a module written specifically for that device. There are currently two
types of modules,
Built-In and User-Defined.
Whichever type you use, assigning them to a device is done as we saw above.
### Built-In Modules
`haco` ships with a small number of built-in configurations. These can be found in
the [configs directory](tree/release/haco/configs) in this repo. But in the likely event that your device hasn't already
been added, you'll need to define your own.
:information_source: The aim is to expand the number of built-in configurations over time. So if you define your own (
see below), please submit it to this repo as a Pull Request, or raise an Issue linking to your code!
### Creating Your Own Configuration Module
#### General module structure
A configuration module is, ultimately, just a typical Python module. In this case, they contain definitions from one or
more `Control` objects. Each control definition involves two things:
* The control object assigned to a variable, e.g. `temperature_sensor=Sensor(...)`
* Any required callback functions for the control, e.g. `@temperature_sensor.callback(...)<function>`
#### Location
User-Defined modules should be added to the `/config/haco` directory in Home Assistant, with a `.py` extension,
e.g. `my_config.py`.
#### Defining controls
Here are a couple of simple examples to help get you started defining your own configuration module.
##### Tasmota-Only Controls
First, let's define a Tasmota-only sensor to report how much free memory there is on the Tasmota device. This sensor
is "Tasmota-Only" as it only handles values sent _from_ Tasmota (and sends nothing back from Home Assistant).
When you first assign a new configuration to a device, keep an eye on the Add-On logs for any errors. You'll see a
typical Python stack trace if anything goes wrong.
:information_source: Each time you edit your configuration module (`.py` file), you'll need to restart the Add-On. Hot
is reloading not yet supported.
#### Additional Capabilities
More complex device controls (e.g. `Climate`, `Fan`) have additional capabilities beyond a single value sent to/from
Home Assistant. Adding callbacks for these extended capabilities is done similarly to the above, only the callbacks need
to include the name of the capability. So if you want to add callbacks around setting the `target_humidity` of
a `Climate` control, you'd need to call your callbacks `target_humidity_tasmota` and `target_humidity_ha`, etc.
A full schema of these names will appear in subsequent documentation. But you can find example implementations for most
controls in the [built-in `development` config](blob/release/haco/configs/development.py).
Anway, if you get the names wrong, you'll see an error like this in your Add-On logs:
```
ValueError: Callback function "set_mode_ha" name is not valid for control "Climate". Must be one of: ['action_tasmota', 'current_humidity_tasmota', 'current_temperature_tasmota', 'mode_ha', 'mode_tasmota', 'preset_mode_ha', 'preset_mode_tasmota', 'swing_mode_ha', 'swing_mode_tasmota', 'target_humidity_ha', 'target_humidity_tasmota', 'target_temperature_ha', 'target_temperature_tasmota', 'temperature_high_ha', 'temperature_high_tasmota', 'temperature_low_ha', 'temperature_low_tasmota']
```
#### Additional Resources
Beyond these examples, when creating your own configuration, you'll probably find
the [built-in configurations](tree/release/haco/configs) (
especially the [`development` config](blob/release/haco/configs/development.py)) useful.