{"version":3,"sources":["../src/components/base.ts","../src/components/bluetooth-low-energy.ts","../src/components/cloud.ts","../src/components/cover.ts","../src/components/device-power.ts","../src/components/ethernet.ts","../src/components/ht-ui.ts","../src/components/humidity.ts","../src/components/input.ts","../src/components/light.ts","../src/components/mqtt.ts","../src/components/outbound-websocket.ts","../src/components/script.ts","../src/components/switch.ts","../src/components/system.ts","../src/components/temperature.ts","../src/components/ui.ts","../src/components/wifi.ts","../src/components/pm1.ts","../src/devices/base.ts","../src/services/base.ts","../src/services/http.ts","../src/services/kvs.ts","../src/services/schedule.ts","../src/services/shelly.ts","../src/services/webhook.ts","../src/devices/shelly-plus-1.ts","../src/devices/shelly-plus-pm.ts","../src/devices/shelly-plus-1-pm.ts","../src/devices/shelly-plus-2-pm.ts","../src/devices/shelly-plus-ht.ts","../src/devices/shelly-plus-i4.ts","../src/devices/shelly-plus-plug.ts","../src/devices/shelly-pro-1.ts","../src/devices/shelly-pro-1-pm.ts","../src/devices/shelly-pro-2.ts","../src/devices/shelly-pro-2-pm.ts","../src/devices/shelly-pro-3.ts","../src/devices/shelly-pro-4-pm.ts","../src/devices/shelly-pro-dimmer-1-pm.ts","../src/devices/shelly-pro-dimmer-2-pm.ts","../src/devices/shelly-pro-dual-cover-pm.ts","../src/devices/shelly-plus-dimmer-pm.ts","../src/devices/shelly-plus-dimmer.ts","../src/devices/shelly-gen3-2-pm.ts","../src/discovery/base.ts","../src/discovery/mdns.ts","../src/rpc/base.ts","../src/rpc/auth.ts","../src/rpc/websocket.ts","../src/shellies.ts"],"sourcesContent":["import equal from 'fast-deep-equal';\nimport EventEmitter from 'eventemitter3';\n\nimport { Device } from '../devices';\nimport { RpcEvent, RpcParams } from '../rpc';\n\nexport type PrimitiveTypes = boolean | number | string;\nexport type CharacteristicValue =\n    | PrimitiveTypes\n    | PrimitiveTypes[]\n    | null\n    | { [key: string]: PrimitiveTypes | PrimitiveTypes[] | null };\n\n/**\n * Interface used when passing around components, since the Component class is\n * generic.\n */\nexport interface ComponentLike {\n    name: string;\n    key: string;\n    device: Device;\n\n    update(data: Record<string, unknown>);\n    handleEvent(event: RpcEvent);\n}\n\n/**\n * Property decorator used to label properties as characteristics.\n * @param target - The prototype of the component class that the property belongs to.\n * @param propertyName - The name of the property.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const characteristic = (target: any, propertyName: string) => {\n    // make sure the given prototype has an array of properties\n    if (!Object.prototype.hasOwnProperty.call(target, '_characteristicProps')) {\n        target._characteristicProps = new Array<string>();\n    }\n\n    // get the array of properties\n    const props: string[] = target._characteristicProps;\n\n    // add this property to the array\n    props.push(propertyName);\n};\n\n/**\n * Base class for all device components.\n */\nexport abstract class ComponentBase extends EventEmitter implements ComponentLike {\n    /**\n     * The key used to identify the component in status updates etc.\n     */\n    readonly key: string;\n\n    /**\n     * @param name - The name of this component. Used when making RPCs.\n     * @param device - The device that owns this component.\n     * @param key - The key used to identify the component in status updates etc. If `null`, the component name\n     * in lower case letters will be used.\n     */\n    constructor(\n        readonly name: string,\n        readonly device: Device,\n        key: string | null = null,\n    ) {\n        super();\n\n        this.key = key !== null ? key : name.toLowerCase();\n    }\n\n    private _characteristics: Set<string> | null = null;\n\n    /**\n     * A list of all characteristics.\n     */\n    protected get characteristics(): Set<string> {\n        if (this._characteristics === null) {\n            // construct an array of properties stored by the @characteristic property decorator\n            const props = new Array<string>();\n            let proto = Object.getPrototypeOf(this);\n\n            // traverse the prototype chain and collect all properties\n            while (proto !== null) {\n                if (Object.prototype.hasOwnProperty.call(proto, '_characteristicProps')) {\n                    props.push(...proto._characteristicProps);\n                }\n\n                proto = Object.getPrototypeOf(proto);\n            }\n\n            // store the list\n            this._characteristics = new Set(props);\n        }\n\n        return this._characteristics;\n    }\n\n    /**\n     * Updates the characteristics of the component.\n     * This method will emit `change` events for all characteristics that are\n     * updated.\n     * @param data - A data object that contains characteristics and their values.\n     */\n    update(data: Record<string | number | symbol, unknown>) {\n        const cs = this.characteristics;\n        const changed = new Set<string>();\n\n        if (!cs) {\n            // abort if we don't have any characteristics\n            return;\n        }\n\n        // loop through each of our characteristics\n        for (const c of cs) {\n            if (!Object.prototype.hasOwnProperty.call(data, c)) {\n                // ignore if this characteristic is not in the data set\n                continue;\n            }\n\n            if (typeof data[c] === 'object' && this[c]) {\n                // if this is an object, we need to check for deep equality\n                if (equal(data[c], this[c])) {\n                    // skip if nothing has changed\n                    continue;\n                }\n\n                // copy the attributes of the characteristic\n                Object.assign(this[c], data[c]);\n            } else {\n                if (data[c] === this[c]) {\n                    // skip if the value is unchanged\n                    continue;\n                }\n\n                // assign the new value to our characteristic\n                this[c] = data[c];\n            }\n\n            // add it to the list of changed characteristics\n            changed.add(c);\n        }\n\n        // emit all change events after the characteristics have been updated\n        for (const c of changed) {\n            this.emit('change', c, this[c]);\n            this.emit('change:' + c, this[c]);\n        }\n    }\n\n    /**\n     * Handles events received from the device RPC handler.\n     * Subclasses should override this method to handle their specific events.\n     * @param event - The event that has occurred.\n     */\n    handleEvent(event: RpcEvent) {\n        if (event.event === 'config_changed') {\n            this.emit('configChange', event.cfg_rev as number, event.restart_required as boolean);\n        }\n    }\n\n    /**\n     * Shorthand method for making an RPC.\n     */\n    protected rpc<T>(method: string, params?: RpcParams): PromiseLike<T> {\n        return this.device.rpcHandler.request<T>(`${this.name}.${method}`, params);\n    }\n}\n\n/**\n * Defines the default response from a component's SetConfig RPC method.\n */\nexport interface DefaultConfigResponse {\n    restart_required: boolean;\n}\n\n/**\n * Defines a set of methods common for (almost) all device components.\n */\nexport abstract class Component<Attributes, Config, ConfigResponse = DefaultConfigResponse> extends ComponentBase {\n    /**\n     * The confoguration options for this component.\n     * Use the `getConfig()` method to load these options.\n     * This property is automatically populated by the `Device.loadConfig()` method.\n     */\n    config?: Config;\n\n    /**\n     * Retrieves the status of this component.\n     */\n    getStatus(): PromiseLike<Attributes> {\n        return this.rpc<Attributes>('GetStatus');\n    }\n\n    /**\n     * Retrieves the configuration of this component.\n     */\n    getConfig(): PromiseLike<Config> {\n        return this.rpc<Config>('GetConfig');\n    }\n\n    /**\n     * Requests changes in the configuration of this component.\n     * @param config - The configuration options to set.\n     */\n    setConfig(config: Partial<Config>): PromiseLike<ConfigResponse> {\n        return this.rpc<ConfigResponse>('SetConfig', {\n            config,\n        });\n    }\n}\n\n/**\n * Base class for components with an ID.\n */\nexport abstract class ComponentWithId<Attributes, Config, ConfigResponse = DefaultConfigResponse> extends Component<\n    Attributes,\n    Config,\n    ConfigResponse\n> {\n    /**\n     * @param name - The name of this component. Used when making RPCs.\n     * @param device - The device that owns this component.\n     * @param id - ID of this component.\n     * @param key - The key used to identify the component in status updates etc. If `null`, the component name\n     * in lower case letters will be used. The component ID will be appended to this key.\n     */\n    constructor(\n        name: string,\n        device: Device,\n        readonly id: number = 0,\n        key: string | null = null,\n    ) {\n        super(name, device, (key !== null ? key : name.toLowerCase()) + ':' + id);\n    }\n\n    /**\n     * Retrieves the status of this component.\n     */\n    getStatus(): PromiseLike<Attributes> {\n        return this.rpc<Attributes>('GetStatus', {\n            id: this.id,\n        });\n    }\n\n    /**\n     * Retrieves the configuration of this component.\n     */\n    getConfig(): PromiseLike<Config> {\n        return this.rpc<Config>('GetConfig', {\n            id: this.id,\n        });\n    }\n\n    /**\n     * Requests changes in the configuration of this component.\n     * @param config - The configuration options to set.\n     */\n    setConfig(config: Partial<Config>): PromiseLike<ConfigResponse> {\n        return this.rpc<ConfigResponse>('SetConfig', {\n            id: this.id,\n            config,\n        });\n    }\n}\n","import { Component } from './base';\nimport { Device } from '../devices';\n\nexport interface BluetoothLowEnergyAttributes {}\n\nexport interface BluetoothLowEnergyConfig {\n    enable: boolean;\n}\n\n/**\n * Handles the Bluetooth services of a device.\n */\nexport class BluetoothLowEnergy\n    extends Component<BluetoothLowEnergyAttributes, BluetoothLowEnergyConfig>\n    implements BluetoothLowEnergyAttributes\n{\n    constructor(device: Device) {\n        super('BLE', device);\n    }\n}\n","import { characteristic, Component } from './base';\nimport { Device } from '../devices';\n\nexport interface CloudAttributes {\n    connected: boolean;\n}\n\nexport interface CloudConfig {\n    enable: boolean;\n    server: string | null;\n}\n\n/**\n * Handles the Cloud services of a device.\n */\nexport class Cloud extends Component<CloudAttributes, CloudConfig> implements CloudAttributes {\n    /**\n     * Whether the device is connected to the Shelly cloud.\n     */\n    @characteristic\n    readonly connected: boolean = false;\n\n    constructor(device: Device) {\n        super('Cloud', device);\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface CoverEnergyCounterAttributes {\n    total: number;\n    by_minute: number[];\n    minute_ts: number;\n}\n\nexport interface CoverTemperatureAttributes {\n    tC: number | null;\n    tF: number | null;\n}\n\nexport interface CoverAttributes {\n    id: number;\n    source: string;\n    state: 'open' | 'closed' | 'opening' | 'closing' | 'stopped' | 'calibrating';\n    apower: number;\n    voltage: number;\n    current: number;\n    pf: number;\n    aenergy: CoverEnergyCounterAttributes;\n    current_pos: number | null;\n    target_pos: number | null;\n    move_timeout?: number;\n    move_started_at?: number;\n    pos_control: boolean;\n    temperature?: CoverTemperatureAttributes;\n    errors?: string[];\n}\n\nexport interface CoverAcMotorConfig {\n    idle_power_thr: number;\n}\n\nexport interface CoverObstructionDetectionConfig {\n    enable: boolean;\n    direction: 'open' | 'close' | 'both';\n    action: 'stop' | 'reverse';\n    power_thr: number;\n    holdoff: number;\n}\n\nexport interface CoverSafetySwitchConfig {\n    enable: boolean;\n    direction: 'open' | 'close' | 'both';\n    action: 'stop' | 'reverse' | 'pause';\n    allowed_move: 'reverse' | null;\n}\n\nexport interface CoverConfig {\n    id: number;\n    name: string | null;\n    in_mode?: 'single' | 'dual' | 'detached';\n    initial_state: 'open' | 'closed' | 'stopped';\n    power_limit: number;\n    voltage_limit: number;\n    current_limit: number;\n    motor?: CoverAcMotorConfig;\n    maxtime_open: number;\n    maxtime_close: number;\n    swap_inputs?: boolean;\n    invert_directions: boolean;\n    obstruction_detection: CoverObstructionDetectionConfig;\n    safety_switch?: CoverSafetySwitchConfig;\n}\n\n/**\n * Handles the operation of moorized garage doors, window blinds, roof skylights etc.\n */\nexport class Cover extends ComponentWithId<CoverAttributes, CoverConfig> implements CoverAttributes {\n    /**\n     * Source of the last command.\n     */\n    @characteristic\n    readonly source: string = '';\n\n    /**\n     * The current state.\n     */\n    @characteristic\n    readonly state: 'open' | 'closed' | 'opening' | 'closing' | 'stopped' | 'calibrating' = 'stopped';\n\n    /**\n     * The current (last measured) instantaneous power delivered to the attached\n     * load.\n     */\n    @characteristic\n    readonly apower: number = 0;\n\n    /**\n     * Last measured voltage (in Volts).\n     */\n    @characteristic\n    readonly voltage: number = 0;\n\n    /**\n     * Last measured current (in Amperes).\n     */\n    @characteristic\n    readonly current: number = 0;\n\n    /**\n     * Last measured power factor.\n     */\n    @characteristic\n    readonly pf: number = 0;\n\n    /**\n     * Information about the energy counter.\n     */\n    @characteristic\n    readonly aenergy: CoverEnergyCounterAttributes = {\n        total: 0,\n        by_minute: [],\n        minute_ts: 0,\n    };\n\n    /**\n     * The current position in percent, from `0` (fully closed) to `100` (fully open); or `null` if not calibrated.\n     */\n    @characteristic\n    readonly current_pos: number | null = null;\n\n    /**\n     * The requested target position in percent, from `0` (fully closed) to `100` (fully open); or `null` if not calibrated\n     * or not actively moving.\n     */\n    @characteristic\n    readonly target_pos: number | null = null;\n\n    /**\n     * A timeout (in seconds) after which the cover will automatically stop moving; or `undefined` if not actively moving.\n     */\n    @characteristic\n    readonly move_timeout: number | undefined;\n\n    /**\n     * The time at which the movement began; or `undefined` if not actively moving.\n     */\n    @characteristic\n    readonly move_started_at: number | undefined;\n\n    /**\n     * Whether the cover has been calibrated.\n     */\n    @characteristic\n    readonly pos_control: boolean = false;\n\n    /**\n     * Information about the temperature sensor (if applicable).\n     */\n    @characteristic\n    readonly temperature: CoverTemperatureAttributes | undefined;\n\n    /**\n     * Any error conditions that have occurred.\n     */\n    @characteristic\n    readonly errors: string[] | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('Cover', device, id);\n    }\n\n    /**\n     * Opens the cover.\n     * @param duration - Move in open direction for the specified time (in seconds).\n     */\n    open(duration?: number): PromiseLike<null> {\n        return this.rpc<null>('Open', {\n            id: this.id,\n            duration,\n        });\n    }\n\n    /**\n     * Closes the cover.\n     * @param duration - Move in close direction for the specified time (in seconds).\n     */\n    close(duration?: number): PromiseLike<null> {\n        return this.rpc<null>('Close', {\n            id: this.id,\n            duration,\n        });\n    }\n\n    /**\n     * Stops any ongoing movement.\n     */\n    stop(): PromiseLike<null> {\n        return this.rpc<null>('Stop', {\n            id: this.id,\n        });\n    }\n\n    /**\n     * Moves the cover to the given position.\n     * One, but not both, of `pos` and `rel` must be specified.\n     * @param pos - An absolute position (in percent).\n     * @param rel - A relative position (in percent).\n     */\n    goToPosition(pos?: number, rel?: number): PromiseLike<null> {\n        return this.rpc<null>('GoToPosition', {\n            id: this.id,\n            pos,\n            rel,\n        });\n    }\n\n    /**\n     * Starts the calibration procedure.\n     */\n    calibrate(): PromiseLike<null> {\n        return this.rpc<null>('Calibrate', {\n            id: this.id,\n        });\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface DevicePowerBatteryStatus {\n    V: number | null;\n    percent: number | null;\n}\n\nexport interface DevicePowerExternalSource {\n    present: boolean;\n}\n\nexport interface DevicePowerAttributes {\n    id: number;\n    battery: DevicePowerBatteryStatus;\n    external?: DevicePowerExternalSource;\n    errors?: string[];\n}\n\nexport interface DevicePowerConfig {}\n\n/**\n * Handles the monitoring of a device's battery charge.\n */\nexport class DevicePower\n    extends ComponentWithId<DevicePowerAttributes, DevicePowerConfig>\n    implements DevicePowerAttributes\n{\n    /**\n     * Information about the battery charge.\n     */\n    @characteristic\n    readonly battery: DevicePowerBatteryStatus = {\n        V: null,\n        percent: null,\n    };\n\n    /**\n     * Information about the external power source.\n     */\n    @characteristic\n    readonly external: DevicePowerExternalSource | undefined;\n\n    /**\n     * Any error conditions that have occurred.\n     */\n    @characteristic\n    readonly errors: string[] | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('DevicePower', device, id);\n    }\n}\n","import { characteristic, Component } from './base';\nimport { Device } from '../devices';\n\nexport interface EthernetAttributes {\n    ip: string | null;\n}\n\nexport interface EthernetConfig {\n    enable: boolean;\n    ipv4mode: 'dhcp' | 'static';\n    ip: string | null;\n    netmask: string | null;\n    gw: string | null;\n    nameserver: string | null;\n}\n\n/**\n * Handles the Ethernet services of a device.\n */\nexport class Ethernet extends Component<EthernetAttributes, EthernetConfig> implements EthernetAttributes {\n    /**\n     * IP address of the device.\n     */\n    @characteristic\n    readonly ip: string | null = null;\n\n    constructor(device: Device) {\n        super('Eth', device);\n    }\n}\n","import { Component } from './base';\nimport { Device } from '../devices';\n\nexport interface HtUiAttributes {}\n\nexport interface HtUiConfig {\n    temperature_unit: 'C' | 'F';\n}\n\n/**\n * Handles the settings of a Plus H&T device's screen.\n */\nexport class HtUi extends Component<HtUiAttributes, HtUiConfig> implements HtUiAttributes {\n    constructor(device: Device) {\n        super('HT_UI', device);\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface HumidityAttributes {\n    id: number;\n    rh: number | null;\n    errors?: string[];\n}\n\nexport interface HumidityConfig {\n    id: number;\n    name: string | null;\n    report_thr: number;\n}\n\n/**\n * Handles the monitoring of a device's humidity sensor.\n */\nexport class Humidity extends ComponentWithId<HumidityAttributes, HumidityConfig> implements HumidityAttributes {\n    /**\n     * Relative humidity, in percent.\n     */\n    @characteristic\n    readonly rh: number | null = null;\n\n    /**\n     * Any error conditions that have occurred.\n     */\n    @characteristic\n    readonly errors: string[] | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('Humidity', device, id);\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\nimport { RpcEvent } from '../rpc';\n\nexport interface InputAttributes {\n    id: number;\n    state: boolean | null;\n}\n\nexport interface InputConfig {\n    id: number;\n    name: string | null;\n    type: 'switch' | 'button';\n    invert: boolean;\n    factory_reset?: boolean;\n}\n\n/**\n * Handles the input of a device.\n */\nexport class Input extends ComponentWithId<InputAttributes, InputConfig> implements InputAttributes {\n    /**\n     * State of the input (null if stateless).\n     */\n    @characteristic\n    readonly state: boolean | null = null;\n\n    constructor(device: Device, id = 0) {\n        super('Input', device, id);\n    }\n\n    handleEvent(event: RpcEvent) {\n        switch (event.event) {\n            case 'btn_down':\n                this.emit('buttonDown');\n                break;\n\n            case 'btn_up':\n                this.emit('buttonUp');\n                break;\n\n            case 'single_push':\n                this.emit('singlePush');\n                break;\n\n            case 'double_push':\n                this.emit('doublePush');\n                break;\n\n            case 'long_push':\n                this.emit('longPush');\n                break;\n\n            default:\n                super.handleEvent(event);\n        }\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface LightAttributes {\n    id: number;\n    source: string;\n    output: boolean;\n    brightness: number;\n    timer_started_at?: number;\n    timer_duration?: number;\n}\n\nexport interface LightConfig {\n    id: number;\n    name: string | null;\n    initial_state: 'off' | 'on' | 'restore_last' | 'match_input';\n    auto_on: boolean;\n    auto_on_delay: number;\n    auto_off: boolean;\n    auto_off_delay: number;\n    default: {\n        brightness: number;\n    };\n    night_mode: {\n        enable: boolean;\n        brightness: number;\n        active_between?: string[];\n    };\n}\n\n/**\n * Handles a dimmable light output with additional on/off control.\n */\nexport class Light extends ComponentWithId<LightAttributes, LightConfig> implements LightAttributes {\n    /**\n     * Source of the last command.\n     */\n    @characteristic\n    readonly source: string = '';\n\n    /**\n     * true if the output channel is currently on, false otherwise.\n     */\n    @characteristic\n    readonly output: boolean = false;\n\n    /**\n     * Current brightness level, in percent.\n     */\n    @characteristic\n    readonly brightness: number = 0;\n\n    /**\n     * Start time of the timer (as a UNIX timestamp, in UTC).\n     */\n    @characteristic\n    readonly timer_started_at: number | undefined;\n\n    /**\n     * Duration of the timer, in seconds.\n     */\n    @characteristic\n    readonly timer_duration: number | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('Light', device, id);\n    }\n\n    /**\n     * Toggles the output state.\n     */\n    toggle(): PromiseLike<null> {\n        return this.rpc<null>('Toggle', {\n            id: this.id,\n        });\n    }\n\n    /**\n     * Sets the output and brightness level of the light.\n     * At least one of `on` and `brightness` must be specified.\n     * @param on - Whether to switch on or off.\n     * @param brightness - Brightness level.\n     * @param toggle_after - Flip-back timer, in seconds.\n     */\n    set(on?: boolean, brightness?: number, toggle_after?: number): PromiseLike<null> {\n        return this.rpc<null>('Set', {\n            id: this.id,\n            on,\n            brightness,\n            toggle_after,\n        });\n    }\n}\n","import { characteristic, Component } from './base';\nimport { Device } from '../devices';\n\nexport interface MqttAttributes {\n    connected: boolean;\n}\n\nexport interface MqttConfig {\n    enable: boolean;\n    server: string | null;\n    client_id: string | null;\n    user: string | null;\n    pass?: string | null;\n    ssl_ca: '*' | 'user_ca.pem' | 'ca.pem' | null;\n    topic_prefix: string | null;\n    rpc_ntf: boolean;\n    status_ntf: boolean;\n}\n\n/**\n * Handles configuration and status of the device's outbound MQTT connection.\n */\nexport class Mqtt extends Component<MqttAttributes, MqttConfig> implements MqttAttributes {\n    /**\n     * Whether the device is connected to an MQTT server.\n     */\n    @characteristic\n    readonly connected: boolean = false;\n\n    constructor(device: Device) {\n        super('MQTT', device);\n    }\n}\n","import { characteristic, Component } from './base';\nimport { Device } from '../devices';\n\nexport interface OutboundWebSocketAttributes {\n    connected: boolean;\n}\n\nexport interface OutboundWebSocketConfig {\n    enable: boolean;\n    server: string;\n    ssl_ca: '*' | 'user_ca.pem' | 'ca.pem' | null;\n}\n\n/**\n * Makes it possible to configure a device to establish and maintain an outbound WebSocket connection.\n */\nexport class OutboundWebSocket\n    extends Component<OutboundWebSocketAttributes, OutboundWebSocketConfig>\n    implements OutboundWebSocketAttributes\n{\n    /**\n     * Whether an outbound WebSocket connection is established.\n     */\n    @characteristic\n    readonly connected: boolean = false;\n\n    constructor(device: Device) {\n        super('Ws', device);\n    }\n}\n","import { ComponentBase } from './base';\nimport { Device } from '../devices';\n\nexport interface ScriptAttributes {\n    id: number;\n    running: boolean;\n    errors?: string[];\n}\n\nexport interface ScriptConfig {\n    id: number;\n    name: string;\n    enable: boolean;\n}\n\nexport interface ScriptConfigResponse {\n    restart_required: boolean;\n}\n\nexport interface ScriptList {\n    scripts: Array<{\n        id: number;\n        name: string;\n        enable: boolean;\n        running: boolean;\n    }>;\n}\n\nexport interface ScriptCreateResponse {\n    id: number;\n}\n\nexport interface ScriptStartStopResponse {\n    was_running: boolean;\n}\n\nexport interface ScriptPutCodeResponse {\n    len: number;\n}\n\nexport interface ScriptGetCodeResponse {\n    data: string;\n    left: number;\n}\n\nexport interface ScriptEvalResponse {\n    result: string;\n}\n\n/**\n * Handles scripts on a device.\n */\nexport class Script extends ComponentBase {\n    constructor(device: Device) {\n        super('Script', device);\n    }\n\n    /**\n     * Retrieves the status of a script.\n     * @param id - The script ID.\n     */\n    getStatus(id: number): PromiseLike<ScriptAttributes> {\n        return this.rpc<ScriptAttributes>('GetStatus', {\n            id,\n        });\n    }\n\n    /**\n     * Retrieves the configuration of a script.\n     * @param id - The script ID.\n     */\n    getConfig(id: number): PromiseLike<ScriptConfig> {\n        return this.rpc<ScriptConfig>('GetConfig', {\n            id,\n        });\n    }\n\n    /**\n     * Requests changes in the configuration of a script.\n     * @param id - The script ID.\n     * @param config - The configuration options to set.\n     */\n    setConfig(id: number, config: Partial<ScriptConfig>): PromiseLike<ScriptConfigResponse> {\n        return this.rpc<ScriptConfigResponse>('SetConfig', {\n            id,\n            config,\n        });\n    }\n\n    /**\n     * Lists all scripts.\n     */\n    list(): PromiseLike<ScriptList> {\n        return this.rpc<ScriptList>('List');\n    }\n\n    /**\n     * Creates a new script.\n     * @param name - The name of the script.\n     */\n    create(name: string): PromiseLike<ScriptCreateResponse> {\n        return this.rpc<ScriptCreateResponse>('Create', {\n            name,\n        });\n    }\n\n    /**\n     * Removes a script.\n     * @param id - The script ID.\n     */\n    delete(id: number): PromiseLike<null> {\n        return this.rpc<null>('Delete', {\n            id,\n        });\n    }\n\n    /**\n     * Runs a script.\n     * @param id - The script ID.\n     */\n    start(id: number): PromiseLike<ScriptStartStopResponse> {\n        return this.rpc<ScriptStartStopResponse>('Start', {\n            id,\n        });\n    }\n\n    /**\n     * Stops the execution of a script.\n     * @param id - The script ID.\n     */\n    stop(id: number): PromiseLike<ScriptStartStopResponse> {\n        return this.rpc<ScriptStartStopResponse>('Stop', {\n            id,\n        });\n    }\n\n    /**\n     * Uploads code to a script.\n     * @param id - The script ID.\n     * @param code - The code to upload.\n     * @param append - Whether the code should be appended to the script or overwrite any existing code.\n     */\n    putCode(id: number, code: string, append = false): PromiseLike<ScriptPutCodeResponse> {\n        return this.rpc<ScriptPutCodeResponse>('PutCode', {\n            id,\n            code,\n            append,\n        });\n    }\n\n    /**\n     * Downloads code from a script.\n     * @param id - The script ID.\n     * @param offset - The byte offset from the beginning.\n     * @param len - The number of bytes to download.\n     */\n    getCode(id: number, offset = 0, len?: number): PromiseLike<ScriptGetCodeResponse> {\n        return this.rpc<ScriptGetCodeResponse>('GetCode', {\n            id,\n            offset,\n            len,\n        });\n    }\n\n    /**\n     * Evaluates or executes code inside of a script.\n     * @param id - The script ID.\n     * @param code - The code to evaluate.\n     */\n    eval(id: number, code: string): PromiseLike<ScriptEvalResponse> {\n        return this.rpc<ScriptEvalResponse>('Eval', {\n            id,\n            code,\n        });\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface SwitchEnergyCounterAttributes {\n    total: number;\n    by_minute: number[];\n    minute_ts: number;\n}\n\nexport interface SwitchTemperatureAttributes {\n    tC: number | null;\n    tF: number | null;\n}\n\nexport interface SwitchAttributes {\n    id: number;\n    source: string;\n    output: boolean;\n    timer_started_at?: number;\n    timer_duration?: number;\n    apower?: number;\n    voltage?: number;\n    current?: number;\n    pf?: number;\n    aenergy?: SwitchEnergyCounterAttributes;\n    temperature: SwitchTemperatureAttributes;\n    errors?: string[];\n}\n\nexport interface SwitchConfig {\n    id: number;\n    name: string | null;\n    in_mode: 'momentary' | 'follow' | 'flip' | 'detached';\n    initial_state: 'off' | 'on' | 'restore_last' | 'match_input';\n    auto_on: boolean;\n    auto_on_delay: number;\n    auto_off: boolean;\n    auto_off_delay: number;\n    input_id: number;\n    power_limit?: number | null;\n    voltage_limit?: number | null;\n    current_limit?: number | null;\n}\n\nexport interface SwitchSetResponse {\n    was_on: boolean;\n}\n\n/**\n * Represents a switch (relay) of a device.\n */\nexport class Switch extends ComponentWithId<SwitchAttributes, SwitchConfig> implements SwitchAttributes {\n    /**\n     * Source of the last command.\n     */\n    @characteristic\n    readonly source: string = '';\n\n    /**\n     * true if the output channel is currently on, false otherwise.\n     */\n    @characteristic\n    readonly output: boolean = false;\n\n    /**\n     * Start time of the timer (as a UNIX timestamp, in UTC).\n     */\n    @characteristic\n    readonly timer_started_at: number | undefined;\n\n    /**\n     * Duration of the timer, in seconds;\n     */\n    @characteristic\n    readonly timer_duration: number | undefined;\n\n    /**\n     * The current (last measured) instantaneous power delivered to the attached\n     * load (if applicable).\n     */\n    @characteristic\n    readonly apower: number | undefined;\n\n    /**\n     * Last measured voltage (in Volts, if applicable).\n     */\n    @characteristic\n    readonly voltage: number | undefined;\n\n    /**\n     * Last measured current (in Amperes, if applicable).\n     */\n    @characteristic\n    readonly current: number | undefined;\n\n    /**\n     * Last measured power factor (if applicable).\n     */\n    @characteristic\n    readonly pf: number | undefined;\n\n    /**\n     * Information about the energy counter (if applicable).\n     */\n    @characteristic\n    readonly aenergy: SwitchEnergyCounterAttributes | undefined;\n\n    /**\n     * Information about the temperature.\n     */\n    @characteristic\n    readonly temperature: SwitchTemperatureAttributes = {\n        tC: null,\n        tF: null,\n    };\n\n    /**\n     * Any error conditions that have occurred.\n     */\n    @characteristic\n    readonly errors: string[] | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('Switch', device, id);\n    }\n\n    /**\n     * Toggles the switch.\n     */\n    toggle(): PromiseLike<SwitchSetResponse> {\n        return this.rpc<SwitchSetResponse>('Toggle', {\n            id: this.id,\n        });\n    }\n\n    /**\n     * Sets the output of the switch.\n     * @param on - Whether to switch on or off.\n     * @param toggle_after - Flip-back timer, in seconds.\n     */\n    set(on: boolean, toggle_after?: number): PromiseLike<SwitchSetResponse> {\n        return this.rpc<SwitchSetResponse>('Set', {\n            id: this.id,\n            on,\n            toggle_after,\n        });\n    }\n}\n","import { characteristic, Component } from './base';\nimport { Device } from '../devices';\nimport { RpcEvent } from '../rpc';\n\nexport interface SystemFirmwareUpdate {\n    stable?: {\n        version: string;\n    };\n    beta?: {\n        version: string;\n    };\n}\n\nexport interface SystemWakeupReason {\n    boot: 'poweron' | 'software_restart' | 'deepsleep_wake' | 'internal' | 'unknown';\n    cause: 'button' | 'usb' | 'periodic' | 'status_update' | 'undefined';\n}\n\nexport interface SystemAttributes {\n    mac: string;\n    restart_required: boolean;\n    time: string;\n    unixtime: number;\n    uptime: number;\n    ram_size: number;\n    ram_free: number;\n    fs_size: number;\n    fs_free: number;\n    cfg_rev: number;\n    kvs_rev: number;\n    schedule_rev?: number;\n    webhook_rev?: number;\n    available_updates: SystemFirmwareUpdate;\n    wakeup_reason?: SystemWakeupReason;\n}\n\nexport interface SystemConfig {\n    device: {\n        name: string;\n        eco_mode: boolean;\n        mac: string;\n        fw_id: string;\n        profile?: string;\n        discoverable: boolean;\n    };\n    location: {\n        tz: string | null;\n        lat: number | null;\n        lon: number | null;\n    };\n    debug: {\n        mqtt: {\n            enable: boolean;\n        };\n        websocket: {\n            enable: boolean;\n        };\n        udp: {\n            addr: string | null;\n        };\n    };\n    ui_data: Record<string, unknown>;\n    rpc_udp: {\n        dst_addr: string | null;\n        listen_port: number | null;\n    };\n    sntp: {\n        server: string;\n    };\n    sleep?: {\n        wakeup_period: number;\n    };\n    cfg_rev: number;\n}\n\n/**\n * Handles the system services of a device.\n */\nexport class System extends Component<SystemAttributes, SystemConfig> implements SystemAttributes {\n    /**\n     * MAC address of the device.\n     */\n    @characteristic\n    readonly mac: string = '';\n\n    /**\n     * true if a restart is required, false otherwise.\n     */\n    @characteristic\n    readonly restart_required: boolean = false;\n\n    /**\n     * Local time in the current timezone (HH:MM).\n     */\n    @characteristic\n    readonly time: string = '';\n\n    /**\n     * Current time in UTC as a UNIX timestamp.\n     */\n    @characteristic\n    readonly unixtime: number = 0;\n\n    /**\n     * Time in seconds since last reboot.\n     */\n    @characteristic\n    readonly uptime: number = 0;\n\n    /**\n     * Total RAM, in bytes.\n     */\n    @characteristic\n    readonly ram_size: number = 0;\n\n    /**\n     * Available RAM, in bytes.\n     */\n    @characteristic\n    readonly ram_free: number = 0;\n\n    /**\n     * File system total size, in bytes.\n     */\n    @characteristic\n    readonly fs_size: number = 0;\n\n    /**\n     * File system available size, in bytes.\n     */\n    @characteristic\n    readonly fs_free: number = 0;\n\n    /**\n     * Configuration revision number.\n     */\n    @characteristic\n    readonly cfg_rev: number = 0;\n\n    /**\n     * KVS (Key-Value Store) revision number.\n     */\n    @characteristic\n    readonly kvs_rev: number = 0;\n\n    /**\n     * Schedule revision number (present if schedules are enabled).\n     */\n    @characteristic\n    readonly schedule_rev: number | undefined;\n\n    /**\n     * Webhook revision number (present if schedules are enabled).\n     */\n    @characteristic\n    readonly webhook_rev: number | undefined;\n\n    /**\n     * Available firmware updates, if any.\n     */\n    @characteristic\n    readonly available_updates: SystemFirmwareUpdate = {};\n\n    /**\n     * Information about boot type and cause (only for battery-operated devices).\n     */\n    @characteristic\n    readonly wakeup_reason: SystemWakeupReason | undefined;\n\n    constructor(device: Device) {\n        super('Sys', device);\n    }\n\n    handleEvent(event: RpcEvent) {\n        switch (event.event) {\n            case 'ota_begin':\n                this.emit('otaBegin', event.msg);\n                break;\n\n            case 'ota_progress':\n                this.emit('otaProgress', event.progress_percent, event.msg);\n                break;\n\n            case 'ota_success':\n                this.emit('otaSuccess', event.msg);\n                break;\n\n            case 'ota_error':\n                this.emit('otaError', event.msg);\n                break;\n\n            case 'sleep':\n                this.emit('sleep');\n                break;\n\n            default:\n                super.handleEvent(event);\n        }\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface TemperatureAttributes {\n    id: number;\n    tC: number | null;\n    tF: number | null;\n    errors?: string[];\n}\n\nexport interface TemperatureConfig {\n    id: number;\n    name: string | null;\n    report_thr_C: number;\n}\n\n/**\n * Handles the monitoring of a device's temperature sensor.\n */\nexport class Temperature\n    extends ComponentWithId<TemperatureAttributes, TemperatureConfig>\n    implements TemperatureAttributes\n{\n    /**\n     * Current temperature, in Celsius.\n     */\n    @characteristic\n    readonly tC: number | null = null;\n\n    /**\n     * Current temperature, in Fahrenheit.\n     */\n    @characteristic\n    readonly tF: number | null = null;\n\n    /**\n     * Any error conditions that have occurred.\n     */\n    @characteristic\n    readonly errors: string[] | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('Temperature', device, id);\n    }\n}\n","import { Component } from './base';\nimport { Device } from '../devices';\n\nexport interface UiAttributes {}\n\nexport interface UiConfig {\n    idle_brightness: number;\n}\n\n/**\n * Handles the settings of a Pro4PM device's screen.\n */\nexport class Ui extends Component<UiAttributes, UiConfig> implements UiAttributes {\n    constructor(device: Device) {\n        super('UI', device);\n    }\n}\n","import { characteristic, Component } from './base';\nimport { Device } from '../devices';\nimport { RpcEvent } from '../rpc';\n\nexport interface WiFiAttributes {\n    sta_ip: string | null;\n    status: 'disconnected' | 'connecting' | 'connected' | 'got ip';\n    ssid: string | null;\n    rssi: number;\n    ap_client_count?: number;\n}\n\nexport interface WiFiStationConfig {\n    ssid: string | null;\n    pass?: string | null;\n    is_open: boolean;\n    enable: boolean;\n    ipv4mode: 'dhcp' | 'static';\n    ip: string | null;\n    netmask: string | null;\n    gw: string | null;\n    nameserver: string | null;\n}\n\nexport interface WiFiConfig {\n    ap: {\n        ssid: string | null;\n        is_open: boolean;\n        enable: boolean;\n        range_extender?: {\n            enable: boolean;\n        };\n    };\n    sta: WiFiStationConfig;\n    sta1: WiFiStationConfig;\n    roam: {\n        rssi_thr: number;\n        interval: number;\n    };\n}\n\nexport interface WiFiScanResponse {\n    results: Array<{\n        ssid: string | null;\n        bssid: string;\n        auth: 0 | 1 | 2 | 3 | 4 | 5;\n        channel: number;\n        rssi: number;\n    }>;\n}\n\nexport interface WiFiListApClientsResponse {\n    ts: number | null;\n    ap_clients: Array<{\n        mac: string;\n        ip: string;\n        ip_static: boolean;\n        mport: number;\n        since: number;\n    }>;\n}\n\n/**\n * Handles the WiFi services of a device.\n */\nexport class WiFi extends Component<WiFiAttributes, WiFiConfig> implements WiFiAttributes {\n    /**\n     * IP address of the device.\n     */\n    @characteristic\n    readonly sta_ip: string | null = null;\n\n    /**\n     * Status of the connection.\n     */\n    @characteristic\n    readonly status: 'disconnected' | 'connecting' | 'connected' | 'got ip' = 'disconnected';\n\n    /**\n     * SSID of the network.\n     */\n    @characteristic\n    readonly ssid: string | null = null;\n\n    /**\n     * Signal strength, in dBms.\n     */\n    @characteristic\n    readonly rssi: number = 0;\n\n    /**\n     * Number of clients connected to the access point.\n     */\n    @characteristic\n    readonly ap_client_count: number | undefined;\n\n    constructor(device: Device) {\n        super('WiFi', device);\n    }\n\n    /**\n     * Retrieves a list of available networks.\n     */\n    scan(): PromiseLike<WiFiScanResponse> {\n        return this.rpc<WiFiScanResponse>('Scan');\n    }\n\n    /**\n     * Returns a list of clients currently connected to the device's access point.\n     */\n    listApClients(): PromiseLike<WiFiListApClientsResponse> {\n        return this.rpc<WiFiListApClientsResponse>('ListAPClients');\n    }\n\n    handleEvent(event: RpcEvent) {\n        switch (event.event) {\n            case 'sta_connect_fail':\n                this.emit('connectionError', event.reason);\n                break;\n\n            case 'sta_disconnected':\n                this.emit('disconnect', event.reason, event.ssid, event.sta_ip);\n                break;\n\n            default:\n                super.handleEvent(event);\n        }\n    }\n}\n","import { characteristic, ComponentWithId } from './base';\nimport { Device } from '../devices';\n\nexport interface Pm1AenergyStatus {\n    total: number;\n    by_minute?: number[];\n    minute_ts: number;\n}\n\nexport interface Pm1Attributes {\n    id: number;\n    output: boolean;\n    voltage?: number;\n    current?: number;\n    apower?: number;\n    aprtpower?: number;\n    pf?: number;\n    freq?: number;\n    aenergy?: Pm1AenergyStatus;\n    ret_aenergy?: Pm1AenergyStatus;\n    errors?: string[];\n}\n\nexport interface Pm1Config {\n    id: number;\n    name: string | null;\n}\n\n/**\n * Handles the monitoring of a device's temperature sensor.\n */\nexport class Pm1 extends ComponentWithId<Pm1Attributes, Pm1Config> implements Pm1Attributes {\n    /**\n     * true if the output channel is currently on, false otherwise.\n     */\n    @characteristic\n    readonly output: boolean = false;\n\n    /**\n     * Last measured voltage in Volts\n     */\n    @characteristic\n    readonly voltage: number | undefined;\n\n    /**\n     * Last measured current in Amperes\n     */\n    @characteristic\n    readonly current: number | undefined;\n\n    /**\n     * Last measured instantaneous active power (in Watts) delivered to the attached load\n     */\n    @characteristic\n    readonly apower: number | undefined;\n\n    /**\n     * Last measured instantaneous apparent power (in Volt-Amperes) delivered to the attached load (shown if applicable)\n     */\n    @characteristic\n    readonly aprtpower: number | undefined;\n\n    /**\n     * Last measured power factor (shown if applicable)\n     */\n    @characteristic\n    readonly pf: number | undefined;\n    /**\n     * Last measured network frequency (shown if applicable)\n     */\n    @characteristic\n    readonly freq: number | undefined;\n    /**\n     * Information about the active energy counter\n     */\n    @characteristic\n    readonly aenergy: Pm1AenergyStatus | undefined;\n\n    /**\n     * Information about the returned active energy counter\n     */\n    @characteristic\n    readonly ret_aenergy: Pm1AenergyStatus | undefined;\n\n    /**\n     * Any error conditions that have occurred.\n     */\n    @characteristic\n    readonly errors: string[] | undefined;\n\n    constructor(device: Device, id = 0) {\n        super('Pm1', device, id);\n    }\n}\n","import EventEmitter from 'eventemitter3';\n\nimport { Component, ComponentLike, System } from '../components';\nimport { HttpService, KvsService, ScheduleService, ShellyService, WebhookService } from '../services';\nimport { RpcEventNotification, RpcHandler, RpcStatusNotification } from '../rpc';\n\nexport type DeviceId = string;\n\n/**\n * Information about a device.\n */\nexport interface DeviceInfo {\n    /**\n     * The device ID.\n     */\n    id: DeviceId;\n    /**\n     * The MAC address of the device.\n     */\n    mac: string;\n    /**\n     * The model designation of the device.\n     */\n    model?: string;\n    /**\n     * Current firmware ID.\n     */\n    fw_id?: string;\n    /**\n     * Current firmware version.\n     */\n    ver?: string;\n    /**\n     * Current device profile.\n     */\n    profile?: string;\n}\n\n/**\n * Information about the firmware that a device is running.\n */\nexport interface DeviceFirmwareInfo {\n    /**\n     * The firmware ID.\n     */\n    id?: string;\n    /**\n     * The firmware version.\n     */\n    version?: string;\n}\n\n/**\n * Describes a device class and its static properties.\n */\nexport interface DeviceClass {\n    new (info: DeviceInfo, rpcHandler: RpcHandler): Device;\n\n    /**\n     * The model designation of the device.\n     */\n    model: string;\n    /**\n     * A human-friendly name of the device model.\n     */\n    modelName: string;\n}\n\n/**\n * Property decorator used to label properties as components.\n * @param target - The prototype of the device class that the property belongs to.\n * @param propertyName - The name of the property.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const component = (target: any, propertyName: string) => {\n    // make sure the given prototype has an array of properties\n    if (!Object.prototype.hasOwnProperty.call(target, '_componentProps')) {\n        target._componentProps = new Array<string>();\n    }\n\n    // get the array of properties\n    const props: string[] = target._componentProps;\n\n    // add this property to the array\n    props.push(propertyName);\n};\n\n/**\n * Base class for all devices.\n */\nexport abstract class Device extends EventEmitter {\n    /**\n     * Holds all registered subclasses.\n     */\n    private static readonly subclasses = new Map<string, DeviceClass>();\n\n    /**\n     * Registers a device class, so that it can later be found based on its device model\n     * using the `Device.getClass()` method.\n     * @param cls - A subclass of `Device`.\n     */\n    static registerClass(cls: DeviceClass) {\n        const model = cls.model.toUpperCase();\n        // make sure it's not already registered\n        if (Device.subclasses.has(model)) {\n            throw new Error(`A device class for ${model} has already been registered`);\n        }\n\n        // add it to the list\n        Device.subclasses.set(model, cls);\n    }\n\n    /**\n     * Returns the device class for the given device model, if one has been registered.\n     * @param model - The model designation to lookup.\n     */\n    static getClass(model: string): DeviceClass | undefined {\n        return Device.subclasses.get(model.toUpperCase());\n    }\n\n    /**\n     * The ID of this device.\n     */\n    readonly id: DeviceId;\n\n    /**\n     * The MAC address of this device.\n     */\n    readonly macAddress: string;\n\n    /**\n     * Information about the firmware that the device is running.\n     */\n    readonly firmware: DeviceFirmwareInfo;\n\n    /**\n     * This device's Shelly service.\n     */\n    readonly shelly = new ShellyService(this);\n\n    /**\n     * This device's Schedule service.\n     */\n    readonly schedule = new ScheduleService(this);\n\n    /**\n     * This device's Webhook service.\n     */\n    readonly webhook = new WebhookService(this);\n\n    /**\n     * This device's HTTP service.\n     */\n    readonly http = new HttpService(this);\n\n    /**\n     * This device's KVS service.\n     */\n    readonly kvs = new KvsService(this);\n\n    @component\n    readonly system = new System(this);\n\n    /**\n     * @param info - Information about this device.\n     * @param rpcHandler - Used to make remote procedure calls.\n     */\n    constructor(\n        info: DeviceInfo,\n        readonly rpcHandler: RpcHandler,\n    ) {\n        super();\n\n        this.id = info.id;\n        this.macAddress = info.mac;\n        this.firmware = {\n            id: info.fw_id,\n            version: info.ver,\n        };\n        this._model = info.model;\n\n        // handle status updates\n        rpcHandler.on('statusUpdate', this.statusUpdateHandler, this);\n\n        // handle events\n        rpcHandler.on('event', this.eventHandler, this);\n    }\n\n    private _model: string | undefined;\n\n    /**\n     * The model designation of this device.\n     */\n    get model(): string {\n        return this._model || (this.constructor as DeviceClass).model;\n    }\n\n    /**\n     * A human-friendly name of the device model.\n     */\n    get modelName(): string {\n        return (this.constructor as DeviceClass).modelName;\n    }\n\n    private _components: Map<string, string> | null = null;\n\n    /**\n     * Maps component keys to property names.\n     */\n    protected get components(): Map<string, string> {\n        if (this._components === null) {\n            this._components = new Map();\n\n            // construct an array of properties stored by the @component property decorator\n            const props = new Array<string>();\n            let proto = Object.getPrototypeOf(this);\n\n            // traverse the prototype chain and collect all properties\n            while (proto !== null) {\n                if (Object.prototype.hasOwnProperty.call(proto, '_componentProps')) {\n                    props.push(...proto._componentProps);\n                }\n\n                proto = Object.getPrototypeOf(proto);\n            }\n\n            // map each component's key to its property name\n            for (const p of props) {\n                const cmpnt: ComponentLike = this[p];\n                if (!cmpnt) {\n                    continue;\n                }\n\n                this._components.set(cmpnt.key, p);\n            }\n        }\n\n        return this._components;\n    }\n\n    /**\n     * Determines whether this device has a component with a given key.\n     * @param key - The component key.\n     */\n    hasComponent(key: string): boolean {\n        return this.components.has(key);\n    }\n\n    /**\n     * Returns the component with the given key.\n     * @param key - The component key.\n     */\n    getComponent(key: string): ComponentLike | undefined {\n        const prop = this.components.get(key);\n        if (prop) {\n            return this[prop];\n        }\n\n        return undefined;\n    }\n\n    /**\n     * Returns a new Iterator object that contains each of the device's\n     * components.\n     */\n    *[Symbol.iterator](): IterableIterator<[string, ComponentLike]> {\n        for (const [key, prop] of this.components.entries()) {\n            yield [key, this[prop]];\n        }\n    }\n\n    /**\n     * Loads the status for all of the device's components and populates their characteristics.\n     */\n    async loadStatus() {\n        // retrieve the status\n        const status = await this.shelly.getStatus();\n\n        // update the components\n        for (const cmpnt in status) {\n            if (Object.prototype.hasOwnProperty.call(status, cmpnt) && typeof status[cmpnt] === 'object') {\n                this.getComponent(cmpnt)?.update(status[cmpnt] as Record<string, unknown>);\n            }\n        }\n    }\n\n    /**\n     * Loads the condiguration for all of the device's components and populates their `config` properties.\n     */\n    async loadConfig() {\n        // retrieve the config\n        const config = await this.shelly.getConfig();\n\n        // update the components\n        for (const cmpnt in config) {\n            if (Object.prototype.hasOwnProperty.call(config, cmpnt) && typeof config[cmpnt] === 'object') {\n                const c = this.getComponent(cmpnt);\n                if (c && c instanceof Component) {\n                    c.config = config[cmpnt];\n                }\n            }\n        }\n    }\n\n    /**\n     * Handles 'statusUpdate' events from our RPC handler.\n     */\n    protected statusUpdateHandler(update: RpcStatusNotification) {\n        // update each components\n        for (const cmpnt in update) {\n            if (\n                cmpnt !== 'ts' &&\n                Object.prototype.hasOwnProperty.call(update, cmpnt) &&\n                typeof update[cmpnt] === 'object'\n            ) {\n                this.getComponent(cmpnt)?.update(update[cmpnt] as Record<string, unknown>);\n            }\n        }\n    }\n\n    /**\n     * Handles 'event' events from our RPC handler.\n     */\n    protected eventHandler(events: RpcEventNotification) {\n        // pass each event on to its corresponding component\n        for (const event of events.events) {\n            this.getComponent(event.component)?.handleEvent(event);\n        }\n    }\n}\n\n/**\n * Base class for devices that have multiple profiles.\n */\nexport abstract class MultiProfileDevice extends Device {\n    /**\n     * The current device profile.\n     */\n    readonly profile: string;\n\n    /**\n     * @param info - Information about this device.\n     * @param rpcHandler - Used to make remote procedure calls.\n     */\n    constructor(\n        info: DeviceInfo,\n        readonly rpcHandler: RpcHandler,\n    ) {\n        super(info, rpcHandler);\n\n        this.profile = info.profile ?? '';\n    }\n}\n","import { Device } from '../devices';\nimport { RpcParams } from '../rpc';\n\nexport abstract class Service {\n    /**\n     * @param name - The name of this service.\n     * @param device - The device that owns this service.\n     */\n    constructor(\n        readonly name: string,\n        readonly device: Device,\n    ) {}\n\n    /**\n     * Shorthand method for making an RPC.\n     */\n    protected rpc<T>(method: string, params?: RpcParams): PromiseLike<T> {\n        return this.device.rpcHandler.request<T>(`${this.name}.${method}`, params);\n    }\n}\n","import { Device } from '../devices';\nimport { Service } from './base';\n\nexport interface HttpHeaders {\n    [k: string]: string;\n}\n\nexport interface HttpResponse {\n    code: number;\n    message: string;\n    headers: HttpHeaders;\n    body?: string;\n    body_b64?: string;\n}\n\n/**\n * The HTTP service enables sending HTTP requests from Shelly devices.\n */\nexport class HttpService extends Service {\n    constructor(device: Device) {\n        super('HTTP', device);\n    }\n\n    /**\n     * Sends an HTTP GET request.\n     * @param url - The URL to send the request to.\n     * @param timeout - Timeout, in seconds.\n     * @param ssl_ca - The certificate authority to use for HTTPS requests.\n     */\n    get(url: string, timeout?: number, ssl_ca?: '*' | 'user_ca.pem' | '' | null): PromiseLike<HttpResponse> {\n        return this.rpc<HttpResponse>('GET', {\n            url,\n            timeout,\n            ssl_ca,\n        });\n    }\n\n    /**\n     * Sends an HTTP POST request.\n     * Either `body` or `body_b64` must be specified.\n     * @param url - The URL to send the request to.\n     * @param body - The request body.\n     * @param body_b64 - The request body (base64 encoded).\n     * @param content_type - The type of content being sent.\n     * @param timeout - Timeout, in seconds.\n     * @param ssl_ca - The certificate authority to use for HTTPS requests.\n     */\n    post(\n        url: string,\n        body?: string,\n        body_b64?: string,\n        content_type = 'application/json',\n        timeout?: number,\n        ssl_ca?: '*' | 'user_ca.pem' | '' | null,\n    ): PromiseLike<HttpResponse> {\n        return this.rpc<HttpResponse>('POST', {\n            url,\n            body,\n            body_b64,\n            content_type,\n            timeout,\n            ssl_ca,\n        });\n    }\n\n    /**\n     * Sends an HTTP request.\n     * Either `body` or `body_b64` must be specified for POST and PUT requests.\n     * @param method - The HTTP method to use.\n     * @param url - The URL to send the request to.\n     * @param body - The request body.\n     * @param body_b64 - The request body (base64 encoded).\n     * @param headers - User supplied request headers.\n     * @param timeout - Timeout, in seconds.\n     * @param ssl_ca - The certificate authority to use for HTTPS requests.\n     */\n    request(\n        method: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'DELETE',\n        url: string,\n        body?: string,\n        body_b64?: string,\n        headers?: HttpHeaders,\n        timeout?: number,\n        ssl_ca?: '*' | 'user_ca.pem' | '' | null,\n    ): PromiseLike<HttpResponse> {\n        return this.rpc<HttpResponse>('Request', {\n            method,\n            url,\n            body,\n            body_b64,\n            headers,\n            timeout,\n            ssl_ca,\n        });\n    }\n}\n","import { Device } from '../devices';\nimport { Service } from './base';\n\nexport type KvsValue = string | number | boolean | { [x: string]: KvsValue } | Array<KvsValue>;\n\nexport interface KvsSetResponse {\n    etag: string;\n    rev: number;\n}\n\nexport interface KvsGetResponse {\n    etag: string;\n    value: KvsValue;\n}\n\nexport interface KvsGetManyResponse {\n    items: {\n        [key: string]: {\n            etag: string;\n            value: KvsValue;\n        };\n    };\n}\n\nexport interface KvsListResponse {\n    keys: {\n        [key: string]: {\n            etag: string;\n        };\n    };\n    rev: number;\n}\n\nexport interface KvsDeleteResponse {\n    rev: number;\n}\n\n/**\n * The KVS (Key-Value Store) service provides a basic persistent storage of key-value pairs.\n */\nexport class KvsService extends Service {\n    constructor(device: Device) {\n        super('KVS', device);\n    }\n\n    /**\n     * Adds a new key-value pair to the store or updates an existing one.\n     * @param key - The key to add or update.\n     * @param value - Value for the key.\n     * @param etag - Generated hash uniquely identifying the key-value pair.\n     */\n    set(key: string, value: KvsValue, etag?: string): PromiseLike<KvsSetResponse> {\n        return this.rpc<KvsSetResponse>('Set', {\n            key,\n            value,\n            etag,\n        });\n    }\n\n    /**\n     * Returns the value stored and etag for a given key.\n     * @param key - The key to lookup.\n     */\n    get(key: string): PromiseLike<KvsGetResponse> {\n        return this.rpc<KvsGetResponse>('Get', {\n            key,\n        });\n    }\n\n    /**\n     * Returns the full information stored for items in the store based on an optional key matching parameter.\n     * @param match - Pattern against which keys are matched.\n     */\n    getMany(match?: string): PromiseLike<KvsGetManyResponse> {\n        return this.rpc<KvsGetManyResponse>('GetMany', {\n            match,\n        });\n    }\n\n    /**\n     * Returns a list of existing keys and etags based on an optional match parameter.\n     * @param match - Pattern against which keys are matched.\n     */\n    list(match?: string): PromiseLike<KvsListResponse> {\n        return this.rpc<KvsListResponse>('List', {\n            match,\n        });\n    }\n\n    /**\n     * Deletes an existing key from the store.\n     * @param key - The key to delete.\n     * @param etag - Generated hash uniquely identifying the key-value pair.\n     */\n    delete(key: string, etag?: string): PromiseLike<KvsDeleteResponse> {\n        return this.rpc<KvsDeleteResponse>('Delete', {\n            key,\n            etag,\n        });\n    }\n}\n","import { Device } from '../devices';\nimport { Service } from './base';\n\nexport interface ScheduleRpcCall {\n    method: string;\n    params?: Record<string, unknown>;\n}\n\nexport interface ScheduleJob {\n    id?: number;\n    enable: boolean;\n    timespec: string;\n    calls: ScheduleRpcCall[];\n}\n\nexport interface ScheduleListResponse {\n    jobs: ScheduleJob[];\n    rev: number;\n}\n\nexport interface ScheduleCreateResponse {\n    id: number;\n    rev: number;\n}\n\nexport interface ScheduleUpdateResponse {\n    rev: number;\n}\n\nexport interface ScheduleDeleteResponse {\n    rev: number;\n}\n\n/**\n * The Schedule service allows execution of RPC methods at fixes times or intervals.\n */\nexport class ScheduleService extends Service {\n    constructor(device: Device) {\n        super('Schedule', device);\n    }\n\n    /**\n     * Lists all existing scheduled jobs.\n     */\n    list(): PromiseLike<ScheduleListResponse> {\n        return this.rpc<ScheduleListResponse>('List');\n    }\n\n    /**\n     * Creates a new scheduled job.\n     * @param job - The job to add.\n     */\n    create(job: ScheduleJob): PromiseLike<ScheduleCreateResponse> {\n        return this.rpc<ScheduleCreateResponse>('Create', { ...job });\n    }\n\n    /**\n     * Updates an existing scheduled job.\n     * @param job - The job to update.\n     */\n    update(job: Partial<ScheduleJob>): PromiseLike<ScheduleUpdateResponse> {\n        return this.rpc<ScheduleUpdateResponse>('Update', { ...job });\n    }\n\n    /**\n     * Deletes a scheduled job.\n     * @param id - ID of the job to delete.\n     */\n    delete(id: number): PromiseLike<ScheduleDeleteResponse> {\n        return this.rpc<ScheduleDeleteResponse>('Delete', {\n            id,\n        });\n    }\n\n    /**\n     * Deletes all existing scheduled jobs.\n     */\n    deleteAll(): PromiseLike<ScheduleDeleteResponse> {\n        return this.rpc<ScheduleDeleteResponse>('DeleteAll');\n    }\n}\n","import crypto from 'crypto';\n\nimport {\n    BluetoothLowEnergyAttributes,\n    BluetoothLowEnergyConfig,\n    CloudAttributes,\n    CloudConfig,\n    CoverAttributes,\n    CoverConfig,\n    DevicePowerAttributes,\n    DevicePowerConfig,\n    EthernetAttributes,\n    EthernetConfig,\n    HumidityAttributes,\n    HumidityConfig,\n    InputAttributes,\n    InputConfig,\n    LightAttributes,\n    LightConfig,\n    MqttAttributes,\n    MqttConfig,\n    OutboundWebSocketAttributes,\n    OutboundWebSocketConfig,\n    SwitchAttributes,\n    SwitchConfig,\n    SystemAttributes,\n    SystemConfig,\n    TemperatureAttributes,\n    TemperatureConfig,\n    UiAttributes,\n    UiConfig,\n    WiFiAttributes,\n    WiFiConfig,\n} from '../components';\nimport { Device } from '../devices';\nimport { Service } from './base';\n\nexport interface ShellyStatus {\n    sys?: SystemAttributes;\n    wifi?: WiFiAttributes;\n    eth?: EthernetAttributes;\n    ble?: BluetoothLowEnergyAttributes;\n    cloud?: CloudAttributes;\n    mqtt?: MqttAttributes;\n    ws?: OutboundWebSocketAttributes;\n    'cover:0'?: CoverAttributes;\n    'input:0'?: InputAttributes;\n    'input:1'?: InputAttributes;\n    'input:2'?: InputAttributes;\n    'input:3'?: InputAttributes;\n    'switch:0'?: SwitchAttributes;\n    'switch:1'?: SwitchAttributes;\n    'switch:2'?: SwitchAttributes;\n    'switch:3'?: SwitchAttributes;\n    'light:0'?: LightAttributes;\n    'devicepower:0'?: DevicePowerAttributes;\n    'humidity:0'?: HumidityAttributes;\n    'temperature:0'?: TemperatureAttributes;\n    ui?: UiAttributes;\n}\n\nexport interface ShellyConfig {\n    sys?: SystemConfig;\n    wifi?: WiFiConfig;\n    eth?: EthernetConfig;\n    ble?: BluetoothLowEnergyConfig;\n    cloud?: CloudConfig;\n    mqtt?: MqttConfig;\n    ws?: OutboundWebSocketConfig;\n    'cover:0'?: CoverConfig;\n    'input:0'?: InputConfig;\n    'input:1'?: InputConfig;\n    'input:2'?: InputConfig;\n    'input:3'?: InputConfig;\n    'switch:0'?: SwitchConfig;\n    'switch:1'?: SwitchConfig;\n    'switch:2'?: SwitchConfig;\n    'switch:3'?: SwitchConfig;\n    'light:0'?: LightConfig;\n    'devicepower:0'?: DevicePowerConfig;\n    'humidity:0'?: HumidityConfig;\n    'temperature:0'?: TemperatureConfig;\n    ui?: UiConfig;\n}\n\nexport interface ShellyMethods {\n    methods: string[];\n}\n\nexport interface ShellyDeviceInfo {\n    id: string;\n    mac: string;\n    model: string;\n    gen: number;\n    fw_id: string;\n    ver: string;\n    app: string;\n    profile?: string;\n    auth_en: boolean;\n    auth_domain: string | null;\n    discoverable: boolean;\n    key?: string;\n    batch?: string;\n    fw_sbits?: string;\n}\n\nexport interface ShellyProfiles {\n    profiles: Array<{\n        [name: string]: {\n            components: Array<{\n                type: string;\n                count: number;\n            }>;\n        };\n    }>;\n}\n\nexport interface ShellySetProfileResponse {\n    profile_was: string;\n}\n\nexport interface ShellyTimezones {\n    timezones: string[];\n}\n\nexport interface ShellyLocation {\n    tz: string | null;\n    lat: number | null;\n    lon: number | null;\n}\n\nexport interface ShellyFirmwareUpdate {\n    stable?: {\n        version: string;\n        build_id: string;\n    };\n    beta?: {\n        version: string;\n        build_id: string;\n    };\n}\n\nexport interface ShellyPutUserCaResponse {\n    len: number;\n}\n\n/**\n * The common Shelly service that all devices have.\n */\nexport class ShellyService extends Service {\n    constructor(device: Device) {\n        super('Shelly', device);\n    }\n\n    /**\n     * Retrieves the status of all of the components of the device.\n     */\n    getStatus(): PromiseLike<ShellyStatus> {\n        return this.rpc<ShellyStatus>('GetStatus');\n    }\n\n    /**\n     * Retrieves the configuration of all the components of the device.\n     */\n    getConfig(): PromiseLike<ShellyConfig> {\n        return this.rpc<ShellyConfig>('GetConfig');\n    }\n\n    /**\n     * Lists all available RPC methods.\n     */\n    listMethods(): PromiseLike<ShellyMethods> {\n        return this.rpc<ShellyMethods>('ListMethods');\n    }\n\n    /**\n     * Retrieves information about the device.\n     */\n    getDeviceInfo(ident?: boolean): PromiseLike<ShellyDeviceInfo> {\n        return this.rpc<ShellyDeviceInfo>('GetDeviceInfo', {\n            ident,\n        });\n    }\n\n    /**\n     * Retrieves a list of all available profiles and the type/count of functional components exposed for each profile.\n     */\n    listProfiles(): PromiseLike<ShellyProfiles> {\n        return this.rpc<ShellyProfiles>('ListProfiles');\n    }\n\n    /**\n     * Sets the device profile.\n     * @param name - Name of the device profile.\n     */\n    setProfile(name: string): PromiseLike<ShellySetProfileResponse> {\n        return this.rpc<ShellySetProfileResponse>('SetProfile', {\n            name,\n        });\n    }\n\n    /**\n     * Retrieves a list of all timezones.\n     */\n    listTimezones(): PromiseLike<ShellyTimezones> {\n        return this.rpc<ShellyTimezones>('ListTimezones');\n    }\n\n    /**\n     * Retrieves the location of the device.\n     */\n    detectLocation(): PromiseLike<ShellyLocation> {\n        return this.rpc<ShellyLocation>('DetectLocation');\n    }\n\n    /**\n     * Checks for a new firmware version.\n     */\n    checkForUpdate(): PromiseLike<ShellyFirmwareUpdate> {\n        return this.rpc<ShellyFirmwareUpdate>('CheckForUpdate');\n    }\n\n    /**\n     * Requests an update of the device firmware.\n     * Either `stage` or `url` must be specified.\n     * @param stage - The type of the new version.\n     * @param url - URL of the update.\n     */\n    update(stage?: 'stable' | 'beta', url?: string): PromiseLike<null> {\n        return this.rpc<null>('Update', {\n            stage,\n            url,\n        });\n    }\n\n    /**\n     * Requests a factory reset of the device.\n     */\n    factoryReset(): PromiseLike<null> {\n        return this.rpc<null>('FactoryReset');\n    }\n\n    /**\n     * Requests that the device's WiFi configuration is reset.\n     */\n    resetWiFiConfig(): PromiseLike<null> {\n        return this.rpc<null>('ResetWiFiConfig');\n    }\n\n    /**\n     * Requests a reboot of the device.\n     * @param delay_ms - A delay until the device reboots, in milliseconds. The\n     * minimum delay is 500 ms.\n     */\n    reboot(delay_ms?: number): PromiseLike<null> {\n        return this.rpc<null>('Reboot', {\n            delay_ms,\n        });\n    }\n\n    /**\n     * Sets the authentication details (password) for the device.\n     * @param password - The new password. Set to `null` to disable.\n     */\n    setAuth(password: string | null): PromiseLike<null> {\n        const user = 'admin';\n        const hash =\n            password === null\n                ? null\n                : crypto.createHash('sha256').update(`${user}:${this.device.id}:${password}`).digest('hex');\n\n        return this.rpc<null>('SetAuth', {\n            user,\n            realm: this.device.id,\n            ha1: hash,\n        });\n    }\n\n    /**\n     * Uploads a custom certificate authority (CA) PEM bundle.\n     * @param data - Contents of the PEM file (`null` to remove the existing file).\n     * @param append - Whether more data will be appended in a subsequent call.\n     */\n    putUserCa(data: string | null, append: boolean): PromiseLike<ShellyPutUserCaResponse> {\n        return this.rpc<ShellyPutUserCaResponse>('PutUserCA', {\n            data,\n            append,\n        });\n    }\n}\n","import { Device } from '../devices';\nimport { Service } from './base';\n\nexport interface WebhookEventType {\n    attrs?: Array<{\n        name: string;\n        type: 'boolean' | 'number' | 'string';\n        desc: string;\n    }>;\n}\n\nexport interface WebhookSupportedResponse {\n    hook_types?: string[];\n    types?: { [name: string]: WebhookEventType };\n}\n\nexport interface Webhook {\n    id?: number;\n    cid: number;\n    enable: boolean;\n    event: string;\n    name: string | null;\n    ssl_ca?: '*' | 'user_ca.pem' | '' | null;\n    urls: string[];\n    active_between?: string[] | null;\n    condition?: string | null;\n}\n\nexport interface WebhookListResponse {\n    hooks: Webhook[];\n    rev: number;\n}\n\nexport interface WebhookCreateResponse {\n    id: number;\n    rev: number;\n}\n\nexport interface WebhookUpdateResponse {\n    rev: number;\n}\n\nexport interface WebhookDeleteResponse {\n    rev: number;\n}\n\n/**\n * The Webhook service allows Shelly devices to send HTTP requests triggered by events.\n */\nexport class WebhookService extends Service {\n    constructor(device: Device) {\n        super('Webhook', device);\n    }\n\n    /**\n     * Lists all supported event types.\n     */\n    listSupported(): PromiseLike<WebhookSupportedResponse> {\n        return this.rpc<WebhookSupportedResponse>('ListSupported');\n    }\n\n    /**\n     * Lists all existing webhooks.\n     */\n    list(): PromiseLike<WebhookListResponse> {\n        return this.rpc<WebhookListResponse>('List');\n    }\n\n    /**\n     * Creates a new webhook.\n     * @param hook - The webhook to add.\n     */\n    create(hook: Partial<Webhook>): PromiseLike<WebhookCreateResponse> {\n        return this.rpc<WebhookCreateResponse>('Create', { ...hook });\n    }\n\n    /**\n     * Updates an existing webhook.\n     * @param hook - The webhook to update.\n     */\n    update(hook: Partial<Webhook>): PromiseLike<WebhookUpdateResponse> {\n        return this.rpc<WebhookUpdateResponse>('Update', { ...hook });\n    }\n\n    /**\n     * Deletes a webhook.\n     * @param id - ID of the webhook to delete.\n     */\n    delete(id: number): PromiseLike<WebhookDeleteResponse> {\n        return this.rpc<WebhookDeleteResponse>('Delete', {\n            id,\n        });\n    }\n\n    /**\n     * Deletes all existing webhooks.\n     */\n    deleteAll(): PromiseLike<WebhookDeleteResponse> {\n        return this.rpc<WebhookDeleteResponse>('DeleteAll');\n    }\n}\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPlus1 extends Device {\n    static readonly model: string = 'SNSW-001X16EU';\n    static readonly modelName: string = 'Shelly Plus 1';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPlus1);\n\nexport class ShellyPlus1Ul extends ShellyPlus1 {\n    static readonly model: string = 'SNSW-001X15UL';\n}\n\nDevice.registerClass(ShellyPlus1Ul);\n\nexport class ShellyPlus1Mini extends ShellyPlus1 {\n    static readonly model: string = 'SNSW-001X8EU';\n    static readonly modelName: string = 'Shelly Plus 1 Mini';\n}\n\nDevice.registerClass(ShellyPlus1Mini);\n\nexport class ShellyPlus1MiniV3 extends ShellyPlus1 {\n    static readonly model: string = 'S3SW-001X8EU';\n    static readonly modelName: string = 'Shelly Plus 1 Mini';\n}\n\nDevice.registerClass(ShellyPlus1MiniV3);\n\nexport class ShellyPlus1V3 extends ShellyPlus1 {\n    static readonly model: string = 'S3SW-001X16EU';\n}\n\nDevice.registerClass(ShellyPlus1V3);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Mqtt, OutboundWebSocket, Script, WiFi, Pm1 } from '../components';\n\nexport class ShellyPlusPmMini extends Device {\n    static readonly model: string = 'SNPM-001PCEU16';\n    static readonly modelName: string = 'Shelly Plus PM Mini';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly script = new Script(this);\n\n    @component\n    readonly pm1 = new Pm1(this);\n}\n\nDevice.registerClass(ShellyPlusPmMini);\n\nexport class ShellyPlusPmMiniV3 extends ShellyPlusPmMini {\n    static readonly model: string = 'S3PM-001PCEU16';\n}\n\nDevice.registerClass(ShellyPlusPmMiniV3);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPlus1Pm extends Device {\n    static readonly model: string = 'SNSW-001P16EU';\n    static readonly modelName: string = 'Shelly Plus 1 PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPlus1Pm);\n\nexport class ShellyPlus1PmUl extends ShellyPlus1Pm {\n    static readonly model: string = 'SNSW-001P15UL';\n}\n\nDevice.registerClass(ShellyPlus1PmUl);\n\nexport class ShellyPlus1PmMini extends ShellyPlus1Pm {\n    static readonly model: string = 'SNSW-001P8EU';\n    static readonly modelName: string = 'Shelly Plus 1 PM Mini';\n}\n\nDevice.registerClass(ShellyPlus1PmMini);\n\nexport class ShellyPlus1PmMiniV3 extends ShellyPlus1Pm {\n    static readonly model: string = 'S3SW-001P8EU';\n    static readonly modelName: string = 'Shelly Plus 1 PM Mini';\n}\n\nDevice.registerClass(ShellyPlus1PmMiniV3);\n\nexport class ShellyPlus1PmV3 extends ShellyPlus1Pm {\n    static readonly model: string = 'S3SW-001P16EU';\n}\n\nDevice.registerClass(ShellyPlus1PmV3);\n","import { component, Device, MultiProfileDevice } from './base';\nimport { BluetoothLowEnergy, Cloud, Cover, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPlus2Pm extends MultiProfileDevice {\n    static readonly model: string = 'SNSW-002P16EU';\n    static readonly modelName: string = 'Shelly Plus 2 PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly cover0 = new Cover(this, 0);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly switch1 = new Switch(this, 1);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPlus2Pm);\n\nexport class ShellyPlus2PmRev1 extends ShellyPlus2Pm {\n    static readonly model: string = 'SNSW-102P16EU';\n}\n\nDevice.registerClass(ShellyPlus2PmRev1);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    DevicePower,\n    HtUi,\n    Humidity,\n    Mqtt,\n    OutboundWebSocket,\n    Temperature,\n    WiFi,\n} from '../components';\n\nexport class ShellyPlusHt extends Device {\n    static readonly model: string = 'SNSN-0013A';\n    static readonly modelName: string = 'Shelly Plus H&T';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly temperature0 = new Temperature(this, 0);\n\n    @component\n    readonly humidity0 = new Humidity(this, 0);\n\n    @component\n    readonly devicePower0 = new DevicePower(this, 0);\n\n    @component\n    readonly htUi = new HtUi(this);\n}\n\nDevice.registerClass(ShellyPlusHt);\n\nexport class ShellyPlusHtV3 extends ShellyPlusHt {\n    static readonly model: string = 'S3SN-0U12A';\n}\n\nDevice.registerClass(ShellyPlusHtV3);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Input, Mqtt, OutboundWebSocket, Script, WiFi } from '../components';\n\nexport class ShellyPlusI4 extends Device {\n    static readonly model: string = 'SNSN-0024X';\n    static readonly modelName: string = 'Shelly Plus I4';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly input2 = new Input(this, 2);\n\n    @component\n    readonly input3 = new Input(this, 3);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPlusI4);\n\nexport class ShellyPlusI4V3 extends ShellyPlusI4 {\n    static readonly model: string = 'S3SN-0024X';\n}\n\nDevice.registerClass(ShellyPlusI4V3);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPlusPlugUs extends Device {\n    static readonly model: string = 'SNPL-00116US';\n    static readonly modelName: string = 'Shelly Plus Plug US';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPlusPlugUs);\n\nexport class ShellyPlusPlugEu extends ShellyPlusPlugUs {\n    static readonly model: string = 'SNPL-00112EU';\n    static readonly modelName: string = 'Shelly Plus Plug EU';\n}\n\nDevice.registerClass(ShellyPlusPlugEu);\n\nexport class ShellyPlusPlugUk extends ShellyPlusPlugUs {\n    static readonly model: string = 'SNPL-00112UK';\n    static readonly modelName: string = 'Shelly Plus Plug UK';\n}\n\nDevice.registerClass(ShellyPlusPlugUk);\n\nexport class ShellyPlusPlugIt extends ShellyPlusPlugUs {\n    static readonly model: string = 'SNPL-00110IT';\n    static readonly modelName: string = 'Shelly Plus Plug IT';\n}\n\nDevice.registerClass(ShellyPlusPlugIt);\n\nexport class ShellyPlugSG3Eu extends ShellyPlusPlugUs {\n    static readonly model: string = 'S3PL-00112EU';\n    static readonly modelName: string = 'Shelly Plug S Gen3';\n}\n\nDevice.registerClass(ShellyPlugSG3Eu);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPro1 extends Device {\n    static readonly model: string = 'SPSW-001XE16EU';\n    static readonly modelName: string = 'Shelly Pro 1';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPro1);\n\nexport class ShellyPro1Rev1 extends ShellyPro1 {\n    static readonly model: string = 'SPSW-101XE16EU';\n}\n\nDevice.registerClass(ShellyPro1Rev1);\n\nexport class ShellyPro1Rev2 extends ShellyPro1Rev1 {\n    static readonly model: string = 'SPSW-201XE16EU';\n}\n\nDevice.registerClass(ShellyPro1Rev2);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPro1Pm extends Device {\n    static readonly model: string = 'SPSW-001PE16EU';\n    static readonly modelName: string = 'Shelly Pro 1 PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPro1Pm);\n\nexport class ShellyPro1PmRev1 extends ShellyPro1Pm {\n    static readonly model: string = 'SPSW-101PE16EU';\n}\n\nDevice.registerClass(ShellyPro1PmRev1);\n\nexport class ShellyPro1PmRev2 extends ShellyPro1PmRev1 {\n    static readonly model: string = 'SPSW-201PE16EU';\n}\n\nDevice.registerClass(ShellyPro1PmRev2);\n","import { component, Device } from './base';\nimport { BluetoothLowEnergy, Cloud, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPro2 extends Device {\n    static readonly model: string = 'SPSW-002XE16EU';\n    static readonly modelName: string = 'Shelly Pro 2';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly switch1 = new Switch(this, 1);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPro2);\n\nexport class ShellyPro2Rev1 extends ShellyPro2 {\n    static readonly model: string = 'SPSW-102XE16EU';\n}\n\nDevice.registerClass(ShellyPro2Rev1);\n\nexport class ShellyPro2Rev2 extends ShellyPro2Rev1 {\n    static readonly model: string = 'SPSW-202XE16EU';\n}\n\nDevice.registerClass(ShellyPro2Rev2);\n","import { component, Device, MultiProfileDevice } from './base';\nimport { BluetoothLowEnergy, Cloud, Cover, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyPro2Pm extends MultiProfileDevice {\n    static readonly model: string = 'SPSW-002PE16EU';\n    static readonly modelName: string = 'Shelly Pro 2 PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly cover0 = new Cover(this, 0);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly switch1 = new Switch(this, 1);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPro2Pm);\n\nexport class ShellyPro2PmRev1 extends ShellyPro2Pm {\n    static readonly model: string = 'SPSW-102PE16EU';\n}\n\nDevice.registerClass(ShellyPro2PmRev1);\n\nexport class ShellyPro2PmRev2 extends ShellyPro2PmRev1 {\n    static readonly model: string = 'SPSW-202PE16EU';\n}\n\nDevice.registerClass(ShellyPro2PmRev2);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    Ethernet,\n    Input,\n    Mqtt,\n    OutboundWebSocket,\n    Script,\n    Switch,\n    WiFi,\n} from '../components';\n\nexport class ShellyPro3 extends Device {\n    static readonly model: string = 'SPSW-003XE16EU';\n    static readonly modelName: string = 'Shelly Pro 3';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly ethernet = new Ethernet(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly input2 = new Input(this, 2);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly switch1 = new Switch(this, 1);\n\n    @component\n    readonly switch2 = new Switch(this, 2);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyPro3);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    Ethernet,\n    Input,\n    Mqtt,\n    OutboundWebSocket,\n    Script,\n    Switch,\n    Ui,\n    WiFi,\n} from '../components';\n\nexport class ShellyPro4Pm extends Device {\n    static readonly model: string = 'SPSW-004PE16EU';\n    static readonly modelName: string = 'Shelly Pro 4 PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly ethernet = new Ethernet(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly input2 = new Input(this, 2);\n\n    @component\n    readonly input3 = new Input(this, 3);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly switch1 = new Switch(this, 1);\n\n    @component\n    readonly switch2 = new Switch(this, 2);\n\n    @component\n    readonly switch3 = new Switch(this, 3);\n\n    @component\n    readonly script = new Script(this);\n\n    @component\n    readonly ui = new Ui(this);\n}\n\nDevice.registerClass(ShellyPro4Pm);\n\nexport class ShellyPro4PmV2 extends ShellyPro4Pm {\n    static readonly model: string = 'SPSW-104PE16EU';\n}\n\nDevice.registerClass(ShellyPro4PmV2);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    Ethernet,\n    Input,\n    Mqtt,\n    OutboundWebSocket,\n    Script,\n    Light,\n    Ui,\n    WiFi,\n} from '../components';\n\nexport class ShellyProDimmer1Pm extends Device {\n    static readonly model: string = 'SPDM-001PE01EU';\n    static readonly modelName: string = 'Shelly Pro Dimmer 1PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly ethernet = new Ethernet(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly light0 = new Light(this, 0);\n\n    @component\n    readonly script = new Script(this);\n\n    @component\n    readonly ui = new Ui(this);\n}\n\nDevice.registerClass(ShellyProDimmer1Pm);\n\nexport class ShellyProDimmer1Pm2 extends ShellyProDimmer1Pm {\n    static readonly model: string = 'SPCC-001PE10EU';\n    static readonly modelName: string = 'Shelly Pro Dimmer 0/1-10V PM';\n}\n\nDevice.registerClass(ShellyProDimmer1Pm2);\n\nexport class ShellyDimmer extends ShellyProDimmer1Pm {\n    static readonly model: string = 'S3DM-0A101WWL';\n    static readonly modelName: string = 'Shelly Dimmer';\n}\n\nDevice.registerClass(ShellyDimmer);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    Ethernet,\n    Input,\n    Mqtt,\n    OutboundWebSocket,\n    Script,\n    Light,\n    Ui,\n    WiFi,\n} from '../components';\n\nexport class ShellyProDimmer2Pm extends Device {\n    static readonly model: string = 'SPDM-002PE01EU';\n    static readonly modelName: string = 'Shelly Pro Dimmer 2PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly ethernet = new Ethernet(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly input2 = new Input(this, 2);\n\n    @component\n    readonly input3 = new Input(this, 3);\n\n    @component\n    readonly light0 = new Light(this, 0);\n\n    @component\n    readonly light1 = new Light(this, 1);\n\n    @component\n    readonly script = new Script(this);\n\n    @component\n    readonly ui = new Ui(this);\n}\n\nDevice.registerClass(ShellyProDimmer2Pm);\n","import { component, Device, MultiProfileDevice } from './base';\nimport { BluetoothLowEnergy, Cloud, Cover, Input, Mqtt, OutboundWebSocket, Script, WiFi } from '../components';\n\nexport class ShellyProDualCoverPm extends MultiProfileDevice {\n    static readonly model: string = 'SPSH-002PE16EU';\n    static readonly modelName: string = 'Shelly Pro Dual Cover PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly cover0 = new Cover(this, 0);\n\n    @component\n    readonly cover1 = new Cover(this, 1);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly input2 = new Input(this, 2);\n\n    @component\n    readonly input3 = new Input(this, 3);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyProDualCoverPm);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    Ethernet,\n    Input,\n    Mqtt,\n    OutboundWebSocket,\n    Script,\n    Light,\n    Ui,\n    WiFi,\n} from '../components';\n\nexport class ShellyPlusPMDimmer extends Device {\n    static readonly model: string = 'S3DM-0010WW';\n    static readonly modelName: string = 'Shelly Dimmer 0/1-10V PM';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly ethernet = new Ethernet(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly light0 = new Light(this, 0);\n\n    @component\n    readonly script = new Script(this);\n\n    @component\n    readonly ui = new Ui(this);\n}\n\nDevice.registerClass(ShellyPlusPMDimmer);\n","import { component, Device } from './base';\nimport {\n    BluetoothLowEnergy,\n    Cloud,\n    Ethernet,\n    Input,\n    Mqtt,\n    OutboundWebSocket,\n    Script,\n    Light,\n    Ui,\n    WiFi,\n} from '../components';\n\nexport class ShellyPlusDimmer extends Device {\n    static readonly model: string = 'SNDM-00100WW';\n    static readonly modelName: string = 'Shelly Plus Dimmer 0-10V';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly ethernet = new Ethernet(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly light0 = new Light(this, 0);\n\n    @component\n    readonly script = new Script(this);\n\n    @component\n    readonly ui = new Ui(this);\n}\n\nDevice.registerClass(ShellyPlusDimmer);\n","import { component, Device, MultiProfileDevice } from './base';\nimport { BluetoothLowEnergy, Cloud, Cover, Input, Mqtt, OutboundWebSocket, Script, Switch, WiFi } from '../components';\n\nexport class ShellyGen32Pm extends MultiProfileDevice {\n    static readonly model: string = 'S3SW-002P16EU';\n    static readonly modelName: string = 'Shelly 2PM Gen3';\n\n    @component\n    readonly wifi = new WiFi(this);\n\n    @component\n    readonly bluetoothLowEnergy = new BluetoothLowEnergy(this);\n\n    @component\n    readonly cloud = new Cloud(this);\n\n    @component\n    readonly mqtt = new Mqtt(this);\n\n    @component\n    readonly outboundWebSocket = new OutboundWebSocket(this);\n\n    @component\n    readonly cover0 = new Cover(this, 0);\n\n    @component\n    readonly input0 = new Input(this, 0);\n\n    @component\n    readonly input1 = new Input(this, 1);\n\n    @component\n    readonly switch0 = new Switch(this, 0);\n\n    @component\n    readonly switch1 = new Switch(this, 1);\n\n    @component\n    readonly script = new Script(this);\n}\n\nDevice.registerClass(ShellyGen32Pm);\n","import { DeviceId } from '../devices';\nimport EventEmitter from 'eventemitter3';\n\n/**\n * Describes a discovered Shelly device.\n */\nexport interface DeviceIdentifiers {\n    /**\n     * Device ID.\n     */\n    deviceId: DeviceId;\n    /**\n     * The IP address or hostname of the device, if available.\n     */\n    hostname?: string;\n}\n\ntype DeviceDiscovererEvents = {\n    /**\n     * The 'discover' event is emitted when a device is discovered.\n     */\n    discover: (identifiers: DeviceIdentifiers) => void;\n    /**\n     * The 'error' event is emitted if an asynchronous error occurs.\n     */\n    error: (error: Error) => void;\n};\n\n/**\n * Base class for device discoverers.\n */\nexport abstract class DeviceDiscoverer extends EventEmitter<DeviceDiscovererEvents> {\n    /**\n     * Handles a discovered device.\n     * Subclasses should call this method when a device has been discovered.\n     */\n    protected handleDiscoveredDevice(identifiers: DeviceIdentifiers) {\n        // emit an event\n        this.emit('discover', identifiers);\n    }\n}\n","import mDNS from 'multicast-dns';\nimport os from 'os';\n\nimport { DeviceDiscoverer } from './base';\nimport { DeviceId } from '../devices';\n\n/**\n * Defines options that are passed along to the multicast-dns library.\n */\nexport interface MdnsOptions {\n    /**\n     * The network interface to use. If none is specified, all available\n     * interfaces will be used.\n     */\n    interface?: string;\n}\n\n/**\n * Default multicast-dns options.\n */\nconst DEFAULT_MDNS_OPTIONS: Readonly<MdnsOptions> = {\n    interface: undefined,\n};\n\n/**\n * The service name that Shelly devices use to advertise themselves.\n */\nconst SERVICE_NAME = '_shelly._tcp.local';\n\n/**\n * A service that can discover Shelly devices using mDNS.\n */\nexport class MdnsDeviceDiscoverer extends DeviceDiscoverer {\n    /**\n     * A reference to the multicast-dns library.\n     */\n    protected mdns: mDNS.MulticastDNS | null = null;\n\n    /**\n     * Options for the multicast-dns library.\n     */\n    protected mdnsOptions: MdnsOptions;\n\n    /**\n     * @param mdnsOptions - Options for the multicast-dns library.\n     */\n    constructor(mdnsOptions?: MdnsOptions) {\n        super();\n\n        // store the multicast-dns options, with default values\n        this.mdnsOptions = { ...DEFAULT_MDNS_OPTIONS, ...(mdnsOptions || {}) };\n    }\n\n    /**\n     * Makes this service start listening for new Shelly devices.\n     */\n    async start() {\n        if (this.mdns !== null) {\n            return;\n        }\n\n        this.mdns = mDNS({\n            interface: this.getNetworkInterface(this.mdnsOptions.interface),\n        });\n\n        this.mdns\n            .on('response', (response) => this.handleResponse(response))\n            .on('error', (error) => this.emit('error', error))\n            .on('warning', (error) => this.emit('error', error));\n\n        await this.waitUntilReady();\n        await this.sendQuery();\n    }\n\n    /**\n     * Validates the given network interface name or address.\n     * @param iface - An interface name or address.\n     * @returns If a valid interface name is given, the address for that interface\n     * is returned. If a valid address is given, that same address is returned.\n     * @throws Throws an error if the given name or address could not be found.\n     */\n    protected getNetworkInterface(iface: string | undefined): string | undefined {\n        if (!iface) {\n            // skip if no interface has been specified\n            return undefined;\n        }\n\n        // get all available interfaces\n        const ifaces = os.networkInterfaces();\n\n        // if an interface name has been given, return its address\n        const ifc = ifaces[iface];\n        if (ifc && ifc.length > 0) {\n            // return the first address\n            return ifc[0].address;\n        }\n\n        // otherwise, go through each interface and see if there is one with the\n        // given address\n        for (const i in ifaces) {\n            const ifc = ifaces[i];\n            if (!ifc) {\n                continue;\n            }\n\n            for (const ii of ifc) {\n                if (ii.address === iface) {\n                    // address found, so it's valid\n                    return ii.address;\n                }\n            }\n        }\n\n        // the given value doesn't match any available interface name or address\n        throw new Error(`Invalid network interface \"${iface}\"`);\n    }\n\n    /**\n     * Returns a promise that will resolve once the mDNS socket is ready.\n     */\n    protected waitUntilReady(): Promise<void> {\n        return new Promise((resolve) => {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            this.mdns!.once('ready', resolve);\n        });\n    }\n\n    /**\n     * Queries for Shelly devices.\n     */\n    protected sendQuery(): Promise<void> {\n        return new Promise((resolve, reject) => {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            this.mdns!.query(SERVICE_NAME, 'PTR', (error: Error | null) => {\n                if (error !== null) {\n                    reject(error);\n                } else {\n                    resolve();\n                }\n            });\n        });\n    }\n\n    /**\n     * Makes this service stop searching for new Shelly devices.\n     */\n    async stop() {\n        if (this.mdns === null) {\n            return;\n        }\n\n        await this.destroy();\n\n        this.mdns = null;\n    }\n\n    /**\n     * Destroys the mDNS instance, closing the socket.\n     */\n    protected destroy(): Promise<void> {\n        return new Promise((resolve) => {\n            // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n            this.mdns!.destroy(resolve);\n        });\n    }\n\n    /**\n     * Handles mDNS response packets by parsing them and emitting `discover`\n     * events.\n     * @param response - The response packets.\n     */\n    protected handleResponse(response: mDNS.ResponsePacket) {\n        let deviceId: DeviceId | null = null;\n\n        // see if this response contains our requested service\n        for (const a of response.answers) {\n            if (a.type === 'PTR' && a.name === SERVICE_NAME && a.data) {\n                // this is the right service\n                // get the device ID\n                deviceId = a.data.split('.', 1)[0];\n                break;\n            }\n        }\n\n        // skip this response if it doesn't contain our requested service\n        if (!deviceId) {\n            return;\n        }\n\n        let ipAddress: string | null = null;\n\n        // find the device IP address among the answers\n        for (const a of response.answers.concat(response.additionals)) {\n            if (a.type === 'A') {\n                ipAddress = a.data;\n            }\n        }\n\n        if (ipAddress) {\n            this.handleDiscoveredDevice({\n                deviceId,\n                hostname: ipAddress,\n            });\n        }\n    }\n}\n","import EventEmitter from 'eventemitter3';\n\nexport type RpcParams = Record<string, unknown>;\n\n/**\n * Describes a status update notification.\n */\nexport interface RpcStatusNotification {\n    /**\n     * A UNIX timestamp.\n     */\n    ts: number;\n    /**\n     * One or more components and its updated attributes.\n     */\n    [component: string]: unknown;\n}\n\nexport interface RpcEvent {\n    /**\n     * The component that this event belongs to.\n     */\n    component: string;\n    /**\n     * The instance ID of the component, if applicable.\n     */\n    id?: number;\n    /**\n     * The name of the event.\n     */\n    event: string;\n    /**\n     * A UNIX timestamp.\n     */\n    ts: number;\n    /**\n     * Additional properties.\n     */\n    [p: string]: unknown;\n}\n\n/**\n * Describes an event notification.\n */\nexport interface RpcEventNotification {\n    /**\n     * A UNIX timestamp.\n     */\n    ts: number;\n    /**\n     * A list of one or more events that have occurred.\n     */\n    events: RpcEvent[];\n}\n\ntype RpcHandlerEvents = {\n    /**\n     * The 'connect' event is emitted when a connection has been established.\n     */\n    connect: () => void;\n    /**\n     * The 'disconnect' event is emitted when a connection has been closed or an attempt to connect fails.\n     */\n    disconnect: (code: number, reason: string, reconnectIn: number | null) => void;\n    /**\n     * The 'request' event is emitted when a new request is about to be sent.\n     */\n    request: (method: string, params?: RpcParams) => void;\n    /**\n     * The 'statusUpdate' event is emitted when an update notification is received,\n     * and contains updates to one or more device components.\n     */\n    statusUpdate: (update: RpcStatusNotification) => void;\n    /**\n     * The 'event' event is emitted when an event notification is received.\n     */\n    event: (events: RpcEventNotification) => void;\n    /**\n     * The 'error' event is emitted if an error occurs.\n     */\n    error: (error: Error) => void;\n};\n\n/**\n * Base class for all remote procedure call (RPC) handlers.\n */\nexport abstract class RpcHandler extends EventEmitter<RpcHandlerEvents> {\n    /**\n     * @param protocol - The protocol used to send RPCs.\n     */\n    constructor(readonly protocol: string) {\n        super();\n    }\n\n    /**\n     * Whether this handler is connected to its device.\n     */\n    abstract get connected(): boolean;\n\n    /**\n     * Sends an RPC.\n     * @param method - The method to call.\n     * @param params - Parameters that the method takes (if any).\n     * @returns A promise that will resolve once a response has been received from\n     * the device.\n     */\n    abstract request<T>(method: string, params?: RpcParams): PromiseLike<T>;\n\n    /**\n     * Closes the underlying connection, if applicable.\n     * @returns A promise that resolves once the connection has been closed.\n     */\n    abstract destroy(): PromiseLike<void>;\n}\n","import crypto from 'crypto';\nimport { JSONRPCClient, JSONRPCRequest, JSONRPCResponse, SendRequest } from 'json-rpc-2.0';\n\n/**\n * Authentication challenge parameters sent by the server when a protected resource is requested.\n */\nexport interface RpcAuthChallenge {\n    auth_type: string;\n    nonce: number;\n    nc?: number;\n    realm: string;\n    algorithm: string;\n}\n\n/**\n * Authentication response parameters supplied with each authenticated request.\n */\nexport interface RpcAuthResponse {\n    realm: string;\n    username: string;\n    nonce: number;\n    cnonce: number;\n    response: string;\n    algorithm: 'SHA-256';\n}\n\n/**\n * A request with authentication response parameters.\n */\nexport interface JSONRPCRequestWithAuth extends JSONRPCRequest {\n    auth?: RpcAuthResponse;\n}\n\n/**\n * Extends JSONRPCClient to seamlessly handle authentication.\n */\nexport class JSONRPCClientWithAuthentication<ClientParams = void> extends JSONRPCClient<ClientParams> {\n    /**\n     * Holds the current request ID. This number is incremented for each new request.\n     */\n    protected requestId = 0;\n    /**\n     * Authentication response parameters sent with each request if the connection has been authenticated.\n     */\n    protected auth?: RpcAuthResponse;\n\n    /**\n     * @param password - The password to authenticate with.\n     */\n    constructor(\n        send: SendRequest<ClientParams>,\n        protected password?: string,\n    ) {\n        super(send);\n    }\n\n    requestAdvanced(request: JSONRPCRequest, clientParams: ClientParams): PromiseLike<JSONRPCResponse>;\n    requestAdvanced(requests: JSONRPCRequest[], clientParams: ClientParams): PromiseLike<JSONRPCResponse[]>;\n    requestAdvanced(\n        requests: JSONRPCRequest | JSONRPCRequest[],\n        clientParams: ClientParams,\n    ): PromiseLike<JSONRPCResponse | JSONRPCResponse[]> {\n        // call requestWithAuthentication() for each request\n        const promises: Promise<JSONRPCResponse>[] = (Array.isArray(requests) ? requests : [requests]).map(\n            (r: JSONRPCRequest): Promise<JSONRPCResponse> => this.requestWithAuthentication(r, clientParams),\n        );\n\n        return Array.isArray(requests) ? Promise.all(promises) : promises[0];\n    }\n\n    /**\n     * Handles 401 errors by parsing the authentication challenge, generating an authentication response\n     * and supplying that response with each subsequent request.\n     */\n    protected async requestWithAuthentication(\n        request: JSONRPCRequest,\n        clientParams: ClientParams,\n    ): Promise<JSONRPCResponse> {\n        // construct a request object with autentication parameters\n        const req: JSONRPCRequestWithAuth = { auth: this.auth, ...request };\n\n        // send the request\n        const response = await super.requestAdvanced(req, clientParams);\n\n        // handle errors\n        if (response.error) {\n            // an error code of 401 means this request needs to be authenticated\n            if (response.error.code === 401) {\n                if (!this.password) {\n                    // abort authentication if we don't have a password\n                    return Promise.reject(new Error('Unauthorized'));\n                } else {\n                    const errorJSON = JSON.parse(response.error.message);\n                    // make sure auth has not expired, even though it shouldn't expire\n                    if (req.auth && errorJSON.nonce > 0 && errorJSON.nonce === req.auth.nonce) {\n                        // the request contained an authentication response but still fails with error 401, which means\n                        // we have the wrong password\n                        return Promise.reject(new Error('Invalid password'));\n                    }\n                }\n\n                try {\n                    // extract the authentication challenge parameters\n                    const authParams = JSON.parse(response.error.message);\n                    // setup the authentication response based on the challenge\n                    this.auth = this.createAuthResponse(authParams);\n                } catch (e) {\n                    // something went wrong\n                    const error = new Error('Failed to setup authentication: ' + (e instanceof Error ? e.message : e));\n                    if (e instanceof Error) {\n                        error.stack = e.stack;\n                    }\n                }\n\n                // now try the same request again\n                return this.requestWithAuthentication(request, clientParams);\n            }\n\n            return Promise.reject(new Error(response.error.message));\n        }\n\n        // this request was successful\n        return response;\n    }\n\n    /**\n     * Creates an authentication response based on the given challenge and the configured password.\n     * @param params - Authentication challenge params.\n     */\n    protected createAuthResponse(params: RpcAuthChallenge): RpcAuthResponse {\n        if (params.auth_type !== 'digest') {\n            throw new Error(`Unsupported authentication type \"${params.auth_type}\"`);\n        }\n        if (params.algorithm !== 'SHA-256') {\n            throw new Error(`Unsupported hash algorithm \"${params.algorithm}\"`);\n        }\n        if (!this.password) {\n            throw new Error('No password specified');\n        }\n\n        // create a function for generating SHA-256 hashes\n        const hash = (...parts: Array<string | number>) =>\n            crypto.createHash('sha256').update(parts.join(':')).digest('hex');\n\n        // generate a random number\n        const cnonce = Math.round(Math.random() * 1000000);\n\n        // construct the response\n        const response = [\n            hash('admin', params.realm, this.password),\n            params.nonce,\n            params.nc || 1,\n            cnonce,\n            'auth',\n            hash('dummy_method', 'dummy_uri'),\n        ];\n\n        return {\n            realm: params.realm,\n            username: 'admin',\n            nonce: params.nonce,\n            cnonce,\n            response: hash(...response),\n            algorithm: 'SHA-256',\n        };\n    }\n}\n","import WebSocket from 'ws';\n\nimport { JSONRPCClientWithAuthentication } from './auth';\nimport { RpcHandler, RpcParams } from './base';\n\n/**\n * Options for the WebSocket RPC handler.\n */\nexport interface WebSocketRpcHandlerOptions {\n    /**\n     * A unique ID used to identify this client when communicating with the Shelly device.\n     */\n    clientId: string;\n    /**\n     * The time, in seconds, to wait for a response before a request is aborted.\n     */\n    requestTimeout: number;\n    /**\n     * The interval, in seconds, at which ping requests should be made to verify that the connection is open.\n     * Set to `0` to disable.\n     */\n    pingInterval: number;\n    /**\n     * The interval, in seconds, at which a connection attempt should be made after a socket has been closed.\n     * If an array is specified, the first value of the array will be used for the first connection attempt, the second\n     * value for the second attempt and so on. When the last item in the array has been reached, it will be used for\n     * all subsequent connection attempts; unless the value is `0`, in which case no more attempts will be made.\n     * Set to `0` or an empty array to disable.\n     */\n    reconnectInterval: number | number[];\n    /**\n     * The password to use if the Shelly device requires authentication.\n     */\n    password?: string;\n}\n\n/**\n * Makes remote procedure calls (RPCs) over WebSockets.\n */\nexport class WebSocketRpcHandler extends RpcHandler {\n    /**\n     * The underlying websocket.\n     */\n    protected socket: WebSocket;\n\n    /**\n     * Handles parsing of JSON RPC requests and responses.\n     */\n    protected readonly client: JSONRPCClientWithAuthentication;\n\n    /**\n     * Timeout used to schedule connection attempts and to send periodic ping requests.\n     */\n    protected timeout: ReturnType<typeof setTimeout> | null = null;\n\n    /**\n     * Indicates which value in the `reconnectInterval` option is currently being used.\n     */\n    protected reconnectIntervalIndex = 0;\n\n    /**\n     * Event handlers bound to `this`.\n     */\n    protected readonly openHandler = this.handleOpen.bind(this);\n    protected readonly closeHandler = this.handleClose.bind(this);\n    protected readonly messageHandler = this.handleMessage.bind(this);\n    protected readonly pongHandler = this.handlePong.bind(this);\n    protected readonly errorHandler = this.handleError.bind(this);\n\n    /**\n     * @param hostname - The hostname of the Shelly device to connect to.\n     * @param opts - Configuration options for this handler.\n     */\n    constructor(\n        readonly hostname: string,\n        readonly options: WebSocketRpcHandlerOptions,\n    ) {\n        super('websocket');\n\n        this.socket = this.createSocket(`ws://${hostname}/rpc`);\n        this.client = new JSONRPCClientWithAuthentication(\n            (req: RpcParams): Promise<void> => this.handleRequest(req),\n            options.password,\n        );\n    }\n\n    get connected(): boolean {\n        return this.socket.readyState === WebSocket.OPEN;\n    }\n\n    request<T>(method: string, params?: RpcParams): PromiseLike<T> {\n        this.emit('request', method, params);\n\n        return this.client.timeout(this.options.requestTimeout * 1000).request(method, params);\n    }\n\n    destroy(): PromiseLike<void> {\n        // clear any timeout\n        this.clearTimeout();\n\n        // reject all pending requests\n        this.client.rejectAllPendingRequests('Connection closed');\n\n        // disconnect the socket\n        return this.disconnect();\n    }\n\n    /**\n     * Creates a new websocket and registers event handlers.\n     * @param url - The URL to connect to.\n     */\n    protected createSocket(url: string): WebSocket {\n        return new WebSocket(url)\n            .on('open', this.openHandler)\n            .on('close', this.closeHandler)\n            .on('message', this.messageHandler)\n            .on('pong', this.pongHandler)\n            .on('error', this.errorHandler);\n    }\n\n    /**\n     * Connects the websocket.\n     * Creates a new socket if the current is closed.\n     */\n    protected async connect() {\n        switch (this.socket.readyState) {\n            case WebSocket.CLOSED:\n            case WebSocket.CLOSING:\n                // the current socket is closed, disconnect and create a new one\n                await this.disconnect();\n                this.socket = this.createSocket(this.socket.url);\n            // fall through\n\n            case WebSocket.CONNECTING:\n                // wait for the socket to be connected\n                await this.awaitConnect();\n        }\n    }\n\n    /**\n     * Returns a Promise that will be fulfilled once the socket is connected.\n     */\n    protected awaitConnect(): Promise<void> {\n        const s = this.socket;\n\n        if (s.readyState === WebSocket.CONNECTED) {\n            // we're already connected\n            return Promise.resolve();\n        } else if (s.readyState !== WebSocket.CONNECTING) {\n            // reject if the socket isn't currently connecting\n            return Promise.reject(new Error('WebSocket is not connecting'));\n        }\n\n        return new Promise((resolve, reject) => {\n            // reject if the socket fails to connect\n            const closeHandler = (code: number, reason: Buffer) => {\n                const msg = reason.length > 0 ? reason.toString() : `code: ${code}`;\n                reject(new Error(`Error connecting to device (${msg})`));\n            };\n            s.once('close', closeHandler);\n\n            // resolve once the socket is connected\n            s.once('open', () => {\n                s.removeEventListener('close', closeHandler);\n                resolve();\n            });\n        });\n    }\n\n    /**\n     * Schedules a connection attempt after a time period specified by the `reconnectInterval` configuration option.\n     * @return The time, in milliseconds, that the next connection attempt will be made in; or `null` if none has been scheduled.\n     */\n    protected scheduleConnect(): number | null {\n        const reconnectInterval = this.options.reconnectInterval;\n        const intervals: number[] = !Array.isArray(reconnectInterval) ? [reconnectInterval] : reconnectInterval;\n\n        // abort if no interval has been specified\n        if (intervals.length === 0) {\n            return null;\n        }\n\n        // get the current interval\n        const interval = intervals[this.reconnectIntervalIndex] * 1000;\n\n        // abort if the interval is a non-positive number\n        if (interval <= 0) {\n            return null;\n        }\n\n        // clear any timeout\n        this.clearTimeout();\n\n        // schedule a new connection attempt\n        this.timeout = setTimeout(async () => {\n            this.timeout = null;\n\n            if (this.reconnectIntervalIndex < intervals.length - 1) {\n                this.reconnectIntervalIndex++;\n            }\n\n            try {\n                await this.connect();\n            } catch (e) {\n                this.emit('error', e as Error);\n            }\n        }, interval);\n\n        return interval;\n    }\n\n    /**\n     * Disconnects the socket and unregisters event handlers.\n     */\n    protected async disconnect() {\n        switch (this.socket.readyState) {\n            case WebSocket.OPEN:\n            case WebSocket.CONNECTING:\n                // close the socket\n                this.socket.close(1000, 'User request');\n            // fall through\n\n            case WebSocket.CLOSING:\n                // wait for the socket to be closed\n                await this.awaitDisconnect();\n        }\n    }\n\n    /**\n     * Returns a Promise that will be fulfilled once the socket is disconnected.\n     */\n    protected awaitDisconnect(): Promise<void> {\n        const s = this.socket;\n\n        if (s.readyState === WebSocket.CLOSED) {\n            // we're already disconnected\n            return Promise.resolve();\n        } else if (s.readyState !== WebSocket.CLOSING) {\n            // reject if the socket isn't closing\n            return Promise.reject(new Error('WebSocket is not disconnecting'));\n        }\n\n        return new Promise((resolve) => {\n            // resolve once the socket is disconnected\n            s.once('close', resolve);\n        });\n    }\n\n    /**\n     * Handles a request.\n     * @param payload - The request payload.\n     */\n    protected async handleRequest(payload: RpcParams) {\n        // make sure we're connected\n        await this.connect();\n        // then send the request\n        await this.sendRequest(payload);\n    }\n\n    /**\n     * Sends a request over the websocket.\n     * @param payload - The request payload.\n     */\n    protected sendRequest(payload: RpcParams): Promise<void> {\n        try {\n            // add our client ID to the payload\n            const data = { src: this.options.clientId, ...payload };\n\n            return new Promise((resolve, reject) => {\n                // send the request\n                this.socket.send(JSON.stringify(data), (error?: Error) => {\n                    if (!error) {\n                        resolve();\n                    } else {\n                        reject(error);\n                    }\n                });\n            });\n        } catch (e) {\n            return Promise.reject(e);\n        }\n    }\n\n    /**\n     * Sends a ping over the websocket.\n     */\n    protected sendPing() {\n        // abort if pings are disabled or the socket isn't open\n        if (this.options.pingInterval <= 0 || this.socket.readyState !== WebSocket.OPEN) {\n            return;\n        }\n\n        // clear the timeout\n        this.clearTimeout();\n\n        // send the ping\n        this.socket.ping((error?: Error) => {\n            if (error) {\n                this.emit('error', error);\n            }\n        });\n\n        // wait for a pong\n        this.timeout = setTimeout(() => {\n            // no pong received, terminate the connection\n            this.socket.terminate();\n        }, this.options.requestTimeout * 1000);\n    }\n\n    /**\n     * Clears any currently pending timeout.\n     */\n    protected clearTimeout() {\n        if (this.timeout !== null) {\n            clearTimeout(this.timeout);\n            this.timeout = null;\n        }\n    }\n\n    /**\n     * Handles 'open' events from the socket.\n     */\n    protected handleOpen() {\n        // reset the reconnect index\n        this.reconnectIntervalIndex = 0;\n\n        this.emit('connect');\n\n        // clear any timeout\n        this.clearTimeout();\n\n        // start sending pings\n        if (this.options.pingInterval > 0) {\n            this.timeout = setTimeout(() => this.sendPing(), this.options.pingInterval * 1000);\n        }\n    }\n\n    /**\n     * Handles 'close' events from the socket.\n     * @param code - A status code.\n     * @param reason - A human-readable explanation why the connection was closed.\n     */\n    protected handleClose(code: number, reason: Buffer) {\n        // clear any timeout\n        this.clearTimeout();\n\n        // remove event handlers\n        this.socket\n            .off('open', this.openHandler)\n            .off('close', this.closeHandler)\n            .off('message', this.messageHandler)\n            .off('pong', this.pongHandler)\n            .off('error', this.errorHandler);\n\n        let reconnectIn: number | null = null;\n\n        // unless this was an intentional disconnect...\n        if (code !== 1000) {\n            // try to reconnect\n            reconnectIn = this.scheduleConnect();\n        }\n\n        this.emit('disconnect', code, reason.toString(), reconnectIn);\n    }\n\n    /**\n     * Handles incoming messages.\n     * @param data The message data, as a JSON encoded string.\n     */\n    protected handleMessage(data: Buffer) {\n        // parse the data\n        const d = JSON.parse(data.toString());\n\n        if (d.id) {\n            // this is a response, let the JSON RPC client handle it\n            this.client.receive(d);\n        } else if (d.method === 'NotifyStatus' || d.method === 'NotifyFullStatus') {\n            // this is a status update\n            this.emit('statusUpdate', d.params);\n        } else if (d.method === 'NotifyEvent') {\n            // this is an event\n            this.emit('event', d.params);\n        }\n    }\n\n    /**\n     * Handles pongs received from the device.\n     */\n    protected handlePong() {\n        // clear the timeout\n        this.clearTimeout();\n\n        // schedule a new ping\n        if (this.options.pingInterval > 0) {\n            this.timeout = setTimeout(() => this.sendPing(), this.options.pingInterval * 1000);\n        }\n    }\n\n    /**\n     * Handles errors from the websocket.\n     * @param error - The error.\n     */\n    protected handleError(error: Error) {\n        this.emit('error', error);\n    }\n}\n\n/**\n * Factory class used to create `WebSocketRpcHandler` instances.\n */\nexport class WebSocketRpcHandlerFactory {\n    /**\n     * Default `WebSocketRpcHandler` options.\n     */\n    readonly defaultOptions: WebSocketRpcHandlerOptions = {\n        clientId: 'node-shellies-ds9-' + Math.round(Math.random() * 1000000),\n        requestTimeout: 10,\n        pingInterval: 60,\n        reconnectInterval: [\n            5,\n            10,\n            30,\n            60,\n            5 * 60, // 5 minutes\n            10 * 60, // 10 minutes\n        ],\n    };\n\n    /**\n     * Creates a new `WebSocketRpcHandler`.\n     * @param hostname - The hostname of the Shelly device to connect to.\n     * @param opts - Configuration options for the handler.\n     */\n    create(hostname: string, opts?: Partial<WebSocketRpcHandlerOptions>): WebSocketRpcHandler {\n        // get all options (with default values)\n        const options = { ...this.defaultOptions, ...(opts || {}) };\n\n        return new WebSocketRpcHandler(hostname, options);\n    }\n}\n","import EventEmitter from 'eventemitter3';\n\nimport { Device, DeviceId } from './devices';\nimport { DeviceDiscoverer, DeviceIdentifiers } from './discovery';\nimport { RpcHandler, WebSocketRpcHandlerFactory, WebSocketRpcHandlerOptions } from './rpc';\nimport { ShellyDeviceInfo } from './services';\n\n/**\n * Defines configuration options for discovered devices.\n */\nexport interface DeviceOptions {\n    /**\n     * Whether this device should be excluded.\n     */\n    exclude: boolean;\n    /**\n     * The protocol to use when communicating with the device.\n     */\n    protocol: 'websocket';\n    /**\n     * The password to use if the Shelly device requires authentication.\n     * This is used with WebSocket connections.\n     */\n    password?: string;\n}\n\n/**\n * Default options for discovered devices.\n */\nconst DEFAULT_DEVICE_OPTIONS: Readonly<DeviceOptions> = {\n    exclude: false,\n    protocol: 'websocket',\n};\n\n/**\n * Defines a function that takes a device ID and returns a set of configuration\n * options for that device.\n */\nexport type DeviceOptionsCallback = (deviceId: DeviceId) => Partial<DeviceOptions> | undefined;\n\n/**\n * Defines configuration options for the `Shellies` class.\n */\nexport interface ShelliesOptions {\n    /**\n     * Configuration options for WebSockets.\n     */\n    websocket?: WebSocketRpcHandlerOptions;\n    /**\n     * Whether the status should be loaded automatically for discovered devices.\n     */\n    autoLoadStatus: boolean;\n    /**\n     * Whether the config should be loaded automatically for discovered devices.\n     */\n    autoLoadConfig: boolean;\n    /**\n     * Configuration options for devices.\n     */\n    deviceOptions: Map<DeviceId, Partial<DeviceOptions>> | DeviceOptionsCallback | null;\n}\n\n/**\n * Default `Shellies` options.\n */\nconst DEFAULT_SHELLIES_OPTIONS: Readonly<ShelliesOptions> = {\n    autoLoadStatus: true,\n    autoLoadConfig: false,\n    deviceOptions: null,\n};\n\ntype ShelliesEvents = {\n    /**\n     * The 'add' event is emitted when a new device has been added.\n     */\n    add: (device: Device) => void;\n    /**\n     * The 'remove' event is emitted when a device has been removed.\n     */\n    remove: (device: Device) => void;\n    /**\n     * The 'error' event is emitted if an error occurs asynchronously.\n     */\n    error: (deviceId: DeviceId, error: Error) => void;\n    /**\n     * The 'exclude' event is emitted when a discovered device is ignored.\n     */\n    exclude: (deviceId: DeviceId) => void;\n    /**\n     * The 'unknown' event is emitted when a device with an unrecognized model designation is discovered.\n     */\n    unknown: (deviceId: DeviceId, model: string, identifiers: DeviceIdentifiers) => void;\n};\n\n/**\n * This is the main class for the shellies-ds9 library.\n * This class manages a list of Shelly devices. New devices can be added by registering a device discoverer.\n */\nexport class Shellies extends EventEmitter<ShelliesEvents> {\n    /**\n     * Factory used to create new `WebSocketRpcHandler`s.\n     */\n    readonly websocket = new WebSocketRpcHandlerFactory();\n\n    /**\n     * Holds configuration options for this class.\n     */\n    protected options: ShelliesOptions;\n\n    /**\n     * Holds all devices, mapped to their IDs for quick and easy access.\n     */\n    protected readonly devices: Map<DeviceId, Device> = new Map();\n\n    /**\n     * Event handlers bound to `this`.\n     */\n    protected readonly discoverHandler = this.handleDiscoveredDevice.bind(this);\n\n    /**\n     * Holds IDs of devices that have been discovered but not yet added.\n     */\n    protected readonly pendingDevices = new Set<DeviceId>();\n\n    /**\n     * Holds IDs of devices that have been discovered but are excluded or whose\n     * model designation isn't recognized.\n     */\n    protected readonly ignoredDevices = new Set<DeviceId>();\n\n    /**\n     * @param opts - A set of configuration options.\n     */\n    constructor(opts?: Partial<ShelliesOptions>) {\n        super();\n\n        // store the options, with default values\n        this.options = { ...DEFAULT_SHELLIES_OPTIONS, ...(opts || {}) };\n    }\n\n    /**\n     * The number of devices.\n     */\n    get size(): number {\n        return this.devices.size;\n    }\n\n    /**\n     * Adds a device. If a device with the same ID has already been added, an\n     * error will be thrown.\n     * @param device - The device to add.\n     */\n    add(device: Device): this {\n        // make sure we don't have a device with the same ID\n        if (this.devices.has(device.id)) {\n            throw new Error(`Device with ID ${device.id} already added`);\n        }\n\n        // make sure its not marked as pending\n        this.pendingDevices.delete(device.id);\n\n        // add the device\n        this.devices.set(device.id, device);\n\n        // emit an `add` event\n        this.emit('add', device);\n\n        return this;\n    }\n\n    /**\n     * Determines whether a device has been added.\n     * @param deviceOrId - The device or device ID to test.\n     * @returns `true` if the device has been added; `false` otherwise.\n     */\n    has(deviceOrId: Device | DeviceId): boolean {\n        const id: DeviceId = deviceOrId instanceof Device ? deviceOrId.id : deviceOrId;\n        return this.devices.has(id);\n    }\n\n    /**\n     * Returns the device with the given ID, or `undefined` if no such device was\n     * found.\n     */\n    get(deviceId: DeviceId): Device | undefined {\n        return this.devices.get(deviceId);\n    }\n\n    /**\n     * Executes a provided function once for each device.\n     * @param callback - Function to execute for each device.\n     * @param thisArg - Value to be used as `this` when executing `callback`.\n     */\n    forEach(callback: (device: Device, id: DeviceId, set: Shellies) => void, thisArg?) {\n        this.devices.forEach((device, id) => {\n            callback.call(thisArg, device, id, this);\n        });\n    }\n\n    /**\n     * Returns a new Iterator object that contains an array of\n     * `[DeviceId, Device]` for each device.\n     */\n    entries(): IterableIterator<[DeviceId, Device]> {\n        return this.devices.entries();\n    }\n\n    /**\n     * Returns a new Iterator object that contains the device IDs for each device.\n     */\n    keys(): IterableIterator<DeviceId> {\n        return this.devices.keys();\n    }\n\n    /**\n     * Returns a new Iterator object that contains each device.\n     */\n    values(): IterableIterator<Device> {\n        return this.devices.values();\n    }\n\n    /**\n     * Returns a new Iterator object that contains each device.\n     */\n    [Symbol.iterator](): IterableIterator<Device> {\n        return this.devices.values();\n    }\n\n    /**\n     * Removes a device.\n     * @param deviceOrId - The device or ID of the device to remove.\n     * @returns `true` if a device has been removed; `false` otherwise.\n     */\n    delete(deviceOrId: Device | DeviceId): boolean {\n        const id: DeviceId = deviceOrId instanceof Device ? deviceOrId.id : deviceOrId;\n        const device: Device | undefined = this.devices.get(id);\n\n        if (device !== undefined) {\n            this.devices.delete(id);\n\n            // emit a `remove` event\n            this.emit('remove', device);\n\n            return true;\n        }\n\n        return false;\n    }\n\n    /**\n     * Removes all devices.\n     */\n    clear() {\n        // emit `remove` events for all devices\n        for (const [, device] of this.devices) {\n            this.emit('remove', device);\n        }\n\n        this.devices.clear();\n    }\n\n    /**\n     * Registers a device discoverer, making discovered devices be added to this library.\n     * @param discoverer - The discoverer to register.\n     */\n    registerDiscoverer(discoverer: DeviceDiscoverer) {\n        discoverer.on('discover', this.discoverHandler);\n    }\n\n    /**\n     * Unregisters a previously registered device discoverer.\n     * @param discoverer - The discoverer to unregister.\n     */\n    unregisterDiscoverer(discoverer: DeviceDiscoverer) {\n        discoverer.removeListener('discover', this.discoverHandler);\n    }\n\n    /**\n     * Retrieves configuration options for the device with the given ID.\n     * @param deviceId - Device ID.\n     */\n    protected getDeviceOptions(deviceId: DeviceId): DeviceOptions {\n        // get all options (with defaults)\n        let opts: Partial<DeviceOptions> | undefined = undefined;\n        const deviceOptions = this.options.deviceOptions;\n\n        if (deviceOptions instanceof Map) {\n            opts = deviceOptions.get(deviceId);\n        } else if (typeof deviceOptions === 'function') {\n            opts = deviceOptions(deviceId);\n        }\n\n        return { ...DEFAULT_DEVICE_OPTIONS, ...(opts || {}) };\n    }\n\n    /**\n     * Creates an `RpcHandler` for a device.\n     * @param identifiers - A set of device identifiers.\n     * @param options - Configuration options for the device.\n     */\n    protected createRpcHandler(identifiers: DeviceIdentifiers, options: DeviceOptions): RpcHandler {\n        if (options.protocol === 'websocket' && identifiers.hostname) {\n            const opts = { ...this.options.websocket, password: options.password };\n            return this.websocket.create(identifiers.hostname, opts);\n        }\n\n        // we're missing something\n        throw new Error(\n            `Missing required device identifier(s) (device ID: ${identifiers.deviceId}, protocol: ${options.protocol})`,\n        );\n    }\n\n    /**\n     * Handles 'discover' events from device discoverers.\n     */\n    protected async handleDiscoveredDevice(identifiers: DeviceIdentifiers) {\n        const deviceId = identifiers.deviceId;\n\n        if (this.devices.has(deviceId) || this.pendingDevices.has(deviceId) || this.ignoredDevices.has(deviceId)) {\n            // ignore if we've seen this device before\n            return;\n        }\n\n        // get the configuration options for this device\n        const opts = this.getDeviceOptions(deviceId);\n\n        if (opts.exclude) {\n            // exclude this device\n            this.ignoredDevices.add(deviceId);\n            this.emit('exclude', deviceId);\n            return;\n        }\n\n        this.pendingDevices.add(deviceId);\n\n        try {\n            // create an RPC handler\n            const rpcHandler = this.createRpcHandler(identifiers, opts);\n\n            // load info about this device\n            const info = await rpcHandler.request<ShellyDeviceInfo>('Shelly.GetDeviceInfo');\n\n            // make sure the returned device ID matches\n            if (info.id.toLowerCase() !== deviceId.toLowerCase()) {\n                throw new Error(`Unexpected device ID (returned: ${info.id}, expected: ${deviceId})`);\n            }\n\n            // get the device class for this model\n            const cls = Device.getClass(info.model ?? '');\n\n            if (cls === undefined) {\n                // abort if we don't have a matching device class\n                this.ignoredDevices.add(deviceId);\n                this.emit('unknown', deviceId, info.model, identifiers);\n                return;\n            }\n\n            // create the device\n            const device = new cls(info, rpcHandler);\n\n            if (this.options.autoLoadStatus === true) {\n                // load its status\n                await device.loadStatus();\n            }\n            if (this.options.autoLoadConfig === true) {\n                // load its config\n                await device.loadConfig();\n            }\n\n            this.pendingDevices.delete(deviceId);\n\n            // add the device\n            this.add(device);\n        } catch (e) {\n            this.pendingDevices.delete(deviceId);\n\n            // create a custom Error\n            const message = e instanceof Error ? e.message : String(e);\n            const error = new Error(`Failed to add discovered device (id: ${deviceId}): ${message}`);\n\n            if (e instanceof Error) {\n                error.stack = e.stack;\n            } else {\n                Error.captureStackTrace(error);\n            }\n\n            // emit the error\n            this.emit('error', deviceId, error);\n        }\n    }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,kBAAkB;AA+BlB,IAAM,iBAAiB,CAAC,QAAa,iBAAyB;AAEjE,MAAI,CAAC,OAAO,UAAU,eAAe,KAAK,QAAQ,sBAAsB,GAAG;AACvE,WAAO,uBAAuB,IAAI,MAAc;AAAA,EACpD;AAGA,QAAM,QAAkB,OAAO;AAG/B,QAAM,KAAK,YAAY;AAC3B;AAKO,IAAe,gBAAf,cAAqC,aAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY9E,YACa,MACA,QACT,MAAqB,MACvB;AACE,UAAM;AAJG;AACA;AAQb,SAAQ,mBAAuC;AAH3C,SAAK,MAAM,QAAQ,OAAO,MAAM,KAAK,YAAY;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA,EAOA,IAAc,kBAA+B;AACzC,QAAI,KAAK,qBAAqB,MAAM;AAEhC,YAAM,QAAQ,IAAI,MAAc;AAChC,UAAI,QAAQ,OAAO,eAAe,IAAI;AAGtC,aAAO,UAAU,MAAM;AACnB,YAAI,OAAO,UAAU,eAAe,KAAK,OAAO,sBAAsB,GAAG;AACrE,gBAAM,KAAK,GAAG,MAAM,oBAAoB;AAA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