1.6.1 • Published 10 months ago

homebridge-somneo v1.6.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

homebridge-somneo

What This Plugin Is

This is a plugin for homebridge. It allows for management of the Philips Somneo HF3670/60. Additionally, it provides sensor data from the clock.

How the Plugin Works

The Somneo Clock has a small HTTP server running inside with a limited API. Through Googling and trial-and-error, I've found commands that work to replicate the SleepMapper app.

This server is very low powered though and if you see error messages in your logs it's most likely that two connections were trying to be processed at once.

Conflicting Accessories

In the physical world, the Somneo clock is a single device. But in the HomeBridge world, it is multiple. For this reason, I've created the concept of Conflicting Accessories.

A Conflicting Accessory means an accessory that needs full control over a physical device. In the case of the Somneo clock, there are two physical devices:

  1. The LED light.
  2. The audio speaker.

If a program requires light, it will turn off all other devices that require light. If it requires audio it will turn off all that require audio.

Below, is a chart explaining what will be turned off (if on) when an accessory is turned on.

Main LightNight LightSunset ProgramRelaxBreathe ProgramAudio
Main LightTurns OnN/ATurns OffTurns OffTurns OffUnaffected
Night LightTurns OnTurns OffN/ATurns OffTurns OffUnaffected
Sunset Turns OnTurns OffTurns OffN/ATurns OffTurns Off
RelaxBreatheTurns OnTurns OffTurns OffTurns OffN/ATurns Off
AudioTurns OnUnaffectedUnaffectedTurns OffTurns OffN/A

Installation

Before installing this plugin, you should install Homebridge using the official instructions.

Install via Homebridge Config UI X

  1. Search for Homebridge Somneo on the Plugins tab of Config UI X.
  2. Install the Homebridge Somneo plugin and use the form to enter your configuration.

Manual Installation

  1. Install this plugin using: sudo npm install -g homebridge-somneo --unsafe-perm.
  2. Edit config.json manually to add your information. See below for instructions on that.

Manual Configuration

Platform Schema

FieldRequiredData TypeDescriptionDefault Value
platformYesstringMust always be set to HomebridgeSomneo.N/A
nameYesstringSet the platform name for display in the Homebridge logs.Homebridge Somneo
somneosYesobject[]An array of configurations for Somneo clocksN/A
pollingSecondsNonumberTime in seconds for how often to ping the clock.30 (30000 milliseconds)

Somneo Schema

FieldRequiredData TypeDescriptionDefault Value
nameYesstringThe name of the clock. It will be used as a prefix for all of the accessories it exposes.N/A
hostYesstringIP address or hostname of the Somneo clock.N/A
sensorsYesobjectSettings for sensors in the Somneo clock.N/A
lightsYesobjectSettings for lights in the Somneo clock.N/A
switchesYesobjectSettings for switches in the Somneo clock.N/A
audioYesobjectSettings for the audio device in the Somneo clock.N/A
Sensors Schema
FieldRequiredData TypeDescriptionDefault Value
humidityYesobjectSettings for the humidity sensor.N/A
luxYesobjectSettings for the lux (light) sensor.N/A
temperatureYesobjectSettings for the temperature sensor.N/A
Humidity Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the humidity sensor.true
Lux Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the lux (light) sensor.true
Temperature Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the temperature sensor.true
Lights Schema
FieldRequiredData TypeDescriptionDefault Value
mainLightYesobjectSettings for the main (dimmable) light.N/A
nightLightYesobjectSettings for the (on/off) night light.N/A
MainLight Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the main light.true
NightLight Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the night light.true
Switches Schema
FieldRequiredData TypeDescriptionDefault Value
relaxBreatheYesobjectSettings for the RelaxBreathe Program switch.N/A
sunsetYesobjectSettings for the Sunset Program switch.N/A
RelaxBreathe Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the RelaxBreathe Program switch.true
breathsPerMinNonumberHow many breaths you want to take per minute.4 (BPM converted to the Philips value 1)
durationNonumberHow long the RelaxBreathe Program should run for.10 (minutes)
guidanceTypeNonumberWhat kind of guided RelaxBreathe program to run.Possible values:Light = 0Sound = 10 (Light)
lightIntensityNonumberHow bright the RelaxBreathe Program be at its peak. The value is a percentage that will be converted to a number between 1 and 25.80 (80% converted to the the Philips API value 20)
volumeNonumberHow loud the RelaxBreathe Program should be at its peak. The value is a percentage that will be converted to a number between 1 and 25.48 (48% converted to the the Philips API value 12)
Sunset Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the Sunset Program switch.true
durationNonumberHow long the Sunset Program should run for.30 (minutes)
lightIntensityNonumberHow bright the Sunset Program be at the start. The value is a percentage that will be converted to a number between 1 and 25.80 (80% converted to the the Philips API value 20)
colorSchemeNostringWhat color pattern should play during the Sunset Program.Possible values:Sunny Day = '0'Island Red = '1'Nordic White = '2'Carribean Red = '3''0' (Sunny Day)
ambientSoundsNostringWhat sounds should play during the Sunset Program.Possible values:Soft Rain = '1'Ocean Waves = '2'Under Water = '3'Summer Lake = '4'No Sound = '0''1' (Soft Rain)
volumeNonumberHow loud the Sunset Program should be at the start. The value is a percentage that will be converted to a number between 1 and 25.48 (48% converted to the the Philips API value 12)
Audio Schema
FieldRequiredData TypeDescriptionDefault Value
isEnabledNobooleanDetermines whether or not to expose the Audio Device.true
favoriteInputNonumberNumeric value specifying the input for the Somneo Audio to go to the first time its turned on in a session.After changing the input, the Somneo will go to the last used input.Possible values:FM Preset 1 = 1FM Preset 2 = 2FM Preset 3 = 3FM Preset 4 = 4FM Preset 5 = 5Auxiliary = 61 (FM Preset 1)

