Skip to content

Commit dbcb88e

Browse files
authored
Merge pull request #1 from MagicMicky/develop
3.2.0
2 parents 75455d5 + df89232 commit dbcb88e

22 files changed

+1781
-473
lines changed

CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Changelog
2+
3+
All notable changes to the Calendar Heatmap Card will be documented in this file.
4+
5+
## [3.2.0] - 2023-03-01
6+
7+
### Added
8+
- Advanced theme-aware color handling that automatically adapts to light/dark modes
9+
- Intelligent color intensity scaling for better visual differentiation between activity durations
10+
- Stepped intensity approach with specific thresholds for common gaming session durations
11+
- Theme detection for parent elements to support cards inside dashboards with different themes
12+
- Data attribute for intensity values to aid in debugging
13+
- Comprehensive error handling throughout the codebase
14+
15+
### Changed
16+
- Improved visual differentiation between different activity durations
17+
- Enhanced contrast for better readability in both light and dark themes
18+
- Refined color adjustment algorithm to ensure optimal visibility
19+
- Updated README with new theming information and troubleshooting section
20+
- Removed manual theme configuration option in favor of automatic detection
21+
22+
### Fixed
23+
- Fixed "Invalid time value" errors when processing history data
24+
- Improved handling of invalid dates throughout the application
25+
- Enhanced error resilience when fetching historical data
26+
- Better handling of "no data" colors with appropriate opacity
27+
28+
## [3.1.1] - 2023-02-15
29+
30+
### Fixed
31+
- Fixed an issue with date handling in the history service
32+
- Improved error handling for WebSocket API calls
33+
34+
## [3.1.0] - 2023-02-01
35+
36+
### Added
37+
- Support for localized day and month names
38+
- Configurable week start day (Monday or Sunday)
39+
- Responsive design improvements for mobile devices
40+
41+
### Changed
42+
- Improved performance for large datasets
43+
- Enhanced visual appearance with subtle shadows and hover effects
44+
45+
## [3.0.0] - 2023-01-15
46+
47+
### Added
48+
- Complete rewrite using a modular architecture
49+
- Detailed breakdown of activity on hover and click
50+
- Auto-refresh at configurable intervals
51+
- Support for Home Assistant themes
52+
53+
### Changed
54+
- Improved performance and reliability
55+
- Enhanced visual design
56+
- Better error handling
57+
58+
## [2.0.0] - 2022-12-01
59+
60+
### Added
61+
- Support for Home Assistant 2022.12.0
62+
- Improved color handling
63+
- Better integration with Home Assistant
64+
65+
## [1.0.0] - 2022-10-15
66+
67+
### Added
68+
- Initial release
69+
- Basic calendar heatmap functionality
70+
- Support for tracking game activity

README.md

Lines changed: 62 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ A custom Lovelace card for Home Assistant that visualizes entity activity data a
1212

1313
- 📅 Displays historical activity data on a calendar grid
1414
- 🎮 Perfect for tracking game activity, device usage, or any time-based data
15-
- 🎨 Customizable colors and theming (light/dark mode support)
15+
- 🎨 Advanced theme-aware colors that automatically adapt to light/dark modes
16+
- 🌈 Intelligent color intensity scaling for better visual differentiation
1617
- 🔄 Auto-refreshes data at configurable intervals
1718
- 📊 Detailed breakdown of activity on hover and click
1819
- 🌐 Localized day and month names
1920
- 📱 Responsive design for both desktop and mobile
2021
- 🗓️ Configurable week start day (Monday or Sunday)
22+
- 🛡️ Robust error handling for improved reliability
2123

2224
## Installation
2325

@@ -54,7 +56,6 @@ type: custom:calendar-heatmap-card
5456
entity: sensor.game_activity
5557
title: My Gaming Activity
5658
days_to_show: 365
57-
theme: dark
5859
```
5960
6061
### Configuration Options
@@ -66,8 +67,8 @@ theme: dark
6667
| `days_to_show` | number | 365 | Number of days of history to display |
6768
| `ignored_states` | array | ["unknown", "idle", "offline", ""] | States to ignore in calculations |
6869
| `refresh_interval` | number | 300 | Refresh interval in seconds |
69-
| `theme` | string | "dark" | Theme to use ("dark" or "light") |
7070
| `start_day_of_week` | string | "monday" | Day to start the week on ("monday" or "sunday") |
71+
| `include_unknown` | boolean | false | Whether to include "unknown" state in calculations |
7172

7273
### Example Configurations
7374

@@ -85,15 +86,51 @@ entity: sensor.steam_activity
8586
title: Steam Gaming Activity
8687
days_to_show: 180
8788
ignored_states:
88-
- unknown
8989
- idle
9090
- offline
9191
- ""
9292
refresh_interval: 600
93-
theme: light
9493
start_day_of_week: sunday
94+
include_unknown: true
95+
```
96+
97+
## Theming
98+
99+
The Calendar Heatmap Card now features advanced theme-aware color handling that automatically adapts to your Home Assistant theme. The card will detect whether you're using a light or dark theme and adjust colors accordingly for optimal visibility.
100+
101+
### Custom Theme Variables
102+
103+
You can customize the appearance of the heatmap by adding these variables to your Home Assistant theme:
104+
105+
```yaml
106+
calendar-heatmap-no-data-color: "#ebedf0" # Color for days with no data
107+
calendar-heatmap-level-1: "#c6e48b" # Color for lowest activity level
108+
calendar-heatmap-level-2: "#7bc96f" # Color for low-medium activity level
109+
calendar-heatmap-level-3: "#239a3b" # Color for medium-high activity level
110+
calendar-heatmap-level-4: "#196127" # Color for highest activity level
95111
```
96112

113+
If these variables are not defined, the card will fall back to using Home Assistant's standard theme colors:
114+
115+
- `--disabled-text-color` for no data
116+
- `--success-color` for level 1
117+
- `--primary-color` for level 2
118+
- `--accent-color` for level 3
119+
- `--state-active-color` for level 4
120+
121+
### Visual Differentiation
122+
123+
The card now uses an improved intensity scaling algorithm that provides better visual differentiation between different activity durations:
124+
125+
- Very short sessions (< 15 min)
126+
- Short sessions (15-45 min)
127+
- Medium sessions (45 min - 2 hours)
128+
- Longer sessions (2-4 hours)
129+
- High usage sessions (4-8 hours)
130+
- Very high usage sessions (8+ hours)
131+
132+
This makes it easier to distinguish between days with different levels of activity at a glance.
133+
97134
## Entity Requirements
98135

99136
This card works best with entities that:
@@ -131,7 +168,6 @@ ignored_states:
131168
- dnd
132169
- online
133170
refresh_interval: 300
134-
theme: dark
135171
start_day_of_week: monday
136172
```
137173

@@ -150,6 +186,24 @@ This gives you a beautiful visualization of your gaming habits over time, showin
150186
![Discord Gaming Activity Example](https://raw.githubusercontent.com/MagicMicky/lovelace-calendar-heatmap-card/main/docs/images/discord-example.png)
151187
*Example of Discord gaming activity visualization (you may want to replace this with your own screenshot)*
152188

189+
## Troubleshooting
190+
191+
### Common Issues
192+
193+
#### No Data Showing
194+
- Ensure your entity has historical data in Home Assistant
195+
- Check that the entity states aren't all in the `ignored_states` list
196+
- Verify that `days_to_show` isn't set too low
197+
198+
#### Colors Not Matching Theme
199+
- Make sure you're using a recent version of Home Assistant
200+
- Try adding the custom theme variables mentioned in the Theming section
201+
- Check if your theme properly defines the fallback variables
202+
203+
#### Performance Issues
204+
- Try reducing `days_to_show` to display fewer days
205+
- Increase `refresh_interval` to reduce update frequency
206+
153207
## Development
154208

155209
### Project Structure
@@ -166,7 +220,8 @@ src/
166220
│ ├── color-utils.js # Color manipulation helpers
167221
│ └── dom-utils.js # DOM manipulation helpers
168222
├── services/ # External services
169-
│ └── history-service.js # History data fetching
223+
│ ├── history-service.js # History data fetching
224+
│ └── entity-subscription.js # Entity state subscription
170225
├── data/ # Data processing
171226
│ └── data-processor.js # Data transformation logic
172227
└── ui/ # UI components

dist/calendar-heatmap-card.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/calendar-heatmap-card.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"domain": "lovelace-calendar-heatmap-card",
33
"name": "Lovelace Calendar Heatmap Card",
4-
"version": "3.1.0",
4+
"version": "3.2.0",
55
"documentation": "https://github.com/MagicMicky/lovelace-calendar-heatmap-card",
66
"description": "A Lovelace custom card for Home Assistant showing a calendar heatmap of game activity.",
77
"dependencies": [],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "calendar-heatmap-card",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"description": "A Lovelace custom card for Home Assistant showing a calendar heatmap of game activity.",
55
"main": "dist/calendar-heatmap-card.js",
66
"module": "dist/calendar-heatmap-card.js",

prepare-release.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
3+
# Calendar Heatmap Card Release Preparation Script
4+
# This script builds the project and prepares files for release
5+
6+
# Exit on error
7+
set -e
8+
9+
# Get version from constants.js
10+
CONSTANTS_VERSION=$(grep -o "CARD_VERSION = '[^']*'" src/constants.js | cut -d "'" -f 2)
11+
PACKAGE_VERSION=$(grep -o '"version": "[^"]*"' package.json | head -1 | cut -d '"' -f 4)
12+
MANIFEST_VERSION=$(grep -o '"version": "[^"]*"' manifest.json | head -1 | cut -d '"' -f 4)
13+
14+
echo "Checking version consistency..."
15+
echo "- constants.js: $CONSTANTS_VERSION"
16+
echo "- package.json: $PACKAGE_VERSION"
17+
echo "- manifest.json: $MANIFEST_VERSION"
18+
19+
# Check if versions match
20+
if [ "$CONSTANTS_VERSION" != "$PACKAGE_VERSION" ] || [ "$CONSTANTS_VERSION" != "$MANIFEST_VERSION" ]; then
21+
echo "ERROR: Version mismatch detected!"
22+
echo "Please ensure all version numbers are consistent before running this script."
23+
exit 1
24+
fi
25+
26+
# Use the version from constants.js
27+
VERSION=$CONSTANTS_VERSION
28+
echo "Preparing release for version $VERSION"
29+
30+
# Create release directory if it doesn't exist
31+
RELEASE_DIR="releases/v$VERSION"
32+
mkdir -p "$RELEASE_DIR"
33+
34+
# Build the project using build.sh script
35+
echo "Building project..."
36+
./build.sh
37+
38+
# Copy files to release directory
39+
echo "Copying files to release directory..."
40+
cp dist/calendar-heatmap-card.js "$RELEASE_DIR/"
41+
cp README.md "$RELEASE_DIR/"
42+
cp CHANGELOG.md "$RELEASE_DIR/"
43+
cp LICENSE "$RELEASE_DIR/"
44+
45+
# Create a zip file for HACS
46+
echo "Creating zip file for HACS..."
47+
cd "$RELEASE_DIR"
48+
zip "calendar-heatmap-card-$VERSION.zip" *
49+
cd -
50+
51+
echo "Release preparation complete!"
52+
echo "Files are available in: $RELEASE_DIR"
53+
echo "Next steps:"
54+
echo "1. Commit and push changes to GitHub"
55+
echo "2. Create a new release on GitHub with tag v$VERSION"
56+
echo "3. Upload the zip file to the GitHub release"
57+
echo "4. Update HACS custom repository"
58+
echo ""
59+
echo "Note: The RELEASE_TEMPLATE.md file is for reference only and doesn't need to be committed."
60+
echo "You can use its contents when creating the GitHub release manually."

releases/v3.2.0/CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Changelog
2+
3+
All notable changes to the Calendar Heatmap Card will be documented in this file.
4+
5+
## [3.2.0] - 2023-03-01
6+
7+
### Added
8+
- Advanced theme-aware color handling that automatically adapts to light/dark modes
9+
- Intelligent color intensity scaling for better visual differentiation between activity durations
10+
- Stepped intensity approach with specific thresholds for common gaming session durations
11+
- Theme detection for parent elements to support cards inside dashboards with different themes
12+
- Data attribute for intensity values to aid in debugging
13+
- Comprehensive error handling throughout the codebase
14+
15+
### Changed
16+
- Improved visual differentiation between different activity durations
17+
- Enhanced contrast for better readability in both light and dark themes
18+
- Refined color adjustment algorithm to ensure optimal visibility
19+
- Updated README with new theming information and troubleshooting section
20+
- Removed manual theme configuration option in favor of automatic detection
21+
22+
### Fixed
23+
- Fixed "Invalid time value" errors when processing history data
24+
- Improved handling of invalid dates throughout the application
25+
- Enhanced error resilience when fetching historical data
26+
- Better handling of "no data" colors with appropriate opacity
27+
28+
## [3.1.1] - 2023-02-15
29+
30+
### Fixed
31+
- Fixed an issue with date handling in the history service
32+
- Improved error handling for WebSocket API calls
33+
34+
## [3.1.0] - 2023-02-01
35+
36+
### Added
37+
- Support for localized day and month names
38+
- Configurable week start day (Monday or Sunday)
39+
- Responsive design improvements for mobile devices
40+
41+
### Changed
42+
- Improved performance for large datasets
43+
- Enhanced visual appearance with subtle shadows and hover effects
44+
45+
## [3.0.0] - 2023-01-15
46+
47+
### Added
48+
- Complete rewrite using a modular architecture
49+
- Detailed breakdown of activity on hover and click
50+
- Auto-refresh at configurable intervals
51+
- Support for Home Assistant themes
52+
53+
### Changed
54+
- Improved performance and reliability
55+
- Enhanced visual design
56+
- Better error handling
57+
58+
## [2.0.0] - 2022-12-01
59+
60+
### Added
61+
- Support for Home Assistant 2022.12.0
62+
- Improved color handling
63+
- Better integration with Home Assistant
64+
65+
## [1.0.0] - 2022-10-15
66+
67+
### Added
68+
- Initial release
69+
- Basic calendar heatmap functionality
70+
- Support for tracking game activity

releases/v3.2.0/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Mickael Goubin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)