Restructure bubble card modules folder
This commit is contained in:
24
bubble/Main Button Outdoors/code.js
Normal file
24
bubble/Main Button Outdoors/code.js
Normal file
@ -0,0 +1,24 @@
|
||||
${(() => {
|
||||
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 '';
|
||||
})()}
|
10
bubble/Main Button Outdoors/editor.yaml
Normal file
10
bubble/Main Button Outdoors/editor.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
- type: expandable
|
||||
title: Entity Configuration
|
||||
icon: mdi:format-list-bulleted
|
||||
schema:
|
||||
- name: occupancy_entity
|
||||
label: Occupancy Entity
|
||||
selector:
|
||||
entity:
|
||||
device_class: occupancy
|
||||
required: false
|
43
bubble/Main Button Outdoors/import.yaml
Normal file
43
bubble/Main Button Outdoors/import.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
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
|
Reference in New Issue
Block a user