Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
4f2be58f
Unverified
Commit
4f2be58f
authored
3 years ago
by
Simone Chemelli
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix wifi switches name for Fritz (#66529)
parent
7e3d87a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/fritz/const.py
+2
-0
2 additions, 0 deletions
homeassistant/components/fritz/const.py
homeassistant/components/fritz/switch.py
+35
-22
35 additions, 22 deletions
homeassistant/components/fritz/switch.py
with
37 additions
and
22 deletions
homeassistant/components/fritz/const.py
+
2
−
0
View file @
4f2be58f
...
...
@@ -64,3 +64,5 @@ FRITZ_EXCEPTIONS = (
FritzServiceError
,
FritzLookUpError
,
)
WIFI_STANDARD
=
{
1
:
"
2.4Ghz
"
,
2
:
"
5Ghz
"
,
3
:
"
5Ghz
"
,
4
:
"
Guest
"
}
This diff is collapsed.
Click to expand it.
homeassistant/components/fritz/switch.py
+
35
−
22
View file @
4f2be58f
...
...
@@ -31,6 +31,7 @@ from .const import (
SWITCH_TYPE_DEFLECTION
,
SWITCH_TYPE_PORTFORWARD
,
SWITCH_TYPE_WIFINETWORK
,
WIFI_STANDARD
,
MeshRoles
,
)
...
...
@@ -141,31 +142,43 @@ def wifi_entities_list(
)
->
list
[
FritzBoxWifiSwitch
]:
"""
Get list of wifi entities.
"""
_LOGGER
.
debug
(
"
Setting up %s switches
"
,
SWITCH_TYPE_WIFINETWORK
)
std_table
=
{
"
ax
"
:
"
Wifi6
"
,
"
ac
"
:
"
5Ghz
"
,
"
n
"
:
"
2.4Ghz
"
}
if
avm_wrapper
.
model
==
"
FRITZ!Box 7390
"
:
std_table
=
{
"
n
"
:
"
5Ghz
"
}
#
# https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/wlanconfigSCPD.pdf
#
wifi_count
=
len
(
[
s
for
s
in
avm_wrapper
.
connection
.
services
if
s
.
startswith
(
"
WLANConfiguration
"
)
]
)
_LOGGER
.
debug
(
"
WiFi networks count: %s
"
,
wifi_count
)
networks
:
dict
=
{}
for
i
in
range
(
4
):
if
not
(
"
WLANConfiguration
"
+
str
(
i
))
in
avm_wrapper
.
connection
.
services
:
continue
network_info
=
avm_wrapper
.
get_wlan_configuration
(
i
)
if
network_info
:
ssid
=
network_info
[
"
NewSSID
"
]
_LOGGER
.
debug
(
"
SSID from device: <%s>
"
,
ssid
)
if
slugify
(
ssid
,
)
in
[
slugify
(
v
)
for
v
in
networks
.
values
()]:
_LOGGER
.
debug
(
"
SSID duplicated, adding suffix
"
)
networks
[
i
]
=
f
'
{
ssid
}
{
std_table
[
network_info
[
"
NewStandard
"
]]
}
'
else
:
networks
[
i
]
=
ssid
_LOGGER
.
debug
(
"
SSID normalized: <%s>
"
,
networks
[
i
])
for
i
in
range
(
1
,
wifi_count
+
1
):
network_info
=
avm_wrapper
.
connection
.
call_action
(
f
"
WLANConfiguration
{
i
}
"
,
"
GetInfo
"
)
# Devices with 4 WLAN services, use the 2nd for internal communications
if
not
(
wifi_count
==
4
and
i
==
2
):
networks
[
i
]
=
{
"
ssid
"
:
network_info
[
"
NewSSID
"
],
"
bssid
"
:
network_info
[
"
NewBSSID
"
],
"
standard
"
:
network_info
[
"
NewStandard
"
],
"
enabled
"
:
network_info
[
"
NewEnable
"
],
"
status
"
:
network_info
[
"
NewStatus
"
],
}
for
i
,
network
in
networks
.
copy
().
items
():
networks
[
i
][
"
switch_name
"
]
=
network
[
"
ssid
"
]
if
len
([
j
for
j
,
n
in
networks
.
items
()
if
n
[
"
ssid
"
]
==
network
[
"
ssid
"
]])
>
1
:
networks
[
i
][
"
switch_name
"
]
+=
f
"
(
{
WIFI_STANDARD
[
i
]
}
)
"
_LOGGER
.
debug
(
"
WiFi networks list: %s
"
,
networks
)
return
[
FritzBoxWifiSwitch
(
avm_wrapper
,
device_friendly_name
,
net
,
network_name
)
for
net
,
network_name
in
networks
.
items
()
FritzBoxWifiSwitch
(
avm_wrapper
,
device_friendly_name
,
index
,
data
[
"
switch_name
"
]
)
for
index
,
data
in
networks
.
items
()
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment