{"id":39593389,"url":"https://github.com/faanskit/ha-myweblog","last_synced_at":"2026-01-18T07:46:20.747Z","repository":{"id":333017972,"uuid":"974406603","full_name":"faanskit/ha-myweblog","owner":"faanskit","description":"Home Assistant integration for myWebLog","archived":false,"fork":false,"pushed_at":"2026-01-17T09:38:11.000Z","size":126,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-17T10:09:35.837Z","etag":null,"topics":["hacs","homeassistant","integration","myweblog"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faanskit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-28T18:18:24.000Z","updated_at":"2026-01-17T09:36:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/faanskit/ha-myweblog","commit_stats":null,"previous_names":["faanskit/ha-myweblog"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/faanskit/ha-myweblog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faanskit%2Fha-myweblog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faanskit%2Fha-myweblog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faanskit%2Fha-myweblog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faanskit%2Fha-myweblog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faanskit","download_url":"https://codeload.github.com/faanskit/ha-myweblog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faanskit%2Fha-myweblog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28533172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacs","homeassistant","integration","myweblog"],"created_at":"2026-01-18T07:46:20.661Z","updated_at":"2026-01-18T07:46:20.728Z","avatar_url":"https://github.com/faanskit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# myWebLog Home Assistant Integration\n\n![Quality Scale: Gold](https://img.shields.io/badge/Quality%20Scale-Gold-yellow.svg)\n[![hacs_badge](https://img.shields.io/badge/HACS-Custom-41BDF5.svg)](https://github.com/hacs/integration)\n\nThis is a custom Home Assistant integration for [myWebLog](https://www.myweblog.se), allowing you to monitor and manage your club's airplanes directly from Home Assistant.\n\n## Features\n- **Multi-Airplane Support:** Select and monitor multiple airplanes during setup.\n- **Booking Awareness:** Each airplane sensor shows the date/time of the next booking (as a timestamp).\n- **Maintenance \u0026 Flight Data:** Exposes maintenance, remarks, and flight data as individual sensors.\n- **Localization:** Handles local timezones for bookings and supports translations.\n- **Automation Ready:** Sensor state changes (e.g., next booking) can be used to trigger automations—ideal for use cases like pre-heating an airplane before a scheduled flight.\n- **Efficient \u0026 Grouped:** Sensors are grouped by airplane and share API calls for efficient operation.\n\n## Installation\n### Option 1: HACS (Recommended)\n[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=faanskit\u0026repository=ha-myweblog\u0026category=integration)\n\n### Option 2: HACS Custom Repository\n**Pre-requisites:**\n- HACS installed\n\nThis integration is not (currently) in the default HACS store, please add it as a custom repository:\n1. Go to HACS in your Home Assistant sidebar.\n2. Click the three-dot menu (⋮) in the top right and select \"Custom repositories\".\n3. Enter `https://github.com/faanskit/ha-myweblog` as the repository URL and select \"Integration\" as the category.\n4. Find \"myWebLog\" in HACS \u003e Integrations and click \"Download\".\n5. Restart Home Assistant.\n6. **Add the \"myWebLog\" integration via the Home Assistant UI (Configuration → Devices \u0026 Services → Add Integration).**\n\n### Option 3: Git-based Installation with Symlink (Developer-Friendly)\n\n\u003e 🧪 Use this method if you want to keep integration code in a separate folder (e.g., for development, testing, or easy updates via `git pull`).\n\n#### 1. Open a terminal and go to your Home Assistant config directory:\n```bash\ncd /config\n``` \n#### 2. Create a directory to hold GitHub repositories (if it doesn't already exist):\n```bash\nmkdir -p github_repos\n```\n#### 3. Clone the repository into that folder:\nWhen the repo is public, run:\n\n```bash\ngit clone https://github.com/faanskit/ha-myweblog.git\n```\nDuring the beta phase, and the repo is private, use your GitHub username and a [personal access token (PAT)](https://github.com/settings/tokens) like this:\n\n```bash\ngit clone https://\u003cyour-username\u003e:\u003cyour-token\u003e@github.com/faanskit/ha-myweblog.git\n```\nExample:\n\n```bash\ngit clone https://mygithubuser:ghp_xxXyYzZzz123TOKENHERE@github.com/faanskit/ha-myweblog.git\n```\n\n🔐 Create your token [here](https://github.com/settings/tokens).\n\n✅ Make sure it has the repo scope if accessing a private repository.\n\n\n#### 4. Create a symlink from the `custom_components` directory to the repository:\n```bash\ncd /config/custom_components\nln -s ../github_repos/ha-myweblog/custom_components/myweblog\n```\nThis will link the myweblog integration into Home Assistant as if it were installed directly.\n\n#### 5. Restart Home Assistant.\n#### 6. Add the \"myWebLog\" integration via the Home Assistant UI (Configuration → Devices \u0026 Services → Add Integration).\n\n## Configuration\n- Enter your myWebLog username and password during setup.\n- Select one or more airplanes to monitor.\n\n## Sensors\nFor each selected airplane, **multiple sensors** are created—one for each metric:\n\n- **Entity IDs:**\n\n  - `sensor.\u003cregnr\u003e_next_booking` (Next booking timestamp)\n  - `sensor.\u003cregnr\u003e_yellow_tags` (Yellow remarks count)\n  - `sensor.\u003cregnr\u003e_red_tags` (Red remarks count)\n  - `sensor.\u003cregnr\u003e_days_to_go` (Days to next maintenance)\n  - `sensor.\u003cregnr\u003e_hours_to_go` (Hours to next maintenance)\n  - `sensor.\u003cregnr\u003e_airborne` (Total airborne time, h)\n  - `sensor.\u003cregnr\u003e_block` (Total block time, h)\n  - `sensor.\u003cregnr\u003e_tachometer` (Tachometer total, h)\n  - `sensor.\u003cregnr\u003e_tach_time` (Tach time, h)\n  - `sensor.\u003cregnr\u003e_landings` (Total landings)\n  - `sensor.\u003cregnr\u003e_model` (Airplane model)\n  - `sensor.\u003cregnr\u003e_club` (Club name)\n\n- **Diagnostic Sensors** (Integration-level):\n  - `sensor.myweblog_diagnostics_last_update_objects` (Last successful update timestamp)\n  - `sensor.myweblog_diagnostics_update_interval_objects` (Update interval in seconds)\n  - `sensor.myweblog_diagnostics_configured_airplanes` (Number of configured airplanes)\n\n- **State:**\n  - Each sensor's state reflects the current value for that metric (e.g., hours, count, timestamp, or string).\n  - Numeric sensors use appropriate `state_class` and `device_class` for Home Assistant statistics and dashboards.\n\n- **Localization:**\n  - All sensor names and descriptions support translation (English and Swedish included by default).\n\n- **Efficient API Usage:**\n  - All sensors for an airplane share data via Home Assistant's DataUpdateCoordinator, minimizing API calls.\n  - Data is fetched once per update interval and shared across all sensors for each airplane.\n\n- **Grouping:**\n  - In the Home Assistant UI, sensors are grouped by airplane, making it easy to monitor all metrics for each aircraft on a single card.\n\n## Displaying Icon Colors in Lovelace\n\nTo reflect the `icon_color` attribute (red for `red_tags`, yellow for `yellow_tags`) in the frontend, use a Lovelace card with the following configuration:\n\n```yaml\ntype: entity\nentity: sensor.\u003cyour_sensor_entity_id\u003e\nicon: mdi:alert  # Optional, if not set in the sensor\nstyle: |\n  :host {\n    --paper-item-icon-color: {{ state_attr('sensor.\u003cyour_sensor_entity_id\u003e', 'icon_color') | default('gray') }};\n  }\n```\n\nReplace `\u003cyour_sensor_entity_id\u003e` with your actual sensor entity ID (e.g., `sensor.airplane_red_tags`).\n\nThis approach uses a custom style to dynamically set the icon color based on the `icon_color` attribute. If the attribute is not set, the icon will default to gray.\n\n## Example: Automate Pre-Flight Heater\n\nYou can use the `next_booking` sensor to automate actions before a scheduled flight. For example, to start a heater one hour before the next booking:\n\n```yaml\nalias: Turn on heater 60 minutes before booking\ndescription: This automation turns on the heater 1 hour before the next booking starts.\ntrigger:\n  - platform: time_pattern\n    minutes: \"/5\"  # Runs every 5 minutes\ncondition:\n  - condition: template\n    value_template: \u003e-\n      {% set booking_time = as_timestamp(states('sensor.next_booking')) %}\n      {% set current_time = as_timestamp(now()) %}\n      {% set time_diff = booking_time - current_time %}\n      {% set window = 300 %}  # 5 minutes in seconds\n      {{ 0 \u003c time_diff \u003c= 60 }}\naction:\n  - service: switch.turn_on\n    target:\n      entity_id: switch.heater\nmode: single\n```\n**Trigger**: Runs every 5 minutes.\n\n**Condition**: Checks if the next booking is approximately 60 minutes away (within ±5 minutes).\n\n**Action**: Turns on the heater (replace switch.heater with your actual switch entity).\n\n```yaml\nalias: Turn off heater after 60 minutes\ndescription: Turns off the heater if it has been on for 60 minutes.\ntrigger:\n  - platform: state\n    entity_id: switch.heater\n    to: \"on\"\n    for:\n      hours: 1\ncondition: []\naction:\n  - service: switch.turn_off\n    target:\n      entity_id: switch.heater\nmode: single\n```\n**Trigger**: Fires when the switch has been in the on state for 1 hour.\n\n**Action**: Turns off the heater.\n\n## Options \u0026 Customization\n\n### Adding or Removing Airplanes\n\nYou can modify which airplanes are monitored without removing and re-adding the integration:\n\n1. Go to **Configuration** → **Devices \u0026 Services** in Home Assistant.\n2. Find the **myWebLog** integration and click on it.\n3. Click the **Configure** button (or the three-dot menu → **Configure**).\n4. Select or deselect airplanes from the list.\n5. Click **Submit** to save your changes.\n\nThe integration will automatically reload with your updated airplane selection.\n\n### Re-authentication\n\nIf your credentials expire or become invalid, the integration will automatically prompt you to re-authenticate:\n\n1. A notification will appear in Home Assistant indicating that re-authentication is required.\n2. Click the notification or go to **Configuration** → **Devices \u0026 Services** → **myWebLog**.\n3. Enter your updated credentials.\n4. The integration will automatically reload with the new credentials.\n\n### Additional Notes\n- All API credentials and tokens are stored securely in your Home Assistant config.\n- You can add or update translations by editing the `en.json`, `sv.json`, or other language files in the `translations` directory.\n- Sensor state_class and device_class can be customized for advanced Home Assistant statistics and energy dashboard support.\n\n## Requirements\n- Home Assistant 2023.6 or newer recommended\n- Python package: `pyMyweblog` (automatically installed)\n\n## Logging \u0026 Troubleshooting\nThis integration includes detailed logging for setup, configuration, data fetching, and sensor updates. Logs can help you troubleshoot connection issues, API errors, and integration behavior.\n\n**How to enable debug logging:**\nAdd the following to your `configuration.yaml` to see detailed logs for this integration and the supporting `pyMyweblog` package:\n\n```yaml\nlogger:\n  default: info\n  logs:\n    custom_components.myweblog: debug\n    pyMyweblog: debug\n```\n\n- Sensor creation, data updates, config flow steps, and errors are all logged.\n- Check the Home Assistant logs if you experience issues with authentication, data updates, or sensor creation.\n\n## License\nSee [LICENSE](LICENSE).\n\n## Development \u0026 Testing\n\n### Running Tests\nTo run the test suite, you need to install the development requirements first. It is recommended to use a virtual environment.\n\n1. Install testing dependencies:\n   ```bash\n   pip install pytest-homeassistant-custom-component pytest-cov\n   ```\n\n2. Run the tests using `pytest`:\n   ```bash\n   pytest\n   ```\n\n   Or run with verbose output:\n   ```bash\n   pytest -v\n   ```\n\n**NOTE**\nYou may have to patch your `PYTHONPATH` to run this (Windows PowerShell):\n```powershell\n$env:PYTHONPATH = \"$PWD\"; pytest\n```\n\n### Running Tests with Coverage\n\nTo run the test suite with coverage reporting:\n\n1. Install coverage dependencies (if not already installed):\n   ```bash\n   pip install pytest-cov\n   ```\n\n2. Run tests with coverage:\n   ```bash\n   pytest --cov=custom_components/myweblog --cov-report=term-missing\n   ```\n\n   This will show:\n   - Coverage percentage for each file\n   - Missing line numbers for uncovered code\n\n3. Generate HTML coverage report:\n   ```bash\n   pytest --cov=custom_components/myweblog --cov-report=html\n   ```\n\n   This creates an `htmlcov` directory with an interactive HTML report. Open `htmlcov/index.html` in your browser to view detailed coverage information.\n\n4. Generate both terminal and HTML reports:\n   ```bash\n   pytest --cov=custom_components/myweblog --cov-report=term-missing --cov-report=html\n   ```\n\n**Current Coverage:**\n- `config_flow.py`: 100% coverage\n- `sensor.py`: 91% coverage\n- Overall: 95% coverage\n\nThe test suite covers configuration flow, sensor setup, error handling, options flow, re-authentication, and diagnostic sensors. We aim for high coverage to ensure reliability across Home Assistant updates.\n\n## Contributing\n\n### 1. Honor Home Assistant Integration Quality level\nThe integration is a GOLD level integration. This means contributors must ensure the following standards are maintained:\n- **Extensive Documentation**: Provide comprehensive, user-friendly documentation including setup, features, troubleshooting, and examples.\n- **Full Test Coverage**: Maintain automated tests covering the entire integration codebase (currently 95%+ coverage).\n- **Robust Error Handling**: Implement proper error recovery, automatic re-authentication, and graceful handling of offline devices/services.\n- **Reconfigurability**: Ensure the integration can be reconfigured and adjusted via the Home Assistant UI.\n- **Translations**: Support multiple languages with complete translations for all user-facing strings.\n- **Coding Standards**: Adhere to Home Assistant's Python Style Guide, with code formatted using Black and linted with Flake8.\n- **Active Maintenance**: Have active code owners who maintain and update the integration.\n\n### 2. Contribute with Code Style\nWhen contributing:\n- Format your code using **Black**:\n  ```bash\n  black .\n  ``` \n- Check your code style using Flake8:\n  ```bash\n  flake8\n  ```\n- Follow [Home Assistant's Python Style Guide](https://developers.home-assistant.io/docs/development/python_style_guide/) for consistency. This includes naming conventions, async/await usage, docstrings, and structure.\n\n### 3. Follow Git Flow for Development\nIf you're developing features or fixes:\n- Create a separate branch for each feature or bugfix:\n  ```bash\n  git checkout -b feature/new-feature\n  git checkout -b fix/something-broken\n  ```\n- Ensure all tests pass and linting checks succeed before submitting.\n- Push your branch and submit a pull request (PR) to main when ready.\n- PRs will be automatically validated with linting, HACS validation, and Home Assistant fest checks.\n\nWe appreciate your help in shaping the future of this integration!\n\n## Credits\n- Integration by [Marcus Karlsson](https://github.com/faanskit)\n- Powered by [pyMyweblog](https://github.com/faanskit/pyMyweblog)\n\n## Issues \u0026 Feedback\nPlease report issues or feature requests on [GitHub](https://github.com/faanskit/ha-myweblog/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaanskit%2Fha-myweblog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaanskit%2Fha-myweblog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaanskit%2Fha-myweblog/lists"}