1.4.1 • Published 4 months ago

bosch-smart-home-bridge v1.4.1

Weekly downloads
102
License
MIT
Repository
github
Last release
4 months ago

Logo

NPM version Downloads Main Known Vulnerabilities

NPM

bosch-smart-home-bridge

Allows communication to Bosch Smart Home Controller (BSHC)

Bosch Smart Home Controller

Bosch Smart Home Controller Local REST API.

Getting started

You need to create a new instance of BoschSmartHomeBridge (BSHB). Therefore, you need to use BoschSmartHomeBridgeBuilder. The builder will force you to set every mandatory properties:

  • host name / ip address of BSHC
  • client certificate (base64 encoded)
  • client private key (base64 encoded, 2048bit)
  • a logger which implements the interface which is defined in this library (optional)
const certificate = BshbUtils.generateClientCertificate();
const bshb = BoschSmartHomeBridgeBuilder.builder()
  .withHost("192.168.0.10")
  .withClientCert(certificate.cert)
  .withClientPrivateKey(certificate.private)
  .build();

Pairing

Then you need to start the pairing process. Therefore, you need:

  • name of the client
  • a unique identifier for the new client (uuid is ok but can be any string)
  • system password of BSHC
const identifier = BshbUtils.generateIdentifier();
bshb.pairIfNeeded("name", identifier, "systemPassword");

Communication

After that you can use BSHB to communicate with BSHC. Therefore, just use the provided client which provides some helpful methods:

bshb.getBshcClient();

Long Polling

If you are interested in updates from bshc you can use long polling. Therefore, you need to do the following:

bshb
  .getBshcClient()
  .subscribe()
  .subscribe((response) => {
    bshb
      .getBshcClient()
      .longPolling(response.parsedResponse.result)
      .subscribe((info) => {
        // do something with the information
        // also you need to call longPolling again after connection close
      });
  });

Do not forget to unsubscribe. E.g. in error case or on application end.

bshb
  .getBshcClient()
  .unsubscribe(response.parsedResponse.result)
  .subscribe(() => {});

Examples

You can find an example in test directory. Npm arguments must be set manually.

1.4.1

4 months ago

1.4.0

4 months ago

1.3.5

5 months ago

1.3.4

5 months ago

1.3.3

5 months ago

1.3.2

5 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.2.0

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.2-es2017

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.1

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.0

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

4 years ago

0.2.11

4 years ago

0.2.10

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.1.0

4 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago