If you are using my tuyaGenericDevice the endpoint parameter is a number 0-99999... that is a true/false endpoint, so that when you click On() you send a message containing {endpoint_number: True} and Off(): {endpoint_number: False}. For any other types of endpoints you have to go into the driver and add/modify for whatever you need. Please see my tuyaWifiSiren as an example.
Based on the status message in your comment:
Status: {u'11' : 0, u'10' : 0, u'38' : u'memory', u'44' : u'', u'42' : u'', u'43' : u'', u'40' : u'relay', u'41' : False, u'1' : False, u'3' : False, u'2' : False, u'9' : 0}
Possible endpoints to control with On()/Off() (True/False) is 41, 1, 3, and 2. What they control you have to just experiment your way to. I will assume one of the endpoints 41, 1, 2, or 2 will control the actual output of the smartplug.
If you look to my tuyaWifiSiren example you see that the siren gives a status message as follows:
Status: {'101': '4', '102': '3', '103': 15, '104': False}
To control the siren sound type I write to a string based endpoint that I have found to be 102 in the following way:
def buf = generate_payload("set", ["102":type.toString()])
send(buf)
The "set"
is the "change something on the device" command, and the ["102":type.toString()]
contains the JSON message.