bewee / tuya-adapter

GNU General Public License v3.0
8 stars 8 forks source link

Add Support for Smart Plugs with Energy Monitoring #11

Closed nilsfed closed 4 years ago

nilsfed commented 4 years ago

Support for Tuya Smart Plugs with Energy Monitoring. Tested with my Gosund Smart Plugs, which have the following DPS layouts:

dps: {
    '1': false,     //on/off
    '9': 0,         //unknown/static 0
    '18': 0,            //electric current (mA)
    '19': 0,            //electric power(watt*10)
    '20': 2303,         //electric potential(volt*10)
    '21': 1,            //static/unknown.....
    '22': 715,
    '23': 30333,
    '24': 20561,
    '25': 1010
  }

You can leave the configuration field empty, which then gets automatically set to: {"dps":{"on":1,"unknown":9,"Electric Current in mA":18,"Electric Power in Watt/10":19,"Electric Potential in Volt/10":20},"sockets":1}

nilsfed commented 4 years ago

I had to add 2 commits for the linting to succeed, please squash the commits if this pull request should get merged :)

nilsfed commented 4 years ago

There is a Problem after restarting the gateway, i will fix this and then open this PR again