I have a dyson fan and three modes set up in harmony.
I would like to rotate them using core but first I need a switch that can rotate through states.
How do I create that?
I wouldnât think you would need a switch for this, youâll just need a variable in core keep track of where youâre at in the sequence. But youâll get the quickest answer by asking in the core peer Assistance thread, thatâs where most of the core experts hang out. Just add your question to the end of the thread and someone will help you.
Another alternative would be to set up three virtual switches, one for each state, which is how we wouldâve done this a couple of years ago, but I honestly think with Core you wonât need to do that.
Ah a bit of context here. I have a Google Home so creating an extra switch in âthingsâ enables voice control Thatâs why Iâd like a virtual switch that could be exposed to Google.
I would like a three-stage switch which
- can report its status and be control directly in âthingsâ
- be exposed to Home (âturn dyson to heatâ)
then I could get core to read the switch status and fire off harmony events correspondingly.
Iâve dipped my toes into the handler thing but seems like âswitchâ is only binary?
Any device capability that is suitable for this? I used âactuatorâ as a placeholder here.
I couldnât get the button to change the âdysonâ attribute.
Please help.
metadata {
definition (name: âDyson Linkâ, namespace: âxxxâ, author: âxxxâ) {
capability "Actuator"
capability âSensorâ
attribute "dyson", "string"
command "on" command "auto" command "cool" command "heat"
}
tiles(scale:2) {
standardTile(âbuttonâ, âdevice.actuatorâ, width: 6, height: 4, canChangeIcon: true) {
state âoffâ, label: âOffâ, action: âactuator.autoâ, icon: âst.Appliances.appliances11â, backgroundColor: â#ffffffâ, nextState: "auto"
state âautoâ, label: âAutoâ, action: âactuator.coolâ, icon: âst.Appliances.appliances11â, backgroundColor: â#00cc66â, nextState: "cool"
state âcoolâ, label: âCoolâ, action: âactuator.heatâ, icon: âst.Appliances.appliances11â, backgroundColor: â#00ccffâ, nextState: "heat"
state âheatâ, label: âHeatâ, action: âactuator.offâ, icon: âst.Appliances.appliances11â, backgroundColor: â#ff6699â, nextState: âoffâ
}
}
}
def off() {
sendEvent(name: âdysonâ, value: âoffâ)
}
def auto() {
sendEvent(name: âdysonâ, value: âautoâ)
}
def cool() {
sendEvent(name: âdysonâ, value: âcoolâ)
}
def heat() {
sendEvent(name: âdysonâ, value: âheatâ)
}
Personally Iâd use CoRE to handle the smarts and actions, use GH/IFTTT for the voice component, and use virtual switches for the âthingsâ control, instead of getting into custom DTH. Thatâs just me though.
You could probably even get away with skipping the virtual switches if you were willing to manually execute/simulate pistons when needing manual control.
A switch is binary, yes.
What some people have done in a similar situation is to use a virtual dimmer and just assign values 1â33 to âAâ, 34â66 to âBâ and 67-100 to âC.â Such as for A device with low/medium/high but really you can use it for anything.
You might also look at what people have done with thermostats, which commonly have three three Thermostat modes (cool, heat, off). I know some people have created tiles, for example, which cycle between the three such as blue for cool, orange for heat, and white for off. There might be some more options there.