Google Assistant tag for "fan level"?

What’s an appropriate tag to represent a “fan level” (Dimmer item) on google assistant? I used “Lighting” but whenever I asked google to set the fan level it would say “Setting the fan level brightness to XX”

There’s a list of available tags here:
https://www.openhab.org/docs/ecosystem/google-assistant/

I’d say, use [“Lighting”] and treat it as a dimmer. Think it’s the thing that comes closest to it.

Soon there will be a proper implementation of the FAN type in the openHAB Google Assistant implementation. It is already prepared and needs to be published.
When it is live (will be announced) you will be able to use it like:
Dimmer FanSpeed "My Fan Name" { ga="FAN" [ lang="en", speeds="0=null:off,50=slow,100=full:fast", ordered=true ] }

3 Likes

Happy dance! Where will it be announced? Can I try the beta? Where can I see the docs of what else will be available?

Is this the current doc: Use Metadata instead of Tags by michikrug · Pull Request #120 · openhab/openhab-google-assistant · GitHub
and here https://github.com/michikrug/openhab-google-assistant/tree/metadata

Yes, those are the latest developments. A lot of things are mentioned in the PR. The documentation still needs some additions…

You could only try this already when you are hosting your own openhab cloud and assistant function.

The announcement will surely be done here in the forum (official Google assistant thread).

Does it need to be same group as thermostat or just standalone?

Fans aren’t related to thermostats, so it’s standalone. This feature is fully implemented now, and works well in my experience. You just need to add the metadata to your fan item.

Thats great. Can you please let me know how its working?

This is what I’ve in my items

Dimmer d_mb_fan “Master Bedroom Fan” {channel = “mqtt:topic:mbr:fan”,alexa=“Switchable”, ga=“FAN” [ lang=“en”, speeds=“0=null:off,50=slow,100=full:fast”, ordered=true ] }

When i speak the command,set Master BedroomFan to full/slow etc,it just shows some search results

Well, I just tried it with german “Stelle Lüfter auf Langsam” which would be “Set Fan to slow” and it worked.

Thank You. It does work now. However,when tell Google to turn it on , it sets it to the highest speed,even though I’ve set default to 25 / Low

{ga=“Fan” [ speeds=“0=off:zero,25=default:low:one,50=medium:two,100=high:three”, lang=“en”, ordered=true ]}

As far as I know, you can not specify the “default” speed. When turning it on it will always use “100%”.
With your config you would also have to say “Turn fan to default”. (Not sure if it will understand it like that.)

Yep, Google equates “on” to “100%”. I got around this by using a proxy item for my fan. If Google turns the fan on to 100, the rule checks the previous state of the fan and issues that as the command.

Since you just want it to always default to 25, you might be able to define 25=on:low in your metadata.

Thanks.I’ll try it out.

Hello,
I’m using sonoff iFan03 with tasmota firmware connected via MQTT to OpenHab.
The firmare drive the 3-state fan speed (Min,Med,Max) by a number :(1,2,3) fro speeds plus zero for Fan Off.

Google API use number Item for Thermostat, but for Fan requre dimmers that need a number 0-100 to work well.

Any suggestion to drive the fan by Google Home?

Welcome to openHAB!

You can set up the iFan03 as a dimmer item, and define the Google Assistant speeds to match the numbers you need.

{ga=“Fan” [ speeds=“0=off:zero,1=low:one,2=medium:two,3=high:maximum:three”, lang=“en”, ordered=true ]}

The only issue is that when you say “Hey Google, turn the fan on”, it will default to 100. As I suggested in my previous post, you might be able to change the default by adding “on” to one of the speeds. @arunsudhakar, did you confirm whether or not this works?

If this doesn’t work for you, use an unbound proxy item as a go-between. The proxy item would be controlled by Google, and then you’ll need a rule that triggers when the proxy item changes and tells the fan what to do. If you also use the physical controls on iFan03, you’ll also need a rule that updates the proxy item so that the two stay in sync.

Thank you @rpwong . I didn’t pursue this further , since I implemented it on Alexa using the Alexa Openhab skill. Alexa is the goto device in my household for Smart Home control :slight_smile:

Your Welcome rpwong,
I already tried to use the metadata as you, but in this way I cant control the fan by screen control, because the allowed value are 0, 1, 3. But the Dimmer accept 0 to 100. A solution could be use nodered to change the value passed to/from the dimmer:

Dimer value:

  • 1 to 33 will be iFan03 1
  • 34 to 66 will be iFan03 2
  • 67 to 100 will be iFan03 3
    Or so on.
    Return value from iFan 3 will be:
    1 = 33
    2= 66
    3 = 100

In this way, Manually setting the dimer to a value between 1 and 33 the value passed to iFan3 will be 1. The response from iFan3 will set the dimmer to 33.

I need to try.

I don’t know what you mean by “screen control”. Are you talking about a sitemap? If so, you just have to set your sitemap element to friendly display values that it translates to 0-3.

You don’t need NodeRed (though I have nothing against it if tha works for you). What you’re describing is what I suggested with the unbound proxy item.

No, I don’t mean the Openhab UI screen Control. I already create a sitemap with a mapped Switch that work fine. 4 Buttons, with value 0-1-2-3 and proper names, to switch off and on in the 3 different speed.

I mean the google Home App Dimmer control. It accept value 0-100. To work well i need to pass to Google Home a value 0-100 instead 0-3. I don’t know “Unbound proxy items”. I have to study them…

Thanks

Ok, I’m not sure if I have Understood…

I SetUp a Proxy Item to convert a Item (Sonoff iFan03 Fan) that is a Number Item to a Dimmer (0-100) for Google Home.

These is my Items:

Number PT_Camera_Vent	"Ventilatore Camera" 	<fan_ceiling>	(PT_Camera) ["Switchable"] { channel="mqtt:topic:5d83403e:PT_Camera_Vent " }
Dimmer VirGa_Camera_Vent "Ventilatore Camera" <fan_ceiling> { ga="Fan" [ speeds="0=zero:spegni:off,33=uno:min:minima:bassa,66=due:med:media,100=tre,max,massima,alta", lang="it", ordered=true ] }

These is my rules:

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

rule "Ventilatore Camera - Ghome to Item"
when
Item VirGa_Camera_Vent Received Command
then
if (receivedCommand < FanDelta)
{
	PT_Camera_Vent.SendCommand(0)
}
else if (receivedCommand < (FanStep + FanDelta))
{
	PT_Camera_Vent.SendCommand(1)
}
else if (receivedCommand < ((FanStep *2) + FanDelta))
{
	PT_Camera_Vent.SendCommand(2)
}
else
{
	PT_Camera_Vent.SendCommand(3)
}
end

rule "Ventilatore Camera - Item to Ghome"
when
Item PT_Camera_Vent Received Update
then
val fanVal = PT_Camera_Vent as Number
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

I expect that:
When the Dimmer on Goolge Home change:
From 0 to about 16, the Fan is set to Speed=0
From about 16 to about 50, the Fan is set to Speed=1
From about 50 to about 83, the Fan is set to Speed=2
From about 83 to 100, the Fan is set to Speed=3

When the Fan State change:
0 => Dimmer on Google Home set to 0
1 => Dimmer on Google Home set to 33
2 => Dimmer on Google Home set to 66
3 => Dimmer on Google Home set to 100