You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
3.0 KiB

  1. diff --git a/hardware/evohome.cpp b/hardware/evohome.cpp
  2. index fcbee6d..f77291e 100644
  3. --- a/hardware/evohome.cpp
  4. +++ b/hardware/evohome.cpp
  5. @@ -423,11 +423,11 @@ void CEvohome::RunScript(const char *pdata, const unsigned char length)
  6. boost::replace_all(OnAction, "{state}", s_strid.str());
  7. boost::replace_all(OnAction, "{until}", CEvohomeDateTime::GetISODate(tsen->EVOHOME2));
  8. //Execute possible script
  9. - std::string scriptname;
  10. - if (OnAction.find("script:///") != std::string::npos)
  11. - scriptname = OnAction.substr(9);
  12. - else
  13. - scriptname = OnAction.substr(8);
  14. + std::string scriptname = OnAction.substr(9);
  15. +#if !defined WIN32
  16. + if (scriptname.find("/") != 0)
  17. + scriptname = szUserDataFolder + "scripts/" + scriptname;
  18. +#endif
  19. std::string scriptparams="";
  20. //Add parameters
  21. int pindex=scriptname.find(' ');
  22. @@ -439,7 +439,7 @@ void CEvohome::RunScript(const char *pdata, const unsigned char length)
  23. if (file_exist(scriptname.c_str()))
  24. {
  25. - m_sql.AddTaskItem(_tTaskItem::ExecuteScript(1,scriptname,scriptparams));
  26. + m_sql.AddTaskItem(_tTaskItem::ExecuteScript(0.2f,scriptname,scriptparams));
  27. }
  28. else
  29. _log.Log(LOG_ERROR,"evohome: Error script not found '%s'",scriptname.c_str());
  30. @@ -1321,7 +1321,7 @@ bool CEvohome::DecodeZoneName(CEvohomeMsg &msg)
  31. }
  32. if(memcmp(&msg.payload[2],m_szNameErr,18)==0)
  33. {
  34. - Log(true,LOG_STATUS,"evohome: %s: Warning zone name not set: %d", tag, msg.payload[0]);
  35. + Log(true,LOG_STATUS,"evohome: %s: Warning zone name not set: %d", tag, msg.payload[0]+1);
  36. m_bStartup[0]=false;
  37. return true;
  38. }
  39. @@ -1606,9 +1606,11 @@ bool CEvohome::DecodeBatteryInfo(CEvohomeMsg &msg)
  40. RFX_SETID3(msg.GetID(0),tsen.EVOHOME2.id1,tsen.EVOHOME2.id2,tsen.EVOHOME2.id3)
  41. tsen.EVOHOME2.updatetype = updBattery;
  42. - double dbCharge=0;
  43. - if(nBattery!=0xFF)
  44. - dbCharge=(double)nBattery/2.0; //Presumed to be the charge level where sent
  45. + if (nBattery == 0xFF)
  46. + nBattery = 100; // recode full battery (0xFF) to 100 for consistency across device types
  47. + else
  48. + nBattery = nBattery / 2; // recode battery level values to 0-100 from original 0-200 values
  49. +
  50. if(nLowBat==0)
  51. nBattery=0;
  52. tsen.EVOHOME2.battery_level=nBattery;
  53. @@ -1657,9 +1659,11 @@ bool CEvohome::DecodeBatteryInfo(CEvohomeMsg &msg)
  54. tsen.EVOHOME2.type=pTypeEvohomeWater;
  55. tsen.EVOHOME2.subtype=sTypeEvohomeWater;
  56. tsen.EVOHOME2.zone=nDevNo;
  57. - sDecodeRXMessage(this, (const unsigned char *)&tsen.EVOHOME2, NULL, nBattery);
  58. + RFX_SETID3(GetControllerID(), tsen.EVOHOME2.id1, tsen.EVOHOME2.id2, tsen.EVOHOME2.id3);
  59. + sDecodeRXMessage(this, (const unsigned char *)&tsen.EVOHOME2, "DHW Temp", nBattery); // Update DHW Zone sensor
  60. }
  61. - Log(true,LOG_STATUS,"evohome: %s: %s=%d charge=%d (%.1f %%) level=%d (%s)",tag,szType.c_str(),nDevNo,nBattery,dbCharge,nLowBat,(nLowBat==0)?"Low":"OK");
  62. +
  63. + Log(true,LOG_STATUS,"evohome: %s: %s=%d charge=%d(%%) level=%d (%s)",tag,szType.c_str(),nDevNo,nBattery,nLowBat,(nLowBat==0)?"Low":"OK");
  64. return true;
  65. }