I have a thermostat but there isn't any swith in GUI to change mode I have an utility for that task.
I'm using a virtual switch, events and lua. And it's ok when I change the mode from GUI but when I change the mode from thermostat (manually) the virtual switch does'nt update so I want to use an script.
But I am not able to read the mode from thermo, otherdevice_utility doesn't work for this param. How coul I read the mode of thermostate.
Read Thermostat Mode
Moderator: leecollings
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Re: Read Thermostat Mode
Nobody has the same problem? Just read mode status from thermostat ... it must be dome because Gui shows the actual mode of thermostate so Lua ought be able to read this value.
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Re: Read Thermostat Mode
Well, I've studied the issue and I've found a patch. I would like if it's good or if it has "secondary effects".
I've changed in SQLHelper.cpp, about line 2952
AS you can see it calls updateValueInt with sValue = ""
I change this code to
Now sValue is equal to nValue, so Lus can read sValue of this devices like ThermostateMode or FanMode....
If anybody sees an hidden effect produced by this change, please answer. It nobody answer I create a pull in GitHub
Merry Christmas
I've changed in SQLHelper.cpp, about line 2952
Code: Select all
uint64_t CSQLHelper::UpdateValue(const int HardwareID, const char* ID, const unsigned char unit, const unsigned char devType, const unsigned char subType, const unsigned char signallevel, const unsigned char batterylevel, const int nValue, std::string &devname, const bool bUseOnOffAction)
{
return UpdateValue(HardwareID, ID, unit, devType, subType, signallevel, batterylevel, nValue, "", devname, bUseOnOffAction);
}
I change this code to
Code: Select all
uint64_t CSQLHelper::UpdateValue(const int HardwareID, const char* ID, const unsigned char unit, const unsigned char devType, const unsigned char subType, const unsigned char signallevel, const unsigned char batterylevel, const int nValue, std::string &devname, const bool bUseOnOffAction)
{
/*OJO Ever set sValue, so we can read sValues for any device in lua */
char sValue[200];
sprintf(sValue,"%d", nValue);
return UpdateValue(HardwareID, ID, unit, devType, subType, signallevel, batterylevel, nValue, sValue , devname, bUseOnOffAction);
}
If anybody sees an hidden effect produced by this change, please answer. It nobody answer I create a pull in GitHub
Merry Christmas
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Re: Read Thermostat Mode
Well I tried to send this modification to GitHub but Gizmocuz that this is not the way, although he doesn't give any reason.
So I wonder why some devices have to set sValues to "".
Anybody has an answer?
So I wonder why some devices have to set sValues to "".
Anybody has an answer?
Who is online
Users browsing this forum: No registered users and 0 guests