Somneo Audio Device Note

The Somneo clock has 5 FM radio presets and an auxiliary input. To help accomodate this, an audio receiver called Somneo Audio is available. You can turn in on and it will default to FM Preset 1. Additionally, you can raise and lower the volume with the Remote widget in iOS/iPadOS's Control Center.

However, due the way that audio receivers are implemented in Homebridge, they must be exposed as an External Plugin. This means that the Somneo Audio will need to be onboarded separately from the other accessories.

Onboarding Instructions for Somneo Audio

  1. Select Add Accessory in the Home app.
  2. Then select I Don't Have a Code or Cannot Scan.
  3. Then the Somneo Audio receiver should show as an option. It should look like:
  4. Enter your Homebridge PIN and the device will connect to your home.

Config Examples

Simplest Configuration

This configuration will expose all items and use the default polling interval with the least work.

{
  "name": "Homebridge Somneo",
  "somneos": [
    {
      "name": "Master Bedroom Somneo",
      "host": "[INSERT_IP_ADDRESS_HERE]"
    }
  ],
  "platform": "HomebridgeSomneo"
}

Most Verbose Configuration

This configuration will expose all items with default values, but is very verbose. It is presented here to help visualize the JSON structure.

{
  "name": "Homebridge Somneo",
  "somneos": [
    {
      "name": "Master Bedroom Somneo",
      "host": "[INSERT_IP_ADDRESS_HERE]",
      "sensors": {
        "humidity": {
          "isEnabled": true
        },
        "lux": {
          "isEnabled": true
        },
        "temperature": {
          "isEnabled": true
        }
      },
      "lights": {
        "mainLight": {
          "isEnabled": true
        },
        "nightLight": {
          "isEnabled": true
        }
      },
      "switches": {
        "relaxBreathe": {
          "isEnabled": true,
          "breathsPerMin": 4,
          "duration": 10,
          "guidanceType": 0,
          "lightIntensity": 80,
          "volume": 48
        },
        "sunset": {
          "isEnabled": true,
          "duration": 30,
          "lightIntensity": 80,
          "colorScheme": 0,
          "ambientSounds": "1",
          "volume": 48
        }
      },
      "audio": {
        "isEnabled": true,
        "favoriteInput": 1
      }
    }
  ],
  "pollingSeconds": 30,
  "platform": "HomebridgeSomneo"
}

Future Plans

  • No support for sound sensor. HomeKit does not have a sound level sensor. I thought about having an motion sensor, but would need to know what sound level motion detected/not should be considered.
  • Better error handling. I am a Java developer by trade and am still learning Typescript :).

Recognition

Thanks to:

  • homebridge - For creating a great template to get started with.
  • fototeddy - For creating a Homebridge Somneo plugin that reads the sensors.
  • DeKnep - For creating a similar plugin in another platform and exposing endpoints for control.
1.6.1

10 months ago

1.6.0

3 years ago

1.5.9

3 years ago

1.5.8

3 years ago

1.5.7

3 years ago

1.5.6

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.7

3 years ago

1.1.2

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago