Check if it's needed to pass the gateway instance to a device implementation
d-Rickyy-b opened this issue · comments
At the moment we are using the information about the gateway inside the device class to calculate the proper gateway header etc. From a software design PoV (abstraction) this is bad, because the device should not care about what gateway is being used to control it.
pyBrematic/pyBrematic/devices/brennenstuhl/RCS1000N.py
Lines 72 to 77 in fd7e45e
Now since I am looking closely at the PowerSwitch code and seeing that they have implemented it the same way, I am very curious if it would work the same by extracting this code into the gateway class.
While checking the PowerSwitch code I also noticed, that several header fields are set depending on the device itself in combination with a certain gateway. Now I am not sure if those variables are exchangeable and changing them wouldn't mess up everything, so I am very cautious about this issue.
Example:
$ grep -r "sSpeedConnAir = \""
bat/RC3500_A_IP44_DE.java: private String sSpeedConnAir = "14";
bat/RC_AAA1000_A_IP44_Outdoor.java: private String sSpeedConnAir = "14";
brennenstuhl/RCS1000NComfort.java: private String sSpeedConnAir = "14";
brennenstuhl/RCS1044NComfort.java: private String sSpeedConnAir = "14";
elro/AB440D_200W.java: private String sSpeedConnAir = "14";
elro/AB440D_300W.java: private String sSpeedConnAir = "14";
elro/AB440ID.java: private String sSpeedConnAir = "14";
elro/AB440L.java: private String sSpeedConnAir = "14";
elro/AB440S.java: private String sSpeedConnAir = "14";
elro/AB440WD.java: private String sSpeedConnAir = "14";
intertechno/CMR1000.java: private String sSpeedConnAir = "140";
intertechno/IT1500.java: private String sSpeedConnAir = "140";
intertechno/ITR1500.java: private String sSpeedConnAir = "140";
mumbi/m_FS300.java: private String sSpeedConnAir = "14";
pollin_electronic/Set2605.java: private String sSpeedConnAir = "14";
rev/Ritter.java: private String sSpeedConnAir = "14";
rev/Telecontrol.java: private String sSpeedConnAir = "16";
universal/HX2262_Comp.java: private String sSpeedConnAir = "140";
vivanco/FSS31000W.java: private String sSpeedConnAir = "14";
And
$ grep -r "headITGW = \""
bat/RC3500_A_IP44_DE.java: private String headITGW = "0,0,10,11200,350,26,0,";
bat/RC_AAA1000_A_IP44_Outdoor.java: private String headITGW = "0,0,10,11200,350,26,0,";
brennenstuhl/RCS1000NComfort.java: private String headITGW = "0,0,10,11200,350,26,0,";
brennenstuhl/RCS1044NComfort.java: private String headITGW = "0,0,10,11200,350,26,0,";
elro/AB440D_200W.java: private String headITGW = "0,0,10,11200,350,26,0,";
elro/AB440D_300W.java: private String headITGW = "0,0,10,11200,350,26,0,";
elro/AB440ID.java: private String headITGW = "0,0,10,11200,350,26,0,";
elro/AB440L.java: private String headITGW = "0,0,10,11200,350,26,0,";
elro/AB440S.java: private String headITGW = "0,0,10,11200,350,26,0,";
elro/AB440WD.java: private String headITGW = "0,0,10,11200,350,26,0,";
intertechno/CMR1000.java: private String headITGW = "0,0,6,11125,89,26,0,";
intertechno/IT1500.java: private String headITGW = "0,0,6,11125,89,26,0,";
intertechno/ITR1500.java: private String headITGW = "0,0,6,11125,89,26,0,";
mumbi/m_FS300.java: private String headITGW = "0,0,10,11200,350,26,0,";
pollin_electronic/Set2605.java: private String headITGW = "0,0,10,11200,350,26,0,";
rev/Ritter.java: private String headITGW = "0,0,10,11200,350,26,0,";
rev/Telecontrol.java: private String headITGW = "0,0,10,11200,350,26,0,";
universal/HX2262_Comp.java: private String headITGW = "0,0,6,11125,89,26,0,";
vivanco/FSS31000W.java: private String headITGW = "0,0,6,11200,350,26,0,";