Repository navigation
🚀 Virtual v0.10.0 — General Availability Release
hass-virtual v0.10.0 is now officially released and out of beta!
This major milestone modernizes the integration with native Home Assistant entity inheritance, an interactive web-based Visual Device Editor, 18 supported entity platforms, ADR-0007 naming architecture, physical simulation engines, and asynchronous non-blocking state storage.
Legacy 0.9.x documentation is archived in docs/README_v9.md, and 0.8.x documentation is in version-0.8.x.
🌟 What's New in v0.10.0
1. Interactive Visual Device Editor & One-Click Webhook Sync
Configure and manage virtual devices visually without manual YAML editing:
- Hosted Cloud Builder: Live on Google App Engine at https://virtual-dot-twrecked-tools.nn.r.appspot.com.
- One-Click Sync via Home Assistant: In Home Assistant, click Configure on any Virtual group to launch the editor with your devices preloaded. Click Save & Return to write changes directly to disk and reload the integration automatically via an authenticated webhook (
/api/webhook/virtual_<entry_id>). - Local LAN Mode & Offline Fallback: Run locally via
python main.pyinvirtual-device-editor/with zero cloud traffic, or use manual copy/paste. - Quick-Add Templates: Preconfigured templates for Motion Sensors, Contact Sensors, Dimmable/RGB Lights, Ceiling Fans, Window Blinds, Water Valves, Smart Power Outlets, Sirens, Cameras, and Weather Stations.
2. Major Platform Expansion (18 Platforms Supported)
hass-virtual now natively supports 18 entity platforms:
- Alarm Control Panels (
alarm_control_panel): Arming/triggering delays, code verification, state services. - Binary Sensors (
binary_sensor): Auto-off delay timeouts (off_delay), linked entity gating, pulsed turn-on durations. - Buttons (
button): Stateless action triggers (button.press). - Cameras (
camera): Snapshot still images, offline test cards, and live HLS stream playback (camera.turn_on,camera.turn_off,virtual.set_image_url,virtual.set_stream_url). - Climates (
climate): Thermostats with target setpoints, presets, HVAC action reporting, andvirtual.set_current_temperature. - Covers (
cover): Realistic travel duration, position reporting, and mid-travel stop commands. - Device Trackers (
device_tracker): GPS coordinates and named zone tracking viavirtual.move. - Fans (
fan): Multi-speed tiers, oscillation, and direction control. - Lights (
light): Brightness, RGB/HS colors, Kelvin color temperature, animated effects, and pre-staged attribute configuration viavirtual.set_light. - Locks (
lock): Lock/unlock transit duration and probabilistic jamming tests. - Media Players (
media_player): Volume, mute, input source, sound modes, and silent TTS playback testing. - Numbers (
number): Range-bounded numeric sliders and inputs. - Selects (
select): Dropdown option selectors for modes and states. - Sensors (
sensor): Environmental data, battery monitors with simulated drain, and appliance load profiling. - Sirens (
siren): Manual alarms and automatic timed chimes with duration auto-off, tone selection, and volume controls. - Switches (
switch): Simple power toggles and appliance controls. - Texts (
text): String input fields with character limits and regex pattern constraints. - Valves (
valve): Timed water/gas valves with position feedback.
3. Home Assistant ADR-0007 Entity Naming Architecture
hass-virtual adheres to Home Assistant's modern entity naming specification (_attr_has_entity_name = True):
- Single-Entity Devices (Primary Entities): When an entity represents the main function of a device (dimmer, switch, lock), the
nameparameter can be omitted. Home Assistant assigns the parent device's name as the friendly name without stuttering, generating entity IDs like{domain}.{slugify(device_id)}. - Multi-Entity Devices (Sub-Entities): Secondary entities use concise sub-entity names (
name: Battery,name: Power,name: Motion). Home Assistant automatically composes the display name as<Device Name> <Entity Name>(e.g.Front Door Lock Battery), generating entity IDs like{domain}.{slugify(device_id)}_{slugify(name)}. - Legacy Prefix Stripping: If an existing configuration passes
name: "Front Door Lock Battery"under deviceFront Door Lock, the redundant prefix is automatically stripped to prevent UI repetition. - Registry Identity Retention: Existing entity unique IDs are preserved in
BlendedCfgto maintain dashboard cards, entity registry customizations, and historical statistics across upgrades.
4. Advanced Physics Simulation Engines
- Closed-Loop Thermal House HVAC (
virtual-climate.yaml): Simulates indoor heat gain and heat loss based on outdoor temperature, wall leakage rates, and staged heating/cooling furnace power. Includes thermostat deadband hysteresis to prevent short-cycling and simulation speed multipliers (virtual.set_sim_speed). - Solar Inverter & Energy Hub (
virtual-solark.yaml): Models solar generation diurnal curves, battery charging and discharging cycles, grid import/export balancing, reactive grid voltage tracking, and power outage islanding modes. - Appliance Load Simulation & Energy Dashboard: Power sensors can simulate active/standby loads with clock-aligned duty cycles (
cycle_duration,cycle_interval,cycle_align), random jitter variance, linked switches, and companion accumulating kWh energy sensors (linked_power). - Battery Drain Simulation: Battery sensors model realistic discharge curves over configured lifespans (
battery_life_days), with companion low-battery binary sensors (linked_battery_sensor,low_battery_threshold).
5. Non-Blocking Storage & Asynchronous Architecture
- Migrated device tracker state persistence to Home Assistant's managed
Storehelper with delayed asynchronous disk writes. - Completely eliminated the external
aiofilesdependency in favor of standard executor file handling. - Removed redundant entity attributes from
extra_state_attributesto align with HA core entity standards. - Full Python 3.12 type annotations (
from __future__ import annotations), unified global device-class units, and hardened state restoration against null or invalid values across restarts.
⚠️ Breaking Changes & Migration Guide (Upgrading from v0.9.x)
1. ADR-0007 Entity Naming & Entity IDs
- What changed: Entity naming now strictly follows Home Assistant ADR-0007 (
_attr_has_entity_name = True). - Impact:
- Existing entities retain their registered unique IDs and entity IDs through
BlendedCfgcorrelation with Home Assistant's entity registry. - For newly created devices, primary entities without an explicit
namedefault to{domain}.{device_slug}(e.g.switch.living_room_tv_outlet), and sub-entities default to{domain}.{device_slug}_{entity_slug}(e.g.sensor.living_room_tv_outlet_power).
- Existing entities retain their registered unique IDs and entity IDs through
- Migration: If you configure new devices, omit
nameon the primary entity and use short names on child entities. Check your automations, dashboards, and scripts if you recreate devices from scratch.
2. Removal of Duplicate Base Attributes in extra_state_attributes
- What changed: In v0.9.x, standard attributes (
brightness,color_mode,is_on,temperature,device_class,unit_of_measurement) were redundantly copied intoextra_state_attributes. In v0.10.0, these are handled strictly by Home Assistant core base entity properties. - Impact: Template expressions or external automations that queried
state_attr('...', '<attr>')for values that belong to core properties still work via standard Home Assistant getters, but inspecting raw dictionary attributes may show fewer duplicate keys. - Migration: Use standard Home Assistant state properties (e.g.
states('light.living_room')orstate_attr('light.living_room', 'brightness')).
3. Temperature Unit Standardization
- What changed: Temperature units now strictly enforce
UnitOfTemperature.CELSIUS('°C'). - Impact: Non-standard temperature units like
"C","c", or"°C"are automatically sanitized and upgraded to'°C'. - Migration: Update any YAML definitions specifying
unit_of_measurement: "C"tounit_of_measurement: "°C".
4. Solar Inverter Battery Power Polarity
- What changed: Battery power flow polarity in solar inverter simulations has been aligned with Home Assistant Energy conventions:
- Negative Watts (
< 0): Battery is charging (consuming power). - Positive Watts (
> 0): Battery is discharging (supplying power).
- Negative Watts (
- Migration: If you wrote automations or custom template sensors based on early v0.10 alpha prototypes with inverted polarity, invert your signs accordingly.
5. Storage Backend & Dependency Cleanup
- What changed: Device tracker persistence files have migrated from manual JSON writes using
aiofilesto Home Assistant's native.storage/system. - Migration: No manual user intervention required; migration happens automatically.
📦 How to Install / Upgrade
Via HACS (Recommended)
- Open Home Assistant and navigate to HACS -> Integrations.
- Locate Virtual Components and click Update to v0.10.0.
- Restart Home Assistant.
Manual Installation
- Download the
custom_components/virtualdirectory from this release. - Copy into your Home Assistant
<config_dir>/custom_components/virtualdirectory. - Restart Home Assistant.