Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please Merge New Types for WaterQuality #1000

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/lib/Characteristic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,10 @@ export class Characteristic extends EventEmitter {
* @group Characteristic Definitions
*/
public static ColorTemperature: typeof ColorTemperature;
/**
* @group Characteristic Definitions
*/
public static Conductivity: typeof Conductivity;
/**
* @group Characteristic Definitions
*/
Expand Down Expand Up @@ -1020,6 +1024,10 @@ export class Characteristic extends EventEmitter {
* @group Characteristic Definitions
*/
public static FirmwareUpdateStatus: typeof FirmwareUpdateStatus;
/**
* @group Characteristic Definitions
*/
public static FreeChlorine: typeof FreeChlorine;
/**
* @group Characteristic Definitions
*/
Expand Down Expand Up @@ -1221,6 +1229,10 @@ export class Characteristic extends EventEmitter {
* @group Characteristic Definitions
*/
public static OutletInUse: typeof OutletInUse;
/**
* @group Characteristic Definitions
*/
public static OxygenReductionPotential: typeof OxygenReductionPotential;
/**
* @group Characteristic Definitions
*/
Expand All @@ -1245,6 +1257,10 @@ export class Characteristic extends EventEmitter {
* @group Characteristic Definitions
*/
public static PeriodicSnapshotsActive: typeof PeriodicSnapshotsActive;
/**
* @group Characteristic Definitions
*/
public static PH: typeof PH;
/**
* @group Characteristic Definitions
*/
Expand Down Expand Up @@ -1673,6 +1689,10 @@ export class Characteristic extends EventEmitter {
* @group Characteristic Definitions
*/
public static Token: typeof Token;
/**
* @group Characteristic Definitions
*/
public static TDS: typeof TDS;
/**
* @group Characteristic Definitions
*/
Expand Down Expand Up @@ -1737,6 +1757,10 @@ export class Characteristic extends EventEmitter {
* @group Characteristic Definitions
*/
public static WaterLevel: typeof WaterLevel;
/**
* @group Characteristic Definitions
*/
public static WaterQuality: typeof WaterQuality;
/**
* @group Characteristic Definitions
*/
Expand Down Expand Up @@ -3163,3 +3187,4 @@ export class Characteristic extends EventEmitter {
// type imports only (in order to define the static properties). Setting those properties is done outside
// this file, within the definition files. Therefore, we import it at the end of this file. Seems weird, but is important.
import "./definitions/CharacteristicDefinitions";
import { Conductivity, FreeChlorine, OxygenReductionPotential, PH, TDS, WaterQuality } from "./definitions";
5 changes: 5 additions & 0 deletions src/lib/Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ export class Service extends EventEmitter {
* @group Service Definitions
*/
public static Valve: typeof Valve;
/**
* @group Service Definitions
*/
public static WaterQualitySensor: typeof WaterQualitySensor;
/**
* @group Service Definitions
*/
Expand Down Expand Up @@ -1076,3 +1080,4 @@ export class Service extends EventEmitter {
// type imports only (in order to define the static properties). Setting those properties is done outside
// this file, within the definition files. Therefore, we import it at the end of this file. Seems weird, but is important.
import "./definitions/ServiceDefinitions";
import { WaterQualitySensor } from "./definitions";
121 changes: 121 additions & 0 deletions src/lib/definitions/CharacteristicDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,23 @@ export class ColorTemperature extends Characteristic {
}
Characteristic.ColorTemperature = ColorTemperature;

/**
* Characteristic "Conductivity"
*/
export class Conductivity extends Characteristic {

public static readonly UUID: string = "000002CE-0000-1000-8000-0026BB765291";

constructor() {
super("Conductivity", Conductivity.UUID, {
format: Formats.FLOAT,
perms: [Perms.NOTIFY, Perms.PAIRED_READ],
});
this.value = this.getDefaultValue();
}
}
Characteristic.Conductivity = Conductivity;

/**
* Characteristic "Configuration State"
* @since iOS 15
Expand Down Expand Up @@ -1538,6 +1555,23 @@ export class FirmwareUpdateStatus extends Characteristic {
}
Characteristic.FirmwareUpdateStatus = FirmwareUpdateStatus;

/**
* Characteristic "FreeChlorine"
*/
export class FreeChlorine extends Characteristic {

public static readonly UUID: string = "00000419-0000-1000-8000-0026BB765291";

constructor() {
super("Free Chlorine", FreeChlorine.UUID, {
format: Formats.FLOAT,
perms: [Perms.NOTIFY, Perms.PAIRED_READ],
});
this.value = this.getDefaultValue();
}
}
Characteristic.FreeChlorine = FreeChlorine;

/**
* Characteristic "Hardware Finish"
* @since iOS 15
Expand Down Expand Up @@ -2531,6 +2565,26 @@ export class OutletInUse extends Characteristic {
}
Characteristic.OutletInUse = OutletInUse;

/**
* Characteristic "Oxygen Reduction Potential"
*/
export class OxygenReductionPotential extends Characteristic {

public static readonly UUID: string = "009800C3-0000-1000-8000-0026BB765291";

constructor() {
super("Oxygen Reduction Potential", OxygenReductionPotential.UUID, {
format: Formats.INT,
perms: [Perms.NOTIFY, Perms.PAIRED_READ],
minValue: 0,
maxValue: 1000,
minStep: 1,
});
this.value = this.getDefaultValue();
}
}
Characteristic.OxygenReductionPotential = OxygenReductionPotential;

/**
* Characteristic "Ozone Density"
*/
Expand Down Expand Up @@ -2640,6 +2694,28 @@ export class PeriodicSnapshotsActive extends Characteristic {
}
Characteristic.PeriodicSnapshotsActive = PeriodicSnapshotsActive;

/**
* Characteristic "pH (Acidity)"
*/
export class PH extends Characteristic {

public static readonly UUID: string = "00201225-0000-1000-8000-0026BB765291";

public static readonly DISABLE = 0;
public static readonly ENABLE = 1;

constructor() {
super("pH", PH.UUID, {
format: Formats.FLOAT,
perms: [Perms.NOTIFY, Perms.PAIRED_READ],
minValue: 0,
maxValue: 14,
});
this.value = this.getDefaultValue();
}
}
Characteristic.PH = PH;

/**
* Characteristic "Picture Mode"
*/
Expand Down Expand Up @@ -4805,6 +4881,23 @@ export class Token extends Characteristic {
}
Characteristic.Token = Token;

/**
* Characteristic "TDS (ppm)"
*/
export class TDS extends Characteristic {

public static readonly UUID: string = "00000420-0000-1000-8000-0026BB765291";

constructor() {
super("Total Dissolved Solids", TDS.UUID, {
format: Formats.INT,
perms: [Perms.PAIRED_READ, Perms.NOTIFY],
});
this.value = this.getDefaultValue();
}
}
Characteristic.TDS = TDS;

/**
* Characteristic "Transmit Power"
* @since iOS 14
Expand Down Expand Up @@ -5117,6 +5210,34 @@ export class WaterLevel extends Characteristic {
}
Characteristic.WaterLevel = WaterLevel;

/**
* Characteristic "Water Quality"
*/
export class WaterQuality extends Characteristic {

public static readonly UUID: string = "00000195-0000-1000-8000-0026BB765291";

public static readonly UNKNOWN = 0;
public static readonly EXCELLENT = 1;
public static readonly GOOD = 2;
public static readonly FAIR = 3;
public static readonly INFERIOR = 4;
public static readonly POOR = 5;

constructor() {
super("Water Quality", WaterQuality.UUID, {
format: Formats.UINT8,
perms: [Perms.NOTIFY, Perms.PAIRED_READ],
minValue: 0,
maxValue: 5,
minStep: 1,
validValues: [0, 1, 2, 3, 4, 5],
});
this.value = this.getDefaultValue();
}
}
Characteristic.WaterQuality = WaterQuality;

/**
* Characteristic "Wi-Fi Capabilities"
* @since iOS 14
Expand Down
29 changes: 29 additions & 0 deletions src/lib/definitions/ServiceDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,35 @@ export class Valve extends Service {
}
Service.Valve = Valve;

/**
* Service "Water Quality Sensor"
*/
export class WaterQualitySensor extends Service {

public static readonly UUID: string = "0000018D-0000-1000-8000-0026BB765291";

constructor(displayName?: string, subtype?: string) {
super(displayName, WaterQualitySensor.UUID, subtype);

// Required Characteristics
this.addCharacteristic(Characteristic.WaterQuality);

// Optional Characteristics
this.addOptionalCharacteristic(Characteristic.BatteryLevel);
this.addOptionalCharacteristic(Characteristic.ReceivedSignalStrengthIndication);
this.addOptionalCharacteristic(Characteristic.Conductivity);
this.addOptionalCharacteristic(Characteristic.FreeChlorine);
this.addOptionalCharacteristic(Characteristic.PH);
this.addOptionalCharacteristic(Characteristic.OxygenReductionPotential);
this.addOptionalCharacteristic(Characteristic.OzoneDensity);
this.addOptionalCharacteristic(Characteristic.TDS);
this.addOptionalCharacteristic(Characteristic.StatusFault);
this.addOptionalCharacteristic(Characteristic.StatusLowBattery);
this.addOptionalCharacteristic(Characteristic.StatusTampered);
}
}
Service.WaterQualitySensor = WaterQualitySensor;

/**
* Service "Wi-Fi Router"
*/
Expand Down