Skip to content

Commit

Permalink
Codec - list properties
Browse files Browse the repository at this point in the history
  • Loading branch information
arachnetech committed May 3, 2020
1 parent 1a220ad commit 7358592
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MQTT topics used fall into two categories:
* Control topics, of the form `setXXX`, are published by MQTT-Thing in order to control device state (e.g. to turn on a light).
* Status/notification topics, of the form `getXXX`, are published by the device to notify MQTT-Thing that something has occurred (e.g. that a sensor has detected something or a control topic action has been performed).

For further details, see [docs/Configuration.md](docs/Configuration.md).
For further details, see [docs/Configuration.md](docs/Configuration.md) and [docs/Codecs.md](docs/Codecs.md).

## Supported Accessories

Expand Down
118 changes: 117 additions & 1 deletion docs/Codecs.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function init() {
properties: {
targetProp1: {
encode: encodeFunction1,
decode: decodeFunction2
decode: decodeFunction1
},
targetProp2: {
encode: encodeFunction2
Expand Down Expand Up @@ -121,3 +121,119 @@ The `decode()` function may either return the decoded message, or it may deliver
## Empty Codec

When writing a codec, you may find it helpful to start with the no-op implementation in [`test/empty-codec.js`](../test/empty-codec.js).

## Properties

This section lists the properties available for each accessory type. All accessories may also support `batteryLevel`, `chargingState` and `statusLowBattery`.

### Air Pressure Sensor

`airPressure`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Air Quality Sensor

`airQuality`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`, `carbonDioxideLevel`, `pm10density`, `pm2_5density`, `ozonedensity`, `nitrogenDioxideDensity`, `sulphurDioxideDensity`, `VOCDensity`, `carbonMonoxideLevel`, `airQualityPPM`, `currentTemperature`, `currentRelativeHumidity`

### Carbon Dioxide Sensor

`carbonDioxideDetected`, `carbonDioxideLevel`, `carbonDioxidePeakLevel`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Contact Sensor

`contactSensorState`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Doorbell

`switch`, `brightness`, `volume`, `motionDetected`

### Fan

`on`, `rotationDirection`, `rotationSpeed`

### Garage door opener

`targetDoorState`, `currentDoorState`, `doorMoving`, `obstructionDetected`, `lockTargetState`, `lockCurrentState`

### Heater Cooler

`active`, `currentHeaterCoolerState`, `targetHeaterCoolerState`, `currentTemperature`, `lockPhysicalControls`, `swingMode`, `coolingThresholdTemperature`, `heatingThresholdTemperature`, `temperatureDisplayUnits`, `rotationSpeed`

### Humidity Sensor

`currentRelativeHumidity`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Leak Sensor

`leakDetected`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Light bulb

`on`, `brightness`, `hue`, `saturation`, `colorTemperature`, `white`, `HSV`, `RGB`, `RGBW`, `RGBWW`

### Light Sensor

`currentAmbientLightLevel`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Lock Mechanism

`lockTargetState`, `lockCurrentState`

### Microphone

`mute`, `volume`

### Motion Sensor

`motionDetected`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Occupancy Sensor

`occupancyDetected`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Outlet

`on`, `outletInUse`, `currentConsumption`, `voltage`, `electricCurrent`, `totalConsumption`

### Security System

`targetState`, `currentState`, `statusFault`, `statusTampered`

### Speaker

`mute`, `volume`

### StatelessProgrammableSwitch

`switch`, `switch0`, `switch1`, `switch2`, ...

### Switch

`on`

### Television

`active`, `input`XX

### Temperature Sensor

`currentTemperature`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`

### Thermostat

`currentHeatingCoolingState`, `targetHeatingCoolingState`, `currentTemperature`, `targetTemperature`, `temperatureDisplayUnits`, `currentRelativeHumidity`, `targetRelativeHumidity`, `coolingThresholdTemperature`, `heatingThresholdTemperature`

### Valve (Sprinkler, Shower, Faucet)

`active`, `inUse`, `setDuration`, `remainingDuration`

### Weather Station

`currentTemperature`, `statusActive`, `statusFault`, `statusTampered`, `statusLowBattery`, `currentRelativeHumidity`, `airPressure`, `weatherCondition`, `rain1h`, `rain24h`, `uvIndex`, `visibility`, `windDirection`, `windSpeed`

### Window

`currentPosition`, `targetPosition`, `positionState`, `holdPosition`, `obstructionDetected`

### Window Covering (Blinds)

`currentPosition`, `targetPosition`, `positionState`, `holdPosition`, `obstructionDetected`, `targetHorizontalTiltAngle`, `currentHorizontalTiltAngle`, `targetVerticalTiltAngle`, `currentVerticalTiltAngle`
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1677,22 +1677,22 @@ function makeThing(log, config) {

// Characteristic.OzoneDensity
function characteristic_OzoneDensity( service ) {
floatCharacteristic( service, 'Ozonedensity', Characteristic.OzoneDensity, null, config.topics.getOzoneDensity );
floatCharacteristic( service, 'ozoneDensity', Characteristic.OzoneDensity, null, config.topics.getOzoneDensity );
}

// Characteristic.NitrogenDioxideDensity
function characteristic_NitrogenDioxideDensity( service ) {
floatCharacteristic( service, 'NitrogenDioxidedensity', Characteristic.NitrogenDioxideDensity, null, config.topics.getNitrogenDioxideDensity );
floatCharacteristic( service, 'nitrogenDioxideDensity', Characteristic.NitrogenDioxideDensity, null, config.topics.getNitrogenDioxideDensity );
}

// Characteristic.SulphurDioxideDensity
function characteristic_SulphurDioxideDensity( service ) {
floatCharacteristic( service, 'SulphurDioxidedensity', Characteristic.SulphurDioxideDensity, null, config.topics.getSulphurDioxideDensity );
floatCharacteristic( service, 'sulphurDioxideDensity', Characteristic.SulphurDioxideDensity, null, config.topics.getSulphurDioxideDensity );
}

// Characteristic.VOCDensity
function characteristic_VOCDensity( service ) {
floatCharacteristic( service, 'VOCdensity', Characteristic.VOCDensity, null, config.topics.getVOCDensity );
floatCharacteristic( service, 'VOCDensity', Characteristic.VOCDensity, null, config.topics.getVOCDensity );
}

// Characteristic.CarbonMonoxideDensity
Expand Down Expand Up @@ -1736,7 +1736,7 @@ function makeThing(log, config) {

// Characteristic.CarbonDioxideLevel
function characteristic_CarbonDioxidePeakLevel( service ) {
floatCharacteristic( service, 'carbonDioxidePeak', Characteristic.CarbonDioxidePeakLevel, null, config.topics.getCarbonDioxidePeakLevel, 0 );
floatCharacteristic( service, 'carbonDioxidePeakLevel', Characteristic.CarbonDioxidePeakLevel, null, config.topics.getCarbonDioxidePeakLevel, 0 );
}

// Characteristic.CurrentHeatingCoolingState
Expand Down
2 changes: 1 addition & 1 deletion test/empty-codec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function init( params ) {
* properties: {
* targetProp1: {
* encode: encodeFunction1,
* decode: decodeFunction2
* decode: decodeFunction1
* },
* targetProp2: {
* encode: encodeFunction2
Expand Down

0 comments on commit 7358592

Please sign in to comment.