44 lines
1.3 KiB
YAML
44 lines
1.3 KiB
YAML
main_button_outdoors:
|
|
name: Main Button Outdoors
|
|
version: '1.1'
|
|
creator: Tony Stork
|
|
supported:
|
|
- button
|
|
description: Module to provide theming for outdoor floor buttons
|
|
code: |
|
|
${(() => {
|
|
const occupancy = hass?.states[this.config?.main_button_outdoors?.occupancy_entity]?.state || '';
|
|
|
|
let bg_color = 'var(--bubble-main-background-color)';
|
|
let occupied_color = 'var(--accent-color)';
|
|
|
|
// Main button background
|
|
const mainButton = card?.querySelector('.bubble-button-background');
|
|
if (mainButton) {
|
|
mainButton.style.opacity = '1';
|
|
mainButton.style.backgroundColor = occupancy === 'on' ? occupied_color : bg_color;
|
|
mainButton.style.transition = 'background-color 1s';
|
|
}
|
|
|
|
// Unavailable state
|
|
if (mainButton && occupancy === 'unavailable') {
|
|
mainButton.classList.add('is-unavailable');
|
|
} else if (mainButton) {
|
|
mainButton.classList.remove('is-unavailable');
|
|
}
|
|
|
|
// No CSS string needed
|
|
return '';
|
|
})()}
|
|
editor:
|
|
- type: expandable
|
|
title: Entity Configuration
|
|
icon: mdi:format-list-bulleted
|
|
schema:
|
|
- name: occupancy_entity
|
|
label: Occupancy Entity
|
|
selector:
|
|
entity:
|
|
device_class: occupancy
|
|
required: false
|