@@ -64,7 +64,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
64
64
thestart = entry .data .get (CONF_START )
65
65
thestop = entry .data .get (CONF_STOP )
66
66
thescan = entry .data .get (CONF_SCAN_INTERVAL )
67
- thesubdevices = entry .data .get (CONF_SHOW_SUBDEVICES )
67
+ thesubdisplays = entry .data .get (CONF_SHOW_SUBDEVICES )
68
68
theblade_light = entry .data .get (CONF_SHOW_BLADELIGHT )
69
69
thestart_method = entry .data .get (CONF_START_METHOD )
70
70
thestart_body = entry .data .get (CONF_START_BODY )
@@ -78,7 +78,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
78
78
thestart ,
79
79
thestop ,
80
80
thescan ,
81
- thesubdevices ,
81
+ thesubdisplays ,
82
82
theblade_light ,
83
83
thestart_method ,
84
84
thestart_body ,
@@ -113,7 +113,7 @@ def __init__(
113
113
theport ,
114
114
thestart ,
115
115
thestop ,
116
- thesubdevices ,
116
+ thesubdisplays ,
117
117
theblade_light ,
118
118
thestart_method ,
119
119
thestart_body ,
@@ -126,10 +126,10 @@ def __init__(
126
126
self .thestop = thestop
127
127
self .connected = False
128
128
self .effect = "off"
129
- self .thesubdevices = thesubdevices
129
+ self .thesubdisplays = thesubdisplays
130
130
self .theblade_light = theblade_light
131
- self .devicestates = {}
132
- self .devices = {}
131
+ self .displaystates = {}
132
+ self .displays = {}
133
133
self .virtuals = {}
134
134
self .thestart_method = thestart_method
135
135
self .thestart_body = thestart_body
@@ -144,11 +144,11 @@ async def update(self):
144
144
url4 = "http://" + self .thehost + ":" + str (self .theport ) + "/api/virtuals"
145
145
yz = {}
146
146
rest_info = {}
147
- rest_devices = {}
147
+ rest_displays = {}
148
148
rest_scenes = {}
149
149
rest_virtuals = {}
150
150
yz ["rest_info" ] = {}
151
- yz ["rest_devices " ] = {}
151
+ yz ["rest_displays " ] = {}
152
152
yz ["rest_scenes" ] = {}
153
153
yz ["rest_virtuals" ] = {}
154
154
@@ -170,30 +170,30 @@ async def update(self):
170
170
return {}
171
171
172
172
try :
173
- async with session .get (url2 , ssl = False ) as resp_devices :
174
- if resp_devices .status == 200 :
175
- rest_devices = await resp_devices .json ()
176
- yz ["rest_devices " ] = rest_devices
177
- self .devices = yz ["rest_devices " ]
178
- if len (self .devicestates ) == 0 :
179
- for k in rest_devices ["displays" ]:
173
+ async with session .get (url2 , ssl = False ) as resp_displays :
174
+ if resp_displays .status == 200 :
175
+ rest_displays = await resp_displays .json ()
176
+ yz ["rest_displays " ] = rest_displays
177
+ self .displays = yz ["rest_displays " ]
178
+ if len (self .displaystates ) == 0 :
179
+ for k in rest_displays ["displays" ]:
180
180
if (
181
- len (rest_devices ["displays" ][k ].get ("effect" , {}))
181
+ len (rest_displays ["displays" ][k ].get ("effect" , {}))
182
182
> 0
183
183
):
184
- effect = rest_devices ["displays" ][k ].get ("effect" )
184
+ effect = rest_displays ["displays" ][k ].get ("effect" )
185
185
power = True
186
186
else :
187
187
188
188
effect = {}
189
189
power = False
190
- self .devicestates [k ] = {
190
+ self .displaystates [k ] = {
191
191
"power" : power ,
192
192
"effect" : effect ,
193
193
}
194
194
else :
195
195
logging .warning (
196
- "CANT CONNECT TO LEDFX - DEVICES: %s" , resp_devices .status
196
+ "CANT CONNECT TO LEDFX - DEVICES: %s" , resp_displays .status
197
197
)
198
198
199
199
except aiohttp .ClientConnectorError as e :
@@ -230,28 +230,28 @@ async def update(self):
230
230
# rest_info = await resp.json()
231
231
# yz["rest_info"] = rest_info
232
232
233
- # async with session.get(url2, ssl=False) as resp_devices :
234
- # rest_devices = await resp_devices .json()
235
- # yz["rest_devices "] = rest_devices
236
- # self.devices = yz["rest_devices "]
237
- # # logging.warning("INTERNAL STATES b4: %s", self.devicestates )
238
- # if len(self.devicestates ) == 0:
239
- # for k in rest_devices["devices "]:
233
+ # async with session.get(url2, ssl=False) as resp_displays :
234
+ # rest_displays = await resp_displays .json()
235
+ # yz["rest_displays "] = rest_displays
236
+ # self.displays = yz["rest_displays "]
237
+ # # logging.warning("INTERNAL STATES b4: %s", self.displaystates )
238
+ # if len(self.displaystates ) == 0:
239
+ # for k in rest_displays["displays "]:
240
240
# # logging.warning("NOWWW: %s", k)
241
- # # logging.warning("THENN: %s", rest_devices['devices '][k])
242
- # if len(rest_devices["devices "][k].get("effect", {})) > 0:
243
- # # logging.warning("GOT EFFECT FROM LEDFX: %s", rest_devices['devices '][k].get('effect'))
244
- # effect = rest_devices["devices "][k].get("effect")
241
+ # # logging.warning("THENN: %s", rest_displays['displays '][k])
242
+ # if len(rest_displays["displays "][k].get("effect", {})) > 0:
243
+ # # logging.warning("GOT EFFECT FROM LEDFX: %s", rest_displays['displays '][k].get('effect'))
244
+ # effect = rest_displays["displays "][k].get("effect")
245
245
# power = True
246
246
# else:
247
247
248
248
# effect = {}
249
249
# power = False
250
- # self.devicestates [k] = {
250
+ # self.displaystates [k] = {
251
251
# "power": power,
252
- # "effect": effect, # self.devicestates [k].get('effect', {})
252
+ # "effect": effect, # self.displaystates [k].get('effect', {})
253
253
# }
254
- # # logging.warning("INTERNAL STATES after: %s", self.devicestates )
254
+ # # logging.warning("INTERNAL STATES after: %s", self.displaystates )
255
255
256
256
# async with session.get(url3, ssl=False) as resp_scenes:
257
257
# rest_scenes = await resp_scenes.json()
@@ -262,10 +262,10 @@ async def update(self):
262
262
263
263
return {
264
264
"info" : rest_info ,
265
- "devices " : rest_devices ,
265
+ "displays " : rest_displays ,
266
266
"virtuals" : rest_virtuals ,
267
267
"scenes" : rest_scenes ,
268
- "show_subdevices " : self .thesubdevices ,
268
+ "show_subdisplays " : self .thesubdisplays ,
269
269
}
270
270
271
271
async def async_set_transition_time (self , time ):
@@ -345,13 +345,13 @@ async def async_set_scene(self, effect):
345
345
return None
346
346
347
347
async def async_device_off (self , state ):
348
- # logging.warning('DEVICE OFF internal --- %s --- %s', state, self.devicestates [state].get('effect'))
348
+ # logging.warning('DEVICE OFF internal --- %s --- %s', state, self.displaystates [state].get('effect'))
349
349
url4 = (
350
350
"http://"
351
351
+ self .thehost
352
352
+ ":"
353
353
+ str (self .theport )
354
- + "/api/devices /"
354
+ + "/api/displays /"
355
355
+ state
356
356
+ "/effects"
357
357
)
@@ -361,24 +361,24 @@ async def async_device_off(self, state):
361
361
async with session .get (url4 , ssl = False ) as get_effect :
362
362
testing = await get_effect .json ()
363
363
if testing ["effect" ] != {}:
364
- self .devicestates [state ]["effect" ] = testing ["effect" ]
365
- # logging.warning("Turning Off, found effect: %s", self.devicestates [state].get('effect'))
364
+ self .displaystates [state ]["effect" ] = testing ["effect" ]
365
+ # logging.warning("Turning Off, found effect: %s", self.displaystates [state].get('effect'))
366
366
async with session .delete (url4 , ssl = False ) as del_effect :
367
367
await del_effect .json ()
368
368
# else:
369
369
# logging.warning("Turning Off, No effect:")
370
370
371
- self .devicestates [state ]["power" ] = False
371
+ self .displaystates [state ]["power" ] = False
372
372
return None
373
373
374
374
async def async_device_on (self , state ):
375
- # logging.warning('DEVICE ON internal --- %s --- %s', state, self.devicestates [state].get('effect'))
375
+ # logging.warning('DEVICE ON internal --- %s --- %s', state, self.displaystates [state].get('effect'))
376
376
url4 = (
377
377
"http://"
378
378
+ self .thehost
379
379
+ ":"
380
380
+ str (self .theport )
381
- + "/api/devices /"
381
+ + "/api/displays /"
382
382
+ state
383
383
+ "/effects"
384
384
)
@@ -389,10 +389,10 @@ async def async_device_on(self, state):
389
389
testing = await get_effect .json ()
390
390
if testing ["effect" ] != {}:
391
391
# logging.warning("Turning on, found effect: %s", testing['effect'])
392
- self .devicestates [state ]["effect" ] = testing ["effect" ]
392
+ self .displaystates [state ]["effect" ] = testing ["effect" ]
393
393
394
- # payload = {'config': self.devicestates [state].get('effect').get('config')}
395
- payload = self .devicestates [state ].get ("effect" )
394
+ # payload = {'config': self.displaystates [state].get('effect').get('config')}
395
+ payload = self .displaystates [state ].get ("effect" )
396
396
397
397
if payload is None or payload == {}:
398
398
payload = {
@@ -416,7 +416,7 @@ async def async_device_on(self, state):
416
416
# logging.warning("Setting Effect, %s", payload)
417
417
async with session .post (url4 , json = payload , ssl = False ) as set_effect :
418
418
await set_effect .json ()
419
- self .devicestates [state ]["power" ] = True
419
+ self .displaystates [state ]["power" ] = True
420
420
return None
421
421
422
422
async def async_virtual_off (self , virtual ):
@@ -430,9 +430,9 @@ async def async_virtual_off(self, virtual):
430
430
for key in c :
431
431
# logging.warning(
432
432
# "BLADE OFF internal --- %s --- %s --- %s",
433
- # self.devices .get("devices ").get(key).get("config").get("name"),
434
- # self.devices .get("devices ").get(key).get("config").get("ip_address"),
435
- # self.devices .get("devices ").get(key).get("config").get("pixel_count"),
433
+ # self.displays .get("displays ").get(key).get("config").get("name"),
434
+ # self.displays .get("displays ").get(key).get("config").get("ip_address"),
435
+ # self.displays .get("displays ").get(key).get("config").get("pixel_count"),
436
436
# )
437
437
for i in range (key .get ("used_pixel" )):
438
438
@@ -521,7 +521,7 @@ def __init__(
521
521
theblade_light ,
522
522
thestop ,
523
523
thescan ,
524
- thesubdevices ,
524
+ thesubdisplays ,
525
525
thestart_method ,
526
526
thestart_body ,
527
527
thestop_method ,
@@ -535,7 +535,7 @@ def __init__(
535
535
self .thestop = thestop
536
536
self .thestart = thestart
537
537
self .thescan = thescan
538
- self .thesubdevices = thesubdevices
538
+ self .thesubdisplays = thesubdisplays
539
539
self .theblade_light = theblade_light
540
540
self .thestart_method = thestart_method
541
541
self .thestart_body = thestart_body
@@ -547,7 +547,7 @@ def __init__(
547
547
theport ,
548
548
thestart ,
549
549
thestop ,
550
- thesubdevices ,
550
+ thesubdisplays ,
551
551
theblade_light ,
552
552
thestart_method ,
553
553
thestart_body ,
@@ -564,17 +564,17 @@ async def _async_update_data(self):
564
564
# logging.warning('SCAN_INTERVAL_CHECK %s', self.thescan)
565
565
data = await self .api .update ()
566
566
scenes = {}
567
- devices = {}
567
+ displays = {}
568
568
virtuals = {}
569
569
# logging.warning("UPDATING %s", data)
570
570
if data != {}:
571
571
572
572
scenes = data .get ("scenes" ).get ("scenes" )
573
- devices = data .get ("devices " ).get ("devices " )
573
+ displays = data .get ("displays " ).get ("displays " )
574
574
if scenes != {}:
575
575
# logging.warning("UPDATING WTF %s", data)
576
576
self .scenes = scenes
577
- self .devices = devices
577
+ self .displays = displays
578
578
self .number_scenes = len (scenes )
579
579
self .lost = False
580
580
self .connected = True
@@ -605,7 +605,7 @@ async def _async_update_data(self):
605
605
return {
606
606
"info" : {"name" : "Not Ready" , "version" : "1.0" },
607
607
"scenes" : {"scenes" : {}},
608
- "devices " : {"devices " : {}},
608
+ "displays " : {"displays " : {}},
609
609
"virtuals" : {"virtuals" : {}},
610
610
}
611
611
0 commit comments