nspanel-lovelace-ui
nspanel-lovelace-ui copied to clipboard
[Feature Request] Alarm Control as cardEntities or cardGrid
Hi !
Thanks for the great work on that project, it's working really well !
FEATURE DESCRIPTION
It would be a nice feature to be able to display an alarm control in a cardEntities or a cardGrid view, and clicking on it would display the cardAlarm as a popup. More or less as displaying a cover entity and when clicking on it, you have the position and so on.
ADDITIONAL CONTEXT
N/A
PANEL / FIRMWARE VERION
EU
there is already a feature request for an alarm clock #378
I think there is a misunderstanding, I talking about a security alarm, not an alarm clock 😅
What I would like to achieve is, as an example:
cards:
- type: cardEntities
title: Test Entities Card
entities:
- entity: light.bed_light
- entity: switch.decorative_lights
- entity: cover.hall_window
- entity: alarm_control_panel.alarmo
or:
cards:
- type: cardGrid
title: Test Grid Card
entities:
- entity: alarm_control_panel.alarmo
- entity: switch.decorative_lights
- entity: sensor.outside_temperature
name: Outside Temp
- entity: sensor.carbon_monoxide
- entity: light.entrance_color_white_lights
name: Entrance
- entity: light.office_rgbw_lights
name: Office RGBW
icon: mdi:office-building
And clicking on the entity would popup the cardAlarm:
It should be possible to configure a navigate item to the card and override the staus with the alarm entity
Sure !
For the display in cardEntities and cardGrid, I've had a look at the code of pages.py and added before L260 the following "quick&dirty" code and it's displaying fine the Alarm control:
if entityType == "alarm_control_panel":
if entity.state == "disarmed":
icon_color = rgb_dec565([13,160,53])
icon_id = get_icon_id("shield-off")
if entity.state == "armed_home":
icon_color = rgb_dec565([223,76,30])
icon_id = get_icon_id("shield-home")
if entity.state == "armed_away":
icon_color = rgb_dec565([223,76,30])
icon_id = get_icon_id("shield-lock")
if entity.state == "armed_night":
icon_color = rgb_dec565([223,76,30])
icon_id = get_icon_id("weather-night")
if entity.state == "armed_vacation":
icon_color = rgb_dec565([223,76,30])
icon_id = get_icon_id("shield-airplane")
text = get_translation(self._locale, f"frontend.state_badge.alarm_control_panel.{entity.state}")
return f"~text~{entityId}~{icon_id}~{icon_color}~{name}~{text}"
I'm just now missing the way to actually push on the icon to navigate to the cardAlarm.
I will add states and icons for the alarm entities. (maybe also with an automatic link to an card alarm, have to see) However it should be possible to do all of this in the configuration without the need of editing code.
Oh I see ! I've made a quick PR #400 already, feel free to delete it then if it's not what you had in mind 😃
I will review it and update it if needed
Adding an example to navigate to a CardAlarm from the alarm panel entity:
cards:
- type: cardGrid
title: Example
entities:
- entity: navigate.cardAlarm_myAlarm
status: alarm_control_panel.my_alarm
name: My Alarm
hiddenCards:
- type: cardAlarm
title: My Alarm
entity: alarm_control_panel.my_alarm
key: myAlarm