22from unittest .mock import Mock
33
44from PyViCare .PyViCareDeviceConfig import PyViCareDeviceConfig
5- from PyViCare .PyViCareService import hasRoles
5+ from PyViCare .PyViCareService import hasRoles , ViCareDeviceAccessor
66
77
88def has_roles (roles ):
@@ -12,165 +12,165 @@ def has_roles(roles):
1212class PyViCareDeviceConfigTest (unittest .TestCase ):
1313
1414 def setUp (self ) -> None :
15+ self .accessor = ViCareDeviceAccessor ("[id]" , "[serial]" , "[device]" )
1516 self .service = Mock ()
1617 self .service .hasRoles = has_roles ([])
1718
1819 def test_autoDetect_Vitodens_asGazBoiler (self ):
19- c = PyViCareDeviceConfig (
20- self .service , "0" , "E3_Vitodens_200_xxxx/E3_Dictionary" , "Online" )
20+ c = PyViCareDeviceConfig (self .accessor , self .service , "0" , "E3_Vitodens_200_xxxx/E3_Dictionary" , "Online" )
2121 device_type = c .asAutoDetectDevice ()
2222 self .assertEqual ("GazBoiler" , type (device_type ).__name__ )
2323
2424 def test_autoDetect_Unknown_asGeneric (self ):
25- c = PyViCareDeviceConfig (self .service , "0" , "myRobot" , "Online" )
25+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "myRobot" , "Online" )
2626 device_type = c .asAutoDetectDevice ()
2727 self .assertEqual ("HeatingDevice" , type (device_type ).__name__ )
2828
2929 def test_autoDetect_VScot_asGazBoiler (self ):
30- c = PyViCareDeviceConfig (self .service , "0" , "VScotHO1_200" , "Online" )
30+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "VScotHO1_200" , "Online" )
3131 device_type = c .asAutoDetectDevice ()
3232 self .assertEqual ("GazBoiler" , type (device_type ).__name__ )
3333
3434 def test_autoDetect_RoleBoiler_asGazBoiler (self ):
3535 self .service .hasRoles = has_roles (["type:boiler" ])
36- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
36+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
3737 device_type = c .asAutoDetectDevice ()
3838 self .assertEqual ("GazBoiler" , type (device_type ).__name__ )
3939
4040 def test_autoDetect_RoleHeatpump_asHeatpump (self ):
4141 self .service .hasRoles = has_roles (["type:heatpump" ])
42- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
42+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
4343 device_type = c .asAutoDetectDevice ()
4444 self .assertEqual ("HeatPump" , type (device_type ).__name__ )
4545
4646 def test_autoDetect_RoleRadiator_asRadiatorActuator (self ):
4747 self .service .hasRoles = has_roles (["type:radiator" ])
48- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
48+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
4949 device_type = c .asAutoDetectDevice ()
5050 self .assertEqual ("RadiatorActuator" , type (device_type ).__name__ )
5151
5252 def test_autoDetect_RoleClimateSensor_asRoomSensor (self ):
5353 self .service .hasRoles = has_roles (["type:climateSensor" ])
54- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
54+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
5555 device_type = c .asAutoDetectDevice ()
5656 self .assertEqual ("RoomSensor" , type (device_type ).__name__ )
5757
5858 def test_autoDetect_RoleVentilation_asVentilation (self ):
5959 self .service .hasRoles = has_roles (["type:ventilation" ])
60- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
60+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
6161 device_type = c .asAutoDetectDevice ()
6262 self .assertEqual ("VentilationDevice" , type (device_type ).__name__ )
6363
6464 def test_autoDetect_RoleVentilationCentral_asVentilation (self ):
6565 self .service .hasRoles = has_roles (["type:ventilation;central" ])
66- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
66+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
6767 device_type = c .asAutoDetectDevice ()
6868 self .assertEqual ("VentilationDevice" , type (device_type ).__name__ )
6969
7070 def test_autoDetect_Vitoair_FS_300F_asVentilation (self ):
71- c = PyViCareDeviceConfig (self .service , "0" , "E3_ViAir_300F" , "Online" )
71+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "E3_ViAir_300F" , "Online" )
7272 device_type = c .asAutoDetectDevice ()
7373 self .assertEqual ("VentilationDevice" , type (device_type ).__name__ )
7474
7575 def test_autoDetect_RoleVentilationPurifier_asVentilation (self ):
7676 self .service .hasRoles = has_roles (["type:ventilation;purifier" ])
77- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
77+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
7878 device_type = c .asAutoDetectDevice ()
7979 self .assertEqual ("VentilationDevice" , type (device_type ).__name__ )
8080
8181 def test_autoDetect_Vitopure_350_asVentilation (self ):
82- c = PyViCareDeviceConfig (self .service , "0" , "E3_VitoPure" , "Online" )
82+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "E3_VitoPure" , "Online" )
8383 device_type = c .asAutoDetectDevice ()
8484 self .assertEqual ("VentilationDevice" , type (device_type ).__name__ )
8585
8686 def test_autoDetect_RoleESS_asElectricalEnergySystem (self ):
8787 self .service .hasRoles = has_roles (["type:ess" ])
88- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
88+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
8989 device_type = c .asAutoDetectDevice ()
9090 self .assertEqual ("ElectricalEnergySystem" , type (device_type ).__name__ )
9191
9292 def test_autoDetect_Vitocharge05_asElectricalEnergySystem (self ):
93- c = PyViCareDeviceConfig (self .service , "0" , "E3_VitoCharge_05" , "Online" )
93+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "E3_VitoCharge_05" , "Online" )
9494 device_type = c .asAutoDetectDevice ()
9595 self .assertEqual ("ElectricalEnergySystem" , type (device_type ).__name__ )
9696
9797 def test_autoDetect_VitoconnectOpto1_asGateway (self ):
98- c = PyViCareDeviceConfig (self .service , "0" , "Heatbox1" , "Online" )
98+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Heatbox1" , "Online" )
9999 device_type = c .asAutoDetectDevice ()
100100 self .assertEqual ("Gateway" , type (device_type ).__name__ )
101101
102102 def test_autoDetect_VitoconnectOpto2_asGateway (self ):
103- c = PyViCareDeviceConfig (self .service , "0" , "Heatbox2_SRC" , "Online" )
103+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Heatbox2_SRC" , "Online" )
104104 device_type = c .asAutoDetectDevice ()
105105 self .assertEqual ("Gateway" , type (device_type ).__name__ )
106106
107107 def test_autoDetect_TCU100_asGateway (self ):
108- c = PyViCareDeviceConfig (self .service , "0" , "E3_TCU41_x04" , "Online" )
108+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "E3_TCU41_x04" , "Online" )
109109 device_type = c .asAutoDetectDevice ()
110110 self .assertEqual ("Gateway" , type (device_type ).__name__ )
111111
112112 def test_autoDetect_TCU200_asGateway (self ):
113- c = PyViCareDeviceConfig (self .service , "0" , "E3_TCU19_x05" , "Online" )
113+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "E3_TCU19_x05" , "Online" )
114114 device_type = c .asAutoDetectDevice ()
115115 self .assertEqual ("Gateway" , type (device_type ).__name__ )
116116
117117 def test_autoDetect_TCU300_asGateway (self ):
118- c = PyViCareDeviceConfig (self .service , "0" , "E3_TCU10_x07" , "Online" )
118+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "E3_TCU10_x07" , "Online" )
119119 device_type = c .asAutoDetectDevice ()
120120 self .assertEqual ("Gateway" , type (device_type ).__name__ )
121121
122122 def test_autoDetect_Ecotronic_asPelletsBoiler (self ):
123123 self .service .hasRoles = has_roles (["type:boiler" ])
124- c = PyViCareDeviceConfig (self .service , "0" , "Ecotronic" , "Online" )
124+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Ecotronic" , "Online" )
125125 device_type = c .asAutoDetectDevice ()
126126 self .assertEqual ("PelletsBoiler" , type (device_type ).__name__ )
127127
128128 def test_autoDetect_Vitoladens_asOilBoiler (self ):
129129 self .service .hasRoles = has_roles (["type:boiler" ])
130- c = PyViCareDeviceConfig (self .service , "0" , "Vitoladens" , "Online" )
130+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Vitoladens" , "Online" )
131131 device_type = c .asAutoDetectDevice ()
132132 self .assertEqual ("OilBoiler" , type (device_type ).__name__ )
133133
134134 def test_autoDetect_RoleGateway_asGateway (self ):
135135 self .service .hasRoles = has_roles (["type:gateway;VitoconnectOpto1" ])
136- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
136+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
137137 device_type = c .asAutoDetectDevice ()
138138 self .assertEqual ("Gateway" , type (device_type ).__name__ )
139139
140140 def test_autoDetect_RoleGateway_asGateway_vc_opto2 (self ):
141141 self .service .hasRoles = has_roles (["type:gateway;VitoconnectOpto2/OT2" ])
142- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
142+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
143143 device_type = c .asAutoDetectDevice ()
144144 self .assertEqual ("Gateway" , type (device_type ).__name__ )
145145
146146 def test_autoDetect_RoleGateway_asGateway_TCU100 (self ):
147147 self .service .hasRoles = has_roles (["type:gateway;TCU100" ])
148- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
148+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
149149 device_type = c .asAutoDetectDevice ()
150150 self .assertEqual ("Gateway" , type (device_type ).__name__ )
151151
152152 def test_autoDetect_RoleGateway_asGateway_TCU200 (self ):
153153 self .service .hasRoles = has_roles (["type:gateway;TCU200" ])
154- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
154+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
155155 device_type = c .asAutoDetectDevice ()
156156 self .assertEqual ("Gateway" , type (device_type ).__name__ )
157157
158158 def test_autoDetect_RoleGateway_asGateway_TCU300 (self ):
159159 self .service .hasRoles = has_roles (["type:gateway;TCU300" ])
160- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
160+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
161161 device_type = c .asAutoDetectDevice ()
162162 self .assertEqual ("Gateway" , type (device_type ).__name__ )
163163
164164 def test_legacy_device (self ):
165165 self .service .hasRoles = has_roles (["type:legacy" ])
166- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
166+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
167167 device = c .asAutoDetectDevice ()
168168 self .assertEqual (device .isLegacyDevice (), True )
169169 self .assertEqual (device .isE3Device (), False )
170170
171171 def test_e3_device (self ):
172172 self .service .hasRoles = has_roles (["type:E3" ])
173- c = PyViCareDeviceConfig (self .service , "0" , "Unknown" , "Online" )
173+ c = PyViCareDeviceConfig (self .accessor , self . service , "0" , "Unknown" , "Online" )
174174 device = c .asAutoDetectDevice ()
175175 self .assertEqual (device .isLegacyDevice (), False )
176176 self .assertEqual (device .isE3Device (), True )
0 commit comments