Demo
Inherits: SimulatedApi
Description
Adapter for the demo mode: a made-up home with fake devices, so the app can be shown without a Home Assistant server.
Services are simulated by the base class (toggling a light turns it on). On top of that, sensors drift a little, the bathroom gets steamy now and then, and two people travel around the city on fixed routes, so their position history and live position always match. The rooms the devices are placed in come from demo_house.gd. Everything here is made up: names, places and devices.
Properties
| Name | Type | Default |
|---|---|---|
| _baselines | Dictionary | {} |
Methods
| Returns | Name |
|---|---|
| Dictionary | _device ( id: String, name: String, area: Variant, model: String, entity_ids: Array ) |
| Array | _devices ( ) |
| Variant | _drift_sensors ( ) |
| void | _init ( _url: String = "", _token: String = "" ) |
| String | _iso ( unix: float ) |
| String | _local ( unix: float ) |
| float | _meters ( a: Vector2, b: Vector2 ) |
| void | _ready ( ) |
| Variant | _route_of ( entity_id: String ) |
| Dictionary | _sensor ( name: String, value: String, unit: String, device_class: String ) |
| Dictionary | _states ( ) |
| Array | _street_path ( stops: Array ) |
| Variant | _tick ( ) |
| Variant | _update_people ( ) |
| String | _zone_state ( position: Vector2 ) |
| Dictionary | get_state_history ( entity_ids: Array, start: String, end: Variant = null ) |
| Vector2 | route_position ( route: Dictionary, unix: float ) |
Constants
HISTORY_STEP = 120.0
Seconds between two recorded positions in the position history.
HOME = Vector2(52.5163, 13.3777)
Made-up home location near a public landmark (Brandenburg Gate, Berlin), the same one the entity gallery uses. Vector2(latitude, longitude).
HOME_RADIUS = 100.0
No description provided yet.
ROUTES = {"person.alex": {"home_share": 0.55, "offset": 0.0, "period": 10800.0, "stops": [...], "tracker": "device_tracker.alex_phone"}, "person.sam": {"home_share": 0.3, "offset": 1800.0, "period": 5400.0, "stops": [...], "tracker": "device_tracker.sam_phone"}}
Where the demo people go. Every period seconds a person spends home_share of the time at home, then visits the stops and comes back. offset shifts the schedule, so the two aren't in sync.
TICK = 5.0
Seconds between two simulated updates.
ZONES = {"zone.gym": ["Gym", Vector2(52.5079, 13.3933), 80.0], "zone.work": ["Work", Vector2(52.5251, 13.3694), 150.0]}
Zones besides home: entity id -> [name, position, radius in meters].
Property Descriptions
_baselines: Dictionary
Temperature/humidity sensor id -> the value it drifts around.
Method Descriptions
_device (id: String , name: String , area: Variant , model: String , entity_ids: Array ) -> Dictionary
No description provided yet.
_devices ( ) -> Array
Devices for the Widgets panel. Entities that belong to no device are grouped per domain, like the Home Assistant adapter does.
_drift_sensors ( ) -> Variant
Sensors wander around their baseline. Now and then someone showers, which sends the bathroom humidity up; it slowly settles afterwards.
_init (_url: String = "" , _token: String = "" ) -> void
No description provided yet.
static _iso (unix: float ) -> String
UTC timestamp like Home Assistant's last_changed.
static _local (unix: float ) -> String
Local wall-clock time like calendar start_time ("2026-11-20 10:00:00").
static _meters (a: Vector2 , b: Vector2 ) -> float
No description provided yet.
_ready ( ) -> void
No description provided yet.
_route_of (entity_id: String ) -> Variant
No description provided yet.
static _sensor (name: String , value: String , unit: String , device_class: String ) -> Dictionary
No description provided yet.
_states ( ) -> Dictionary
No description provided yet.
static _street_path (stops: Array ) -> Array
Goes north/south first and then east/west between stops, so paths look like they follow streets instead of cutting straight through blocks.
_tick ( ) -> Variant
No description provided yet.
_update_people ( ) -> Variant
No description provided yet.
static _zone_state (position: Vector2 ) -> String
Home Assistant's state for a tracker at position: home, a zone name or not_home.
get_state_history (entity_ids: Array , start: String , end: Variant = null ) -> Dictionary
The people's recorded positions come from their routes, so the path on the map ends exactly where they are now.
static route_position (route: Dictionary , unix: float ) -> Vector2
Where someone on route is at unix time.

