homekit icon indicating copy to clipboard operation
homekit copied to clipboard

About air conditioner

Open zuozhehao opened this issue 4 years ago • 1 comments

Thank you for created such a good library. Can you add an example of air conditioner?

zuozhehao avatar Jun 20 '21 17:06 zuozhehao

sorry for the delay in answering, i am using simple thermostat for air cond but if you need to regulate the airflow, you can combine the two accessories thermostat + fan / air purifier (similar use case https://github.com/alpr777/homekit/blob/main/accessory_thermostat_automatic.go)

type AccessoryThermostatAC struct {
	*accessory.Accessory
	Thermostat struct {
		//	◈ CurrentHeatingCoolingState
		//	◈ TargetHeatingCoolingState
		//	◈ CurrentTemperature
		//	◈ TargetTemperature
		//	◈ TemperatureDisplayUnits
		//	◇ CoolingThresholdTemperature
		//	◇ HeatingThresholdTemperature
		//	◇ CurrentRelativeHumidity
		//	◇ TargetRelativeHumidity
		*service.Service
		CurrentHeatingCoolingState *characteristic.CurrentHeatingCoolingState
		TargetHeatingCoolingState  *characteristic.TargetHeatingCoolingState
		CurrentTemperature         *characteristic.CurrentTemperature
		TargetTemperature          *characteristic.TargetTemperature
		TemperatureDisplayUnits    *characteristic.TemperatureDisplayUnits
	}
	/*optional*/ AirPurifier struct {
		//	◈ Active
		//	◈ CurrentAirPurifierState
		//	◈ TargetAirPurifierState
		//	◇ RotationSpeed
		*service.Service
		Active                  *characteristic.Active
		CurrentAirPurifierState *characteristic.CurrentAirPurifierState
		TargetAirPurifierState  *characteristic.TargetAirPurifierState
		RotationSpeed           *characteristic.RotationSpeed
	}
	/*optional*/ Fan struct {
		//	◈ Active
		//	◇ CurrentFanState
		//	◇ TargetFanState
		//	◇ RotationDirection
		//	◇ RotationSpeed
		//	◇ SwingMode
		//	◇ LockPhysicalControls
		*service.Service
		Active        *characteristic.Active
		RotationSpeed *characteristic.RotationSpeed
	}
}

xxandev avatar Nov 30 '21 10:11 xxandev