Skip to content

Commit

Permalink
more lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zoe-codez committed Jun 7, 2024
1 parent f9b8035 commit b44983f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/extensions/domains/binary-sensor.extension.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TServiceParams } from "@digital-alchemy/core";
import { BinarySensorDeviceClass } from "@digital-alchemy/hass";
import { BinarySensorDeviceClass, ENTITY_STATE, PICK_ENTITY } from "@digital-alchemy/hass";

import { AddEntityOptions, SettableConfiguration } from "../..";

Expand All @@ -24,7 +24,9 @@ export function VirtualBinarySensor({ context, synapse }: TServiceParams) {
default_config: { is_on: false },
domain: "binary_sensor",
load_config_keys: ["device_class", "is_on"],
map_config: [{ key: "is_on", load: entity => entity.state === "on" }],
map_config: [
{ key: "is_on", load: (entity: ENTITY_STATE<PICK_ENTITY>) => entity.state === "on" },
],
});

return <ATTRIBUTES extends object>(
Expand Down
6 changes: 4 additions & 2 deletions src/extensions/domains/switch.extension.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TServiceParams } from "@digital-alchemy/core";
import { SwitchDeviceClass } from "@digital-alchemy/hass";
import { ENTITY_STATE, PICK_ENTITY, SwitchDeviceClass } from "@digital-alchemy/hass";

import { AddEntityOptions, SettableConfiguration } from "../..";

Expand Down Expand Up @@ -33,7 +33,9 @@ export function VirtualSwitch({ context, synapse }: TServiceParams) {
context,
domain: "switch",
load_config_keys: ["device_class", "is_on"],
map_config: [{ key: "is_on", load: entity => entity.state === "on" }],
map_config: [
{ key: "is_on", load: (entity: ENTITY_STATE<PICK_ENTITY>) => entity.state === "on" },
],
});

return function <ATTRIBUTES extends object>({
Expand Down
6 changes: 3 additions & 3 deletions src/mock/generator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SECOND, TServiceParams } from "@digital-alchemy/core";
import dayjs from "dayjs";

export function EntityGenerator({ scheduler, synapse, context, logger, hass }: TServiceParams) {
export function EntityGenerator({ scheduler, synapse, context, logger }: TServiceParams) {
try {
const subDevice = synapse.device.register("sub_device", {
name: "example device",
Expand Down Expand Up @@ -59,8 +59,8 @@ export function EntityGenerator({ scheduler, synapse, context, logger, hass }: T
scene.onActivate(() => {
logger.info("scene activated callback");
});
const entity = hass.entity.byId("binary_sensor.hass_e2e_online");
const virtualSwitch = synapse.switch({
// const entity = hass.entity.byId("binary_sensor.hass_e2e_online");
synapse.switch({
context,
icon: {
current() {
Expand Down

0 comments on commit b44983f

Please sign in to comment.