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
Google Home Immediately change the Dimmer control in a button control as soon as I opened the fan object.
Could be a metadata problem?