Add Lovelace dashboard configuration
This commit is contained in:
375
lovelace_device_control.yaml
Normal file
375
lovelace_device_control.yaml
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
# Lovelace Dashboard for OPNsense Device Control
|
||||||
|
# Optimized for tablet use with clear visual indicators
|
||||||
|
|
||||||
|
title: Network Control
|
||||||
|
views:
|
||||||
|
# Overview Tab
|
||||||
|
- title: Overview
|
||||||
|
path: overview
|
||||||
|
icon: mdi:home-network
|
||||||
|
cards:
|
||||||
|
# Master Control Card
|
||||||
|
- type: entities
|
||||||
|
title: Master Controls
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.parental_controls_enabled
|
||||||
|
name: Parental Controls
|
||||||
|
icon: mdi:shield-account
|
||||||
|
show_header_toggle: false
|
||||||
|
|
||||||
|
# Quick Stats
|
||||||
|
- type: horizontal-stack
|
||||||
|
cards:
|
||||||
|
- type: custom:button-card
|
||||||
|
entity: sensor.bella_devices_blocked_count
|
||||||
|
name: Bella
|
||||||
|
show_state: true
|
||||||
|
state_display: "[[[return entity.state + ' Blocked']]]"
|
||||||
|
icon: mdi:account-circle
|
||||||
|
styles:
|
||||||
|
card:
|
||||||
|
- height: 100px
|
||||||
|
icon:
|
||||||
|
- color: >
|
||||||
|
[[[
|
||||||
|
if (entity.state > 0) return 'red';
|
||||||
|
return 'green';
|
||||||
|
]]]
|
||||||
|
|
||||||
|
- type: custom:button-card
|
||||||
|
entity: sensor.xander_devices_blocked_count
|
||||||
|
name: Xander
|
||||||
|
show_state: true
|
||||||
|
state_display: "[[[return entity.state + ' Blocked']]]"
|
||||||
|
icon: mdi:account-circle
|
||||||
|
styles:
|
||||||
|
card:
|
||||||
|
- height: 100px
|
||||||
|
icon:
|
||||||
|
- color: >
|
||||||
|
[[[
|
||||||
|
if (entity.state > 0) return 'red';
|
||||||
|
return 'green';
|
||||||
|
]]]
|
||||||
|
|
||||||
|
- type: custom:button-card
|
||||||
|
entity: sensor.william_devices_blocked_count
|
||||||
|
name: William
|
||||||
|
show_state: true
|
||||||
|
state_display: "[[[return entity.state + ' Blocked']]]"
|
||||||
|
icon: mdi:account-circle
|
||||||
|
styles:
|
||||||
|
card:
|
||||||
|
- height: 100px
|
||||||
|
icon:
|
||||||
|
- color: >
|
||||||
|
[[[
|
||||||
|
if (entity.state > 0) return 'red';
|
||||||
|
return 'green';
|
||||||
|
]]]
|
||||||
|
|
||||||
|
# Network Status
|
||||||
|
- type: glance
|
||||||
|
title: Network Status
|
||||||
|
columns: 4
|
||||||
|
entities:
|
||||||
|
- entity: sensor.opnsense_wan_status
|
||||||
|
name: WAN
|
||||||
|
- entity: sensor.opnsense_lan_status
|
||||||
|
name: LAN
|
||||||
|
- entity: sensor.opnsense_cpu_usage
|
||||||
|
name: CPU
|
||||||
|
- entity: sensor.opnsense_memory_usage
|
||||||
|
name: Memory
|
||||||
|
|
||||||
|
# Bella's Devices Tab
|
||||||
|
- title: Bella
|
||||||
|
path: bella
|
||||||
|
icon: mdi:account-circle
|
||||||
|
badges:
|
||||||
|
- entity: sensor.bella_devices_blocked_count
|
||||||
|
cards:
|
||||||
|
# User-wide Block Toggle
|
||||||
|
- type: entities
|
||||||
|
title: Bella - Quick Actions
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_all_bella_devices
|
||||||
|
name: Block All Devices
|
||||||
|
icon: mdi:block-helper
|
||||||
|
show_header_toggle: false
|
||||||
|
|
||||||
|
# Bella's Phone
|
||||||
|
- type: entities
|
||||||
|
title: "Bella's Phone"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_bella_phone
|
||||||
|
name: Block Internet
|
||||||
|
icon: mdi:cellphone-off
|
||||||
|
- entity: input_select.device_user_bella_phone
|
||||||
|
name: Assigned To
|
||||||
|
- type: section
|
||||||
|
label: Device Details
|
||||||
|
- entity: input_text.mac_bella_phone
|
||||||
|
name: MAC Address
|
||||||
|
- entity: input_text.mac_bella_phone_wifi
|
||||||
|
name: WiFi MAC
|
||||||
|
- entity: device_tracker.bella_phone
|
||||||
|
name: Connection Status
|
||||||
|
|
||||||
|
# Bella's Tablet
|
||||||
|
- type: entities
|
||||||
|
title: "Bella's Tablet"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_bella_tablet
|
||||||
|
name: Block Internet
|
||||||
|
icon: mdi:tablet-off
|
||||||
|
- entity: input_select.device_user_bella_tablet
|
||||||
|
name: Assigned To
|
||||||
|
- type: section
|
||||||
|
label: Device Details
|
||||||
|
- entity: input_text.mac_bella_tablet
|
||||||
|
name: MAC Address
|
||||||
|
- entity: input_text.mac_bella_tablet_wifi
|
||||||
|
name: WiFi MAC
|
||||||
|
- entity: device_tracker.bella_tablet
|
||||||
|
name: Connection Status
|
||||||
|
|
||||||
|
# Schedule Card (placeholder for future time-based controls)
|
||||||
|
- type: markdown
|
||||||
|
title: Internet Schedule
|
||||||
|
content: >
|
||||||
|
**Weekday Access:** 3:00 PM - 8:00 PM
|
||||||
|
|
||||||
|
**Weekend Access:** 9:00 AM - 9:00 PM
|
||||||
|
|
||||||
|
*Schedule controls coming soon*
|
||||||
|
|
||||||
|
# Xander's Devices Tab
|
||||||
|
- title: Xander
|
||||||
|
path: xander
|
||||||
|
icon: mdi:account-circle
|
||||||
|
badges:
|
||||||
|
- entity: sensor.xander_devices_blocked_count
|
||||||
|
cards:
|
||||||
|
# User-wide Block Toggle
|
||||||
|
- type: entities
|
||||||
|
title: Xander - Quick Actions
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_all_xander_devices
|
||||||
|
name: Block All Devices
|
||||||
|
icon: mdi:block-helper
|
||||||
|
show_header_toggle: false
|
||||||
|
|
||||||
|
# Xander's Phone
|
||||||
|
- type: entities
|
||||||
|
title: "Xander's Phone"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_xander_phone
|
||||||
|
name: Block Internet
|
||||||
|
icon: mdi:cellphone-off
|
||||||
|
- entity: input_select.device_user_xander_phone
|
||||||
|
name: Assigned To
|
||||||
|
- type: section
|
||||||
|
label: Device Details
|
||||||
|
- entity: input_text.mac_xander_phone
|
||||||
|
name: MAC Address
|
||||||
|
- entity: input_text.mac_xander_phone_wifi
|
||||||
|
name: WiFi MAC
|
||||||
|
- entity: device_tracker.xander_phone
|
||||||
|
name: Connection Status
|
||||||
|
|
||||||
|
# Xander's Desktop
|
||||||
|
- type: entities
|
||||||
|
title: "Xander's Desktop"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_xander_desktop
|
||||||
|
name: Block Internet
|
||||||
|
icon: mdi:desktop-tower-off
|
||||||
|
- entity: input_select.device_user_xander_desktop
|
||||||
|
name: Assigned To
|
||||||
|
- type: section
|
||||||
|
label: Device Details
|
||||||
|
- entity: input_text.mac_xander_desktop
|
||||||
|
name: Wired MAC
|
||||||
|
- entity: input_text.mac_xander_desktop_wifi
|
||||||
|
name: WiFi MAC
|
||||||
|
- entity: device_tracker.xander_desktop
|
||||||
|
name: Connection Status
|
||||||
|
|
||||||
|
# Schedule Card
|
||||||
|
- type: markdown
|
||||||
|
title: Internet Schedule
|
||||||
|
content: >
|
||||||
|
**Weekday Access:** 3:00 PM - 9:00 PM
|
||||||
|
|
||||||
|
**Weekend Access:** 9:00 AM - 10:00 PM
|
||||||
|
|
||||||
|
*Schedule controls coming soon*
|
||||||
|
|
||||||
|
# William's Devices Tab
|
||||||
|
- title: William
|
||||||
|
path: william
|
||||||
|
icon: mdi:account-circle
|
||||||
|
badges:
|
||||||
|
- entity: sensor.william_devices_blocked_count
|
||||||
|
cards:
|
||||||
|
# User-wide Block Toggle
|
||||||
|
- type: entities
|
||||||
|
title: William - Quick Actions
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_all_william_devices
|
||||||
|
name: Block All Devices
|
||||||
|
icon: mdi:block-helper
|
||||||
|
show_header_toggle: false
|
||||||
|
|
||||||
|
# William's Phone
|
||||||
|
- type: entities
|
||||||
|
title: "William's Phone"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_william_phone
|
||||||
|
name: Block Internet
|
||||||
|
icon: mdi:cellphone-off
|
||||||
|
- entity: input_select.device_user_william_phone
|
||||||
|
name: Assigned To
|
||||||
|
- type: section
|
||||||
|
label: Device Details
|
||||||
|
- entity: input_text.mac_william_phone
|
||||||
|
name: MAC Address
|
||||||
|
- entity: input_text.mac_william_phone_wifi
|
||||||
|
name: WiFi MAC
|
||||||
|
- entity: device_tracker.william_phone
|
||||||
|
name: Connection Status
|
||||||
|
|
||||||
|
# William's Laptop
|
||||||
|
- type: entities
|
||||||
|
title: "William's Laptop"
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- entity: input_boolean.block_william_laptop
|
||||||
|
name: Block Internet
|
||||||
|
icon: mdi:laptop-off
|
||||||
|
- entity: input_select.device_user_william_laptop
|
||||||
|
name: Assigned To
|
||||||
|
- type: section
|
||||||
|
label: Device Details
|
||||||
|
- entity: input_text.mac_william_laptop
|
||||||
|
name: Wired MAC
|
||||||
|
- entity: input_text.mac_william_laptop_wifi
|
||||||
|
name: WiFi MAC
|
||||||
|
- entity: device_tracker.william_laptop
|
||||||
|
name: Connection Status
|
||||||
|
|
||||||
|
# Schedule Card
|
||||||
|
- type: markdown
|
||||||
|
title: Internet Schedule
|
||||||
|
content: >
|
||||||
|
**Weekday Access:** All Day (Age 17)
|
||||||
|
|
||||||
|
**Weekend Access:** All Day
|
||||||
|
|
||||||
|
*Schedule controls coming soon*
|
||||||
|
|
||||||
|
# Device Discovery Tab
|
||||||
|
- title: Devices
|
||||||
|
path: devices
|
||||||
|
icon: mdi:devices
|
||||||
|
cards:
|
||||||
|
- type: markdown
|
||||||
|
title: Device Discovery
|
||||||
|
content: >
|
||||||
|
Use the Python script to discover devices:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 opnsense_device_manager.py
|
||||||
|
```
|
||||||
|
|
||||||
|
This will show all devices on your network with their:
|
||||||
|
- MAC addresses
|
||||||
|
- IP addresses
|
||||||
|
- Manufacturers
|
||||||
|
- Suggested device names
|
||||||
|
|
||||||
|
- type: entities
|
||||||
|
title: All Devices on Network
|
||||||
|
entities:
|
||||||
|
- entity: sensor.opnsense_total_devices
|
||||||
|
name: Total Devices
|
||||||
|
- entity: sensor.opnsense_blocked_devices
|
||||||
|
name: Blocked Devices
|
||||||
|
- entity: sensor.opnsense_active_connections
|
||||||
|
name: Active Connections
|
||||||
|
|
||||||
|
# Placeholder for dynamic device list
|
||||||
|
- type: markdown
|
||||||
|
title: Recent Device Activity
|
||||||
|
content: >
|
||||||
|
*Device activity log coming soon*
|
||||||
|
|
||||||
|
# Settings Tab
|
||||||
|
- title: Settings
|
||||||
|
path: settings
|
||||||
|
icon: mdi:cog
|
||||||
|
cards:
|
||||||
|
- type: entities
|
||||||
|
title: OPNsense Connection
|
||||||
|
entities:
|
||||||
|
- entity: sensor.opnsense_status
|
||||||
|
name: Firewall Status
|
||||||
|
- entity: sensor.opnsense_last_update
|
||||||
|
name: Last Updated
|
||||||
|
- entity: binary_sensor.opnsense_connected
|
||||||
|
name: Connection Status
|
||||||
|
show_header_toggle: false
|
||||||
|
|
||||||
|
- type: entities
|
||||||
|
title: MAC Address Configuration
|
||||||
|
show_header_toggle: false
|
||||||
|
entities:
|
||||||
|
- type: section
|
||||||
|
label: "Bella's Devices"
|
||||||
|
- entity: input_text.mac_bella_phone
|
||||||
|
- entity: input_text.mac_bella_phone_wifi
|
||||||
|
- entity: input_text.mac_bella_tablet
|
||||||
|
- entity: input_text.mac_bella_tablet_wifi
|
||||||
|
- type: section
|
||||||
|
label: "Xander's Devices"
|
||||||
|
- entity: input_text.mac_xander_phone
|
||||||
|
- entity: input_text.mac_xander_phone_wifi
|
||||||
|
- entity: input_text.mac_xander_desktop
|
||||||
|
- entity: input_text.mac_xander_desktop_wifi
|
||||||
|
- type: section
|
||||||
|
label: "William's Devices"
|
||||||
|
- entity: input_text.mac_william_phone
|
||||||
|
- entity: input_text.mac_william_phone_wifi
|
||||||
|
- entity: input_text.mac_william_laptop
|
||||||
|
- entity: input_text.mac_william_laptop_wifi
|
||||||
|
|
||||||
|
- type: markdown
|
||||||
|
title: Setup Instructions
|
||||||
|
content: >
|
||||||
|
## Initial Setup
|
||||||
|
|
||||||
|
1. Run device discovery script to find MAC addresses
|
||||||
|
2. Enter MAC addresses in the fields above
|
||||||
|
3. Assign devices to users using the dropdown menus
|
||||||
|
4. Test blocking by toggling the block switches
|
||||||
|
|
||||||
|
## OPNsense API Setup
|
||||||
|
|
||||||
|
Add to secrets.yaml:
|
||||||
|
```yaml
|
||||||
|
opnsense_api_key: "your_api_key_here"
|
||||||
|
opnsense_api_secret: "your_api_secret_here"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
- Check OPNsense connection status above
|
||||||
|
- Verify API credentials in secrets.yaml
|
||||||
|
- Check firewall logs in OPNsense web UI
|
||||||
|
- Ensure MAC addresses are correct format
|
||||||
Reference in New Issue
Block a user