And how do I create this sensor? While adding the device to localtuya or some other way?
[Edit]
I tried adding the device again, made a Switch and one Sensor on the (what I think is) the _current_consumption DP.
Then I used the sensor with the same Integration settings as you had in your yaml, but I get “unknown” as a state, see below:
[Edit 2] - Seems I got it working with the settings below. I just had to wait for the data to aggregate I think. I think the problem with the other sensor is with how frequently the socket measures, added a comment here about that.