Energy monitoring with LocalTuya zhijie, August 28, 2023September 30, 2023 For Tuya plugs / extensions added via LocalTuya in Home Assistant, the power used are not available for Home Assistant to use for the energy dashboard. This is because, the stats provided is in Watts. The energy dashboard requires kWh in order to be used. Here is how you can convert the energy stats provided by Tuya for Home Assistant to use. Identify your device Here is an example of a Tuya Device in my Home Assistant added via LocalTuya. You can see that it provides the following stats. Current Power Voltage We are interested in the stats provided by the Power field. Expose Tuya’s plug to Energy Dashboard In energy billing scenarios, energy is generally billed as kWh. However, these Tuya sensors are reporting in W (Watts). This does not allow Home Assistant to directly use it in the energy dashboard, hence we need to add a new helper to convert W to kWh. Go to Settings -> Devices & Services -> Add Integrations. We will be adding a new integration called Riemann sum integral sensor. The integration is available here if not installed on your home assistant. Integration – Riemann sum integral – Home Assistant (home-assistant.io). Fill in the details for your smart plug. We select the Trapezoidal rule because its the default option as stated in home assistant documentation. If you expect the source sensors to provide several subsequent values that are equal, then you should opt for the left method to get accurate readings. This configuration will provide you with a sensor that has your energy in kWh as a device_class of energy. Now we can add the device into our electrical grid in the energy dashboard. Share this:FacebookXLike this:Like Loading... Related Smart Home Energy DashboardHome AssistantLocalTuya