@glasshome/sync-layer 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,6 +19,6 @@ export interface DemoFixtures {
19
19
  *
20
20
  * Entities span lights, sensors, binary sensors, climate, covers,
21
21
  * locks, switches, media player, weather, camera, scenes, and buttons
22
- * across 4 areas: living_room, bedroom, kitchen, entry.
22
+ * across 6 areas: living_room, bedroom, kitchen, entry, utility, garage.
23
23
  */
24
24
  export declare function createDemoFixtures(): DemoFixtures;
@@ -775,7 +775,7 @@ function makeArea(id, name, floorId = "ground_floor") {
775
775
  *
776
776
  * Entities span lights, sensors, binary sensors, climate, covers,
777
777
  * locks, switches, media player, weather, camera, scenes, and buttons
778
- * across 4 areas: living_room, bedroom, kitchen, entry.
778
+ * across 6 areas: living_room, bedroom, kitchen, entry, utility, garage.
779
779
  */
780
780
  function createDemoFixtures() {
781
781
  contextCounter = 0;
@@ -784,7 +784,8 @@ function createDemoFixtures() {
784
784
  bedroom: makeArea("bedroom", "Bedroom"),
785
785
  kitchen: makeArea("kitchen", "Kitchen"),
786
786
  entry: makeArea("entry", "Entry"),
787
- utility: makeArea("utility", "Utility")
787
+ utility: makeArea("utility", "Utility"),
788
+ garage: makeArea("garage", "Garage")
788
789
  };
789
790
  areas.living_room.temperature_entity_id = "sensor.temperature_living";
790
791
  areas.living_room.humidity_entity_id = "sensor.humidity_living";
@@ -798,6 +799,9 @@ function createDemoFixtures() {
798
799
  thermostat_br: makeDevice("thermostat_br", "Bedroom AC", "bedroom", "Daikin", "Split AC"),
799
800
  blinds_lr: makeDevice("blinds_lr", "Living Room Blinds", "living_room", "Somfy", "Roller Shade"),
800
801
  curtains_br: makeDevice("curtains_br", "Bedroom Curtains", "bedroom", "IKEA", "Fyrtur"),
802
+ garage_door_opener: makeDevice("garage_door_opener", "Garage Door Opener", "garage", "Chamberlain", "MyQ"),
803
+ shutters_lr: makeDevice("shutters_lr", "Living Room Shutters", "living_room", "Somfy", "Venetian Shutter"),
804
+ blinds_kitchen: makeDevice("blinds_kitchen", "Kitchen Blinds", "kitchen", "IKEA", "Praktlysing"),
801
805
  lock_front: makeDevice("lock_front", "Front Door Lock", "entry", "Yale", "Assure Lock 2"),
802
806
  lock_back: makeDevice("lock_back", "Back Door Lock", "entry", "August", "Smart Lock Pro"),
803
807
  speaker_lr: makeDevice("speaker_lr", "Living Room Speaker", "living_room", "Sonos", "One"),
@@ -957,6 +961,39 @@ function createDemoFixtures() {
957
961
  device_class: "curtain",
958
962
  supported_features: 15
959
963
  });
964
+ add(makeEntity("cover.garage_door", "closed", { device_class: "garage" }), {
965
+ device_id: "garage_door_opener",
966
+ area_id: "garage",
967
+ device_class: "garage",
968
+ supported_features: 11
969
+ });
970
+ add(makeEntity("cover.driveway_gate", "open", {
971
+ device_class: "gate",
972
+ assumed_state: true
973
+ }), {
974
+ area_id: "garage",
975
+ device_class: "gate",
976
+ supported_features: 3
977
+ });
978
+ add(makeEntity("cover.living_room_shutters", "open", {
979
+ current_position: 45,
980
+ current_tilt_position: 30,
981
+ device_class: "shutter"
982
+ }), {
983
+ device_id: "shutters_lr",
984
+ area_id: "living_room",
985
+ device_class: "shutter",
986
+ supported_features: 255
987
+ });
988
+ add(makeEntity("cover.kitchen_blinds", "open", {
989
+ current_position: 100,
990
+ device_class: "blind"
991
+ }), {
992
+ device_id: "blinds_kitchen",
993
+ area_id: "kitchen",
994
+ device_class: "blind",
995
+ supported_features: 127
996
+ });
960
997
  add(makeEntity("lock.front_door_lock", "locked", {}), {
961
998
  device_id: "lock_front",
962
999
  area_id: "entry",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ENERGY_ENTITY_IDS, createDemoFixtures, demoEnergyPreferences, energyEntityValue, formatEnergyState, isEnergyEntity, isSunUp, resetStore, setState, simulateEnergy, state, sunEvents, synthesizeEnergyHistory, synthesizeEnergyStatistics } from "./demo-data-C_sa1VWX.js";
1
+ import { ENERGY_ENTITY_IDS, createDemoFixtures, demoEnergyPreferences, energyEntityValue, formatEnergyState, isEnergyEntity, isSunUp, resetStore, setState, simulateEnergy, state, sunEvents, synthesizeEnergyHistory, synthesizeEnergyStatistics } from "./demo-data-CavpxBw3.js";
2
2
  import { callService as callService$1, createConnection, createLongLivedTokenAuth, getAuth } from "home-assistant-js-websocket";
3
3
  import { produce, reconcile } from "solid-js/store";
4
4
 
@@ -614,10 +614,10 @@ function applyDemoServiceCall(_domain, service, _serviceData = {}, target = {})
614
614
  else if (service === "unlock") e.state = "unlocked";
615
615
  else if (service === "open_cover") {
616
616
  e.state = "open";
617
- e.attributes.current_position = 100;
617
+ if ("current_position" in e.attributes) e.attributes.current_position = 100;
618
618
  } else if (service === "close_cover") {
619
619
  e.state = "closed";
620
- e.attributes.current_position = 0;
620
+ if ("current_position" in e.attributes) e.attributes.current_position = 0;
621
621
  } else if (service === "set_cover_position" && _serviceData.position != null) {
622
622
  e.attributes.current_position = _serviceData.position;
623
623
  e.state = _serviceData.position > 0 ? "open" : "closed";
@@ -635,7 +635,7 @@ function applyTurnOn(e, domain, serviceData = {}) {
635
635
  } else if (domain === "media_player") e.state = "playing";
636
636
  else if (domain === "cover") {
637
637
  e.state = "open";
638
- e.attributes.current_position = 100;
638
+ if ("current_position" in e.attributes) e.attributes.current_position = 100;
639
639
  } else e.state = "on";
640
640
  }
641
641
  function applyTurnOff(e, domain) {
@@ -645,7 +645,7 @@ function applyTurnOff(e, domain) {
645
645
  } else if (domain === "media_player") e.state = "paused";
646
646
  else if (domain === "cover") {
647
647
  e.state = "closed";
648
- e.attributes.current_position = 0;
648
+ if ("current_position" in e.attributes) e.attributes.current_position = 0;
649
649
  } else e.state = "off";
650
650
  }
651
651
 
@@ -1,4 +1,4 @@
1
- import { createDemoFixtures, state } from "../demo-data-C_sa1VWX.js";
1
+ import { createDemoFixtures, state } from "../demo-data-CavpxBw3.js";
2
2
 
3
3
  //#region src/testing/mock-behaviors/base.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/sync-layer",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Type-safe, reactive state synchronization layer for Home Assistant",
5
5
  "repository": {
6
6
  "type": "git",