Tenda Beli Smart Plug SP3 config

I am new for HA. Installed HA docker in Qnap NAS container. When I tried to get Tenda Beli SP3 smart plug working. It tooks me a lot time to search and try. Finally I got them working. There are a few threads regarding this that I read and referenced (thanks to them). However, maybe there are a lot people like me that has limited lunix/pythom experience, I am a Microsoft Windows man. So create this thread to detail what should be done for beginners like me.

  1. There is no app in coummunity store (HACS) for Tenda Beli config.
  2. The Tenda Beli smart plug can be only setup as entity in HA without unique Id. So GUI can’t change it.
  3. To setup Tenda Beli smart plug, using RESTful Swith (not RESTful, nor RESTful senor, nor RESTful command). that is what I went wrong at first place. RESTful Switch - Home Assistant. And restful switch was already loaded with HA. No extra steps required.
  4. Tenda Beli Smart Plug SP3 using IP address with port 5000 to get states and etc. So first step you need set SP3 with static IP or my way is using DHCP reserved on router to get unique IP for each SP3.
  5. You need to be able to access configuration.yaml file somehow. A seperate thread will be created for my situation Qnap NAS container version.
  6. edit configuration.yaml. add following
    switch:

make sure indent are there. Sometimes, my version return errors if indent is not right. Maybe it is feature of pythom. I am not sure. Another times, I find copy/paste return error. Manual type works.
7. Always in HA GUI, goto developer tools, click check configuration button after update configuration.yaml. So you won’t stuff the whole HA system or cause system can’t boot. I believe this is very important. When check return error. my way to fix is remove all added section. And add it one by one line.

Notes: I think some experts may add script in api config section. but it beyond my knowledge so far.

After all done. restart HA. And you will find added name in entities section.
Useful link list here.

The problem with pasting when you use a non-code editor is windows “helpfully” changes your single and double quotes to “nicer” ones which are extended unicode.

This block should work, when the IP address is set correctly:

switch:
   - platform: rest
     resource: http://192.168.4.30:5000/setSta 
     state_resource: http://192.168.4.30:5000/getSta 
     name: Smart plug 1
     is_on_template: '{{ value_json.data.status == 1 }}'
     body_on: '{"status":1}'
     body_off: '{"status":0}'
     headers:
       Content-Type: application/json

I managed to use this code to control a Tenda SS9, works fine, but the SS9 is a dimmer, this code allows me ON/OFF … is there a way to pass dimmer values ?

thanks !

looks like there’s a status (get / set) that goes from 0-100 for dimmer

@POST("/getLightStatus")
k<JsonObject> getLightStatus();

@POST("/setLightStatus")
k<JsonObject> setLightStatus(@Body JsonObject jsonObject);

How can I incorporate this into the “Switch” code above ?