Options
All
  • Public
  • Public/Protected
  • All
Menu

JSON Thermostat Class

With this class you can create a thermostat. The difference between this class and the normal thermostat class is that this class works with json strings. To create a thermostat use the constructor and fill the argument with a json string, defined by JSONThermostatSettings interface

Hierarchy

Index

Constructors

constructor

  • Creating an instance of a JsonThermostat

    In contrast to the normal thermostat class needs this class constrtuctor only a settings string as argument. This argument must be based on the JSONThermostatSettings interface.

    Parameters

    • settings: string

    Returns JsonThermostat

Properties

Private unit

unit: string = "celcius"

Accessors

isCooling

  • get isCooling(): boolean

isHeating

  • get isHeating(): boolean

Methods

checkUnit

  • checkUnit(unit: string): boolean
  • This method checks if the given unit is one of the known units in this class

    Parameters

    • unit: string

    Returns boolean

    this method returns true if the unit exist and returns false if it doesnt exist

convertTemperatureUnit

  • convertTemperatureUnit(temperature: number, unit: string): number
  • This class converts the temperature to the correct Unit using the convertTemperature class. Herefor , you must fill in the temperature and the unit argument. The Default unit is celcius

    Parameters

    • temperature: number
    • unit: string

    Returns number

    this class returns the correct covnerted temperature.

getTemperatureRange

  • getTemperatureRange(): number

getUnit

  • getUnit(): string
  • getting initialized unit

    Returns string

    this class returns a string that contains the unit.

getWantedTemperature

  • getWantedTemperature(): number

setCurrentTemperature

  • setCurrentTemperature(currentTemperature: number): void

update

  • updating the current temperature, it returns an Thermostat result object

    Parameters

    • currentTemperature: number

    Returns ThermostatResult

    this method returns an instance of the interface thermostatResult

updateJson

  • you can update current temperature with this method.

    Parameters

    • currentTemperature: string

    Returns ThermostatResult

    this method returns an instance from the ThermostatResult Interface.

Generated using TypeDoc