Skip to content

Commit

Permalink
Added initial support for Tuya smart plug (TS0121)
Browse files Browse the repository at this point in the history
  • Loading branch information
SwoopX committed Apr 11, 2020
1 parent 2100d64 commit 82d8e9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,8 @@ bool DeRestPluginPrivate::checkSensorBindingsForAttributeReporting(Sensor *senso
// Stelpro
sensor->modelId().contains(QLatin1String("ST218")) ||
// Tuya
sensor->modelId().contains(QLatin1String("TS0201")) ||
sensor->modelId().startsWith(QLatin1String("TS01")) ||
sensor->modelId().startsWith(QLatin1String("TS02")) ||
// Tuyatec
sensor->modelId().startsWith(QLatin1String("RH3040")) ||
sensor->modelId().startsWith(QLatin1String("RH3001")) ||
Expand Down
4 changes: 3 additions & 1 deletion de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ static const SupportedDevice supportedDevices[] = {
{ VENDOR_NONE, "RH3052", emberMacPrefix }, // Tuyatec temperature sensor
{ VENDOR_EMBER, "TS0201", silabs3MacPrefix }, // Tuya/Blitzwolf temperature and humidity sensor
{ VENDOR_NONE, "TS0204", silabs3MacPrefix }, // Tuya gas sensor
{ VENDOR_NONE, "TS0121", silabs3MacPrefix }, // Tuya/Blitzwolf smart plug
{ VENDOR_AURORA, "DoubleSocket50AU", jennicMacPrefix }, // Aurora AOne Double Socket UK
{ VENDOR_COMPUTIME, "SP600", computimeMacPrefix }, // Salus smart plug
{ VENDOR_HANGZHOU_IMAGIC, "1116-S", energyMiMacPrefix }, // iris contact sensor v3
Expand Down Expand Up @@ -7268,7 +7269,8 @@ void DeRestPluginPrivate::updateSensorNode(const deCONZ::NodeEvent &event)
i->modelId().startsWith(QLatin1String("outlet")) || // Samsung SmartThings IM6001-OTP/IM6001-OTP01
i->modelId() == QLatin1String("DoubleSocket50AU") || // Aurora
i->modelId() == QLatin1String("RICI01") || // LifeControl Smart Plug
i->modelId().startsWith(QLatin1String("SZ-ESW01"))) // Sercomm / Telstra smart plug
i->modelId().startsWith(QLatin1String("SZ-ESW01")) || // Sercomm / Telstra smart plug
i->modelId() == QLatin1String("TS0121")) // Tuya smart plug
{
// already in mA
}
Expand Down
3 changes: 2 additions & 1 deletion poll_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ void PollManager::pollTimerFired()
item = r->item(RAttrModelId);
if (!item->toString().startsWith(QLatin1String("SP 120")) && // Attribute is not available
!item->toString().startsWith(QLatin1String("lumi.plug.ma")) &&
!item->toString().startsWith(QLatin1String("ZB-ONOFFPlug-D0005")))
!item->toString().startsWith(QLatin1String("ZB-ONOFFPlug-D0005")) &&
!item->toString().startsWith(QLatin1String("TS0121")))
{
attributes.push_back(0x0400); // Instantaneous Demand
}
Expand Down

0 comments on commit 82d8e9a

Please sign in to comment.