Page 1 of 1
S_DIMMER sending wrong value?
Posted: Saturday 18 November 2017 7:18
by Flopp
I am using v3.8740
When using S_DIMMER I get a device with Type=Light/Switch and Subtype=AC. I add it to see I can see it under Switches.
Under Switch I edit the device to be a Dimmer(Switch Type)
I can change it and my Node can request the device number. I request for V_PERCENTAGE. In my Node I get a value between 0-660. I was excepting a value between 0-100, since it is percentage. Sometimes a get a value between 0-100 but most of the times I get between 0-660.
Re: S_DIMMER sending wrong value?
Posted: Wednesday 10 January 2018 22:53
by TokTias
I'm bumping this since I am suffering from exactly the same problem. I'm currently on version 3.8796.
Cheers !
Re: S_DIMMER sending wrong value?
Posted: Thursday 11 January 2018 7:31
by Flopp
I am also getting a value between 0-660 when asking for percentage
Re: S_DIMMER sending wrong value?
Posted: Thursday 11 January 2018 23:05
by TokTias
Hi !
I think I found out what's wrong in MySensorsBase.cpp :
In the last lines in MySensorsBase::GetSwitchValue(const int Idx, const int SubUnit, const int sub_type, std::string &sSwitchValue) :
should be :
Because the dimmer value ("slevel") is stored as 0-100 in the database.
And while I was at it, I also found in MySensorsBase::WriteToHardware(const char *pdata, const unsigned char length) that I assume is an error too (?) :
Code: Select all
float fvalue = (100.0f / 14.0f)*float(pCmd->LIGHTING2.level);
that should be
Code: Select all
float fvalue = (100.0f / 15.0f)*float(pCmd->LIGHTING2.level);
Now, I don't know how to submit these changes myself yet, so if someone else can do this pleae, or shall I take some time to make it myself ?
Cheers !
/T
Re: S_DIMMER sending wrong value?
Posted: Tuesday 16 January 2018 0:28
by TokTias
Edit:
Looks like I managet to push my changes do the development branch in github now

Just waitng for it to be available some day now.
/T
Kind of giving up now since I can't push my updates back to github

Is there some kind soul who can include the two bugfixes I list in the post above, plus add the handling I_INCLUSION_MODE message in the first case-statement in MySensorsBase::ParseLine() ?
Code: Select all
case I_INCLUSION_MODE:
_log.Log(LOG_NORM, "MySensors: Inclusion mode=%s", payload.c_str());
m_sql.m_bAcceptNewHardware = atoi(payload.c_str()) ? true : false;
break;
Cheers & TIA !
/T