Options
All
  • Public
  • Public/Protected
  • All
Menu

Interact with all registered Heating products.

note

Currently READ ONLY

Hierarchy

Index

Constructors

Methods

Constructors

constructor

  • new Heating(fetch: HiveFetch): Heating

Methods

get

  • Get the current state of all Heating products. This includes the current temperature of the device's location.

    example
    import { Hivehome } from 'node-hivehome';
    
    (async () => {
      const hive = await new Hivehome('hello@example.com');
      await hive.auth.login('supersecretpassword');
    
      const heatingProductsData = await hive.heating.get();
    
      console.log(JSON.stringify(heatingProductsData, null, 2));
    })()
    
    note

    Returned data is normalised before being returned.

    Returns Promise<Product[]>

history

  • Return all historical temperature readings for a given Heating product.

    The range and sampling is configurable by supplying the optional SdkHistoryOptions object. Only the required options can be supplied, instead of the full object.

    The default is to provide all readings over the last 24 hours with a 30 mins sampling interval.

    note

    It's not clear how long Hivehome store historical data for. This may error out depending on the combination of options provided.

    example

    Default search criteria

    import { Hivehome } from 'node-hivehome';
    
    (async () => {
      const hive = await new Hivehome('hello@example.com');
      await hive.auth.login('supersecretpassword');
    
      const tempHistory = await hive.heating.history('<product_id>');
    
      console.log(JSON.stringify(tempHistory, null, 2));
    })()
    
    example

    Get temperature readings for last 6 months, at 12 hrs intervals

    import { Hivehome } from 'node-hivehome';
    
    (async () => {
      const hive = await new Hivehome('hello@example.com');
      await hive.auth.login('supersecretpassword');
    
      const tempHistory = await hive.heating.history('<product_id>', {
        start: 00000000, // calculate the Unix timestamp for now - 6 months
        interval: {
          unit: 'HOURS',
          sample: 12,
        },
      });
    
      console.log(JSON.stringify(tempHistory, null, 2));
    })()
    

    Parameters

    Returns Promise<SdkHistoryDataPoint[]>

Generated using TypeDoc