Google Assistant tag for "fan level"?

Hello,
I found several errors in the rules, this is the last version:

// Google Home Dimmer to/from OpenHab Item 
var FanStep = (100/3)
var FanDelta = (100/6)

rule "Ventilatore Camera - Ghome to Item"
when
Item VirGa_Camera_Vent received command
then
logInfo("VirGa_Camera_Vent", "Command = {}", receivedCommand)
switch (receivedCommand) 
{
    case ON       : PT_Camera_Vent.sendCommand(3)
    case OFF      : PT_Camera_Vent.sendCommand(0)
    case INCREASE : PT_Camera_Vent.sendCommand((PT_Camera_Vent.state as Number) + 1)
    case DECREASE : PT_Camera_Vent.sendCommand((PT_Camera_Vent.state as Number) - 1)
}	
end

rule "Ventilatore Camera - Item to Ghome"
when
Item PT_Camera_Vent received update
then
val fanVal = PT_Camera_Vent.state as Number

logInfo("PT_Camera_Vent", "state = {}", fanVal)


switch(fanVal.intValue)
{
case 0:
{
	VirGa_Camera_Vent.postUpdate(0)
}
case 1:
{
	VirGa_Camera_Vent.postUpdate(FanStep)
}
case 2:
{
	VirGa_Camera_Vent.postUpdate(FanStep*2)
}
default:
{
	VirGa_Camera_Vent.postUpdate(100)
}
}
end

At this point I can Switch Off and On (at maximum Speed) the Dimmer for the fan, but on google Home I cant change the speed :frowning:

Google Home Immediately change the Dimmer control in a button control as soon as I opened the fan object. :frowning:

Could be a metadata problem?

I also only have an On/Off switch for my fan dimmer. Speeds are set by voice control. I’ve never known it to be any different.

@michikrug, if we attach speeds to a fan, should we see a speed selector in the Google Home app? I’ve just been assuming that it was limited to an On/Off toggle.

Ok, I suppose that is a Google Home or OpenHan interface limitation. Wold be interesting to log the message exchanged between Google and OpenHab, when the Fan Object is open. Seems that at begin google consider the Object as “dimmer” (like a “Dimmerable Bulb”), but after a query switch to a simple switch control.
I also tried to add the [“Lighting”] tag, but in this case Google transform the fan in a bulb and have some connection problem: continue to loop from “online” and “offline”.

Afaik no, can only be used with voice right now.

2 Likes