Closed emoncuit closed 5 years ago
I found a workaround. In fact, the blyss module has to have a unit code with 2 characters. I have tried with "11" but domoticz sends "C" to the RFlink gateway. Domoticz has converted the value in hexadecimal. So I have set A1 as unit code to the module and 161 (A1 in decimal) in Domoticz. With this value, Domoticz sends well A1 and the switch works ! I have changed the code in updating the database with SQLiteManager.
I hope you can fix this issue in Domoticz.
What is you domoticz version? In my 3.8975 (git cloned from development branch) works fine with rflink.
I use the last stable version 3.8153. How can you install this version?
"Compiling from source code" https://github.com/domoticz/domoticz/blob/development/INSTALL.md
Ehmmm no. better follow the updated wiki
https://www.domoticz.com/wiki/Raspberry_Pi_-_Build_Domoticz_from_source
(This works on most linux systems like Ubuntu/Debian)
Hi, It's more subtle...
My Blyss 582866 module sends these commands :
20;01;Blyss;ID=3fae;SWITCH=G1;CMD=ON;
20;02;Blyss;ID=3fae;SWITCH=G1;CMD=OFF;
In fact, the unit ID is not hexadecimal ! Even with a manual database update, it's not possible to specify the unit code "G1".
An Idea will be to store unit ID in another way : Instead of store directly ID as hex value (which is wrong sometimes), we can use hex code for each character. For example, when unit ID is "G1", we ca convert it to 0x4731 (0x47 means G, 0x31 means 1).
If I'm right, "unitcode" is stored as "int32_t". So, it can work without big changes.
Problem is for backward compatibility. Maybe, we can try this :
if unitID is really hex value, store it as usual (backward compatibility) else, store is with this new method
When we read it :
if unitID is below 0xFF, assume we have used old method else, we have used new method
Still here ? :wink: Do you think my reasoning is good ?
Your correct, you can use it like this. I don't know if users have many blyss devices, if not, i think this change is mandatory and existing users will have to use the new switches that will appear after the patch
You might need to convert to hex, and then to integer again and use this as unit value
https://stackoverflow.com/questions/3381614/c-convert-string-to-hexadecimal-and-vice-versa
I have tried an update in RFLinkBase.cpp
.
Now, I can interpret correctly unitID as described above.
But, I have another problem : Even with updated functions, Domoticz only store one byte in database, and read only one byte. Even if unitID have two.
If I'm right, problem is due to Domoticz database storage/reading functions (SQLHelper.cpp
):
For example, function InsertDevice
is using unsigned char instead of integer for unit
declaration :
InsertDevice(const int HardwareID, const char* ID, const unsigned char unit, const unsigned char devType, ...
I'm not experienced enough to modify this part Domoticz without side effects.
@BmdOnline , you're right about that... the database has no limit, but that function does Lots have to be rebuild What kind of module is it ? (Blyss modules 582866), are you not better getting yourself a klik-aan-klik-uit or similar device ? (which works perfectly)
For now, I have several 582866 modules, and tried to use them. If I can do something with them, that's fine. Otherwise I'll give up.
In the meantime, I have other devices (MySensors, Zigbee) without any problems. I don't know klik-aan-klik-uit.
@BmdOnline , they probably have other compatible brand names like Chacon / CoCo Can't you set the ID inside the Blyss module so you do not need such a high ID ? But, A1, B1, C1 these are just numbers, in hex still a uint8_t like A1=161
No, unfortunately, we can't change the unit ID.
Okey, but... why not put the ID inside the DeviceID (where it could) and set the unit to 1 ?
So your device ID could be
3FAE4731 (3fae and G1)
I think i did it... when you send "10;Blyss;003fae;G1;ON;" does it go on ?
Could you test beta 10407 ?
Could be you need to enable 'accept new devices' in the settings, you will get new switches You need to use these switches and remove the old ones
I was thinking about something like that too. I'm going to test.
I've tried it. It works. You may cleanup the code, but it's ok.
Comment CRFLinkBase
:
ParseLine("20;01;Blyss;ID=3fae;SWITCH=G1;CMD=ON;");
Comment SendSwitchInt
:
WriteToHardware((const char*)&gswitch, sizeof(gswitch));
And, maybe... avoid using "Blyss" string, in ParseLine
:
if ((switchType == "Blyss")&&(results[4].size()==9))
With :
if ((GetGeneralRFLinkFromString(rfswitches, switchType) == sSwitchTypeBlyss)&&(results[4].size()==9))
Thanks.
Well... I have another problem :disappointed:
For previous example, Domoticz is sending
RFLink Sending: 10;Blyss;003fae;G1;OFF;
And it's OK.
But for two other ones, I have
RFLink Sending: 10;Blyss;ffffc65c;G1;OFF;
and
RFLink Sending: 10;Blyss;ffff82ac;G1;OFF;
Normally, it should be :
RFLink Sending: 10;Blyss;0000c65c;G1;OFF;
and
RFLink Sending: 10;Blyss;000082ac;G1;OFF;
Got it !
Use (pSwitch->id >> 16) & 0xFFFF
instead of (pSwitch->id >> 16)
when constructing command to send (in WriteToHardware
)
Seems better.
Sorry, yeah forgot to cleanup the code, just done so (beta 10409) Nothing wrong with using Blyss as string
So you are sure you are working with your new switches ? Can you post here what is received ? (the c65c and 82ac incomming)
Okey, see what you mean, please try beta 10410
Tried beta 10411, all seems good. Thanks again.
Thanks for the feedback !
It's not possible to command a blyss module 582866 in Domoticz with a RFlink gateway. It's not possible in Domoticz to set an unit device like A1, B1, C1 (required for Blyss modules). Domoticz accepts only a value from 1 to 16 for the Blyss switch type. Could you fix this issue?
Regards,
Emmanuel