Closed Markobu98 closed 3 years ago
I have this working for both LocalTuya and Xiaomi integration smart plugs. If you haven't figured it all out yet, let me know and I can share some configs.
@jeremysherriff thanks. I have got this working lately.
How did you resolved this? I have the same problem
How did you resolved this? I have the same problem
@fily1212 I'm happy to help. Please post your localtuya configuration here (either screenshots of the config screens for the devices, or the yaml, depending on how you add them to Home Assistant).
@jeremysherriff Hi, it works also for me! Thank you! I didn't figure out at the first time that I have to add "sensor" after "switch" in the GUI.
May I know the step if added from GUI?
The problem
I set up local tuya and it works and all. However I dicovered that my switches have the option to show power consumption. I checked the entities and I can see that the switches have the attributes current_consumption, voltage and current but there are no seperate entities for this. The I saw that you can create them using the sensor platform: template. I added the neccessary code but when I check my config it gives an error. What didi I do wrong?
Environment
Steps to reproduce
Configuration
configuration.yaml
orconfig_flow
Additional information
This is the error message I get:
Invalid config for [sensor.template]: invalid slug switch.marko_lampe_voltage (try switch_marko_lampe_voltage) for dictionary value @ data['sensors']. Got OrderedDict([('switch.marko_lampe_voltage', OrderedDict([('value_template', '{{ states.switch.marko_lampe.attributes.voltage }}'), ('unit_of_measurement', 'V')])), ('switch.marko_lampe_current', OrderedDict([('value_template', '{{ states.switch.marko_lampe.attributes.current }}'), ('unit_of_measurement', 'mA')])), ('switch.marko_lampe_current_consumption', OrderedDict([('value_template', '{{ states.switch.marko_lampe.attributes.current_consumption }}'), ('unit_of_measurement', 'W')]))]). (See ?, line ?).