Skip to content

Commit

Permalink
Updated docs to reflect new configuration structure
Browse files Browse the repository at this point in the history
  • Loading branch information
riley206 committed Sep 28, 2023
1 parent ceb3b8d commit 6adcb4d
Showing 1 changed file with 41 additions and 20 deletions.
61 changes: 41 additions & 20 deletions services/core/PlatformDriverAgent/HomeAssistantDriver.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
**VOLTTRON Home Assistant Driver.**

The Home Assistant driver provides VOLTTRON with a way to access any point of data from a home assistant device. It currently allows for control of lights and thermostats.

Please see the README for the platform driver.
[services/core/PlatformDriverAgent/README.md](https://github.com/riley206/Rileys_volttron/blob/55146b78d3ab7f53d08598df272cdda2d0aa8d3d/services/core/PlatformDriverAgent/README.md)
```mermaid
Expand All @@ -23,59 +25,74 @@ Listener agent: https://volttron.readthedocs.io/en/main/introduction/platform-in

Platform driver agent: https://volttron.readthedocs.io/en/main/agent-framework/core-service-agents/platform-driver/platform-driver-agent.html?highlight=platform%20driver%20isntall#configuring-the-platform-driver

Once you have cloned the repo, fill out your configuration files. Each device will have 2. Make sure your registry_config points to your devices registry file from the config store. Below there are examples for lights and thermostats.
Once you have cloned the repo, fill out your configuration files. Each device/entity will have 1 configuration file. Each set of homogenous devices such as lights will share one registry file.

For example below we have two seperate lights.

**lights**
```json
{
"driver_config": {
"ip_address": "Your Home Assistant IP",
"access_token": "Your Home Assistant Access Token",
"port": "Your Port"
"ip_address": "Your Home Assistant IP address",
"access_token": "Your Access Token",
"port": "Your port",
"entity_id": "light.example"
},
"driver_type": "home_assistant",
"registry_config":"config://light.example.json",
"registry_config":"config://lights.json",
"interval": 30,
"timezone": "UTC"
}
```
Your register file will contain one device, with the ability to add attributes. Entity ID is used to extract data from Home Assistant, and Volttron Point Name will get the state or attributes defined. In this example, the file name is light.example.json
```json
{
"driver_config": {
"ip_address": "Your Home Assistant IP address",
"access_token": "Your Access Token",
"port": "Your port",
"entity_id": "light.example2"
},
"driver_type": "home_assistant",
"registry_config":"config://lights.json",
"interval": 30,
"timezone": "UTC"
}
```
Both light.example and light.example2 will share this registry file below. Light states are currently converted to integers with 0 being off and 1 being on.

**light.example.json**
**lights.json**
```json
[
{
"Entity ID": "light.example",
"Volttron Point Name": "state",
"Units": "On / Off",
"Units Details": "on/off",
"Units Details": "0: off, 1: on",
"Writable": true,
"Starting Value": true,
"Type": "boolean",
"Notes": "lights hallway"
"Type": "int",
"Notes": "state control"
},
{
"Entity ID": "light.example",
"Volttron Point Name": "brightness",
"Units": "int",
"Units Details": "light level",
"Units Details": "0-255 light level",
"Writable": true,
"Starting Value": 0,
"Type": "int",
"Notes": "brightness control, 0 - 255"
"Notes": "brightness control"
}
]
```
**Thermostats**

For thermostats the state is converted into numbers. "1: Off, 2: heat, 3: Cool, 4: Auto",
For thermostats the state is also converted into numbers. "1: Off, 2: heat, 3: Cool, 4: Auto".
```json
[
{
"Entity ID": "climate.my_thermostat",
"Volttron Point Name": "state",
"Units": "Enumeration",
"Units Details": "1: Off, 2: heat, 3: Cool, 4: Auto",
"Units": "int",
"Units Details": "0: Off, 2: heat, 3: Cool, 4: Auto",
"Writable": true,
"Starting Value": 1,
"Type": "int",
Expand Down Expand Up @@ -103,18 +120,22 @@ For thermostats the state is converted into numbers. "1: Off, 2: heat, 3: Cool,
}
]
```
Attributes can be found in developer tools or by opening the device in the GUI of Home Assistant.
Attributes can be found in developer tools in the GUI of Home Assistant.

![image](https://github.com/riley206/Rileys_volttron/assets/89715390/a367e61e-8b73-4f35-a179-dfda235ddcbe)


**Add to config store**

Add the registers files and the config files into the VOLTTRON config store.


```bash
vctl config store platform.driver light.example.json HomeAssistant_Driver/light.example.json
vctl config store platform.driver lights.json PATH/TO/lights.json

vctl config store platform.driver devices/BUILDING/ROOM/light.example PATH/TO/light.example.config

vctl config store platform.driver devices/BUILDING/ROOM/light.example HomeAssistant_Driver/light.example.config
vctl config store platform.driver devices/BUILDING/ROOM/light.example2 PATH/TO/light.example2.config
```


Expand Down

0 comments on commit 6adcb4d

Please sign in to comment.