[Guide] How to add Tuya Energy (clamp) monitor to Home Assistant
What do we need?
– Home Assistant ( I have version 2024.8.2)
– GitHub account
— Prometheus exporter (optional)
— Grafana (optional)
– Tuya Energy Clamp ( PC311_W-TY) https://amzn.to/4cJd9G1
Step 1) HACS install
Initial Install of Home Assistant Community Store (HACS) on Home Assistant OS or Supervised
I will show you instructions about how to install Home Assistant Community Store if you are using Home Assistant OS or Home Assistant Supervised versions. These are the two of the supported installation methods of Home Assistant where you have Supervisor menu and Add-On store inside.
- Click on your Home Assistant username in the lower left corner and enable Advanced Mode if it’s not already active. If you don’t, the SSH add-ons required for the subsequent steps won’t be visible.
- Press the “c” key to bring up the search bar, enter “add-on” and navigate to the Add-On Store. Then, type “ssh,” select “Terminal & SSH” under the Official add-ons section, and click Install.
- Once the add-on installation is complete, click Start, followed by the OPEN WEB UI button to access the SSH console.
- Copy the following commands into it and press Enter. These are the commands for installing HACS.
wget -O - https://get.hacs.xyz | bash -
Initial install of Home Assistant Community Store (HACS) on Home Assistant Container
This section will provide a quick guide on installing HACS in the Home Assistant Container version, which is essentially Home Assistant operating within Docker. If your setup matches this description, continue reading; if not, please proceed to the following section as recommended.
With Home Assistant Container version you have two options:
Option 1:
- Run the installer script from the Host machine
- Change directory to your Home Assistant configuration directory
- Run the HACS install script
wget -O - https://get.hacs.xyz | bash -
Option 2:
- Run the installer inside the container.
- Go inside the container with
docker exec -it homeassistant bash
- Run the HACS install script
- Go inside the container with
wget -O - https://get.hacs.xyz | bash -
Add Home Assistant Community Store (HACS) in Home Assistant Integrations
Regardless of the method used to install Home Assistant, simply having the HACS files correctly placed is not sufficient. It is necessary to complete the initial configuration of HACS.
Here is how.
- First, restart your Home Assistant. Press the “c” button to invoke the search bar, start typing restart and select Restart Server.
- After Home Assistant has started, hit refresh button on your browser (or even you can clear your cache).
- Press the “c” button to invoke the search bar, start typing integrations and select Navigate Integrations > Add Integration (lower right corner) > search for hacs > click on the result and after a while you will see a dialog where you have to select every checkbox (4 of them) and to click Submit button.
- On the next dialog, you will have a link to GitHub and a code. Copy the code and click on the link. Log in with your GitHub account and paste the code, then hit the continue > authorize hacs buttons.
Enable AppDaemon & NetDaemon apps in HACS
You can further enable AppDaemon and NetDaemon apps discovery & tracking. In simple words these are more option to customize your Home Assistant. To enable them just go to HACS options and check the boxes next to AppDaemon and NetDaemon apps, then click submit.
Getting Device ID and Key
{'dps': {'1': 14039, '2': 0, '9': 2346, '101': 5460, '102': 0, '103': 8579, '104': 0, '105': 10210, '106': 2446, '107': 7683, '108': 1872, '109': 100, '110': 2527, '111': 474, '112': 77, '115': -165, '116': -396, '117': 50, '118': 0, '119': 0, '120': 0, '121': 0, '122': 3}}
Let's break this down:
ID | Name | Value |
1 | Total Energy (wattage) | |
2 | ||
9 | Power/Wattage (now) | |
101 | Circuit 1 (wattage) | |
102 | ||
103 | Circuit 2 (wattage) | |
104 | ||
105 | Current/ Amperage (now) | |
106 | Voltage (now) | |
107 | Circuit 1 Amperage (now) | |
108 | ||
109 | ||
100 | ||
110 | ||
111 | ||
112 | ||
115 | ||
116 | ||
117 | Power Frequency | |
118 | ||
119 | ||
120 | ||
121 | ||
122 |