Closed pouldam closed 7 years ago
Could you please provide your openHAB item configuration? (+ rules if you use those for controlling the relevant items)
chromecast.items:
Dimmer Volume "Chromecast Volume" { channel="chromecast:audio:35b4cd61dc478e816659a20cb84b70f6:volume" }
Player Music "Chromecast Player" { channel="chromecast:audio:35b4cd61dc478e816659a20cb84b70f6:control" }
nuimo.items:
Group Nuimo
Dimmer W "* ** ** ** ** * ** * * ** * * *** *** *" (Nuimo)
rules:
rule "W-nuimo-click"
when
Item W received command ON
then
{
var String command = Music.state.toString
if (command.contains("PLAY"))
{
Music.sendCommand(PAUSE)
}
else if (command.contains("PAUSE"))
{
Music.sendCommand(PLAY)
}
else if (command.contains("NULL"))
{
Music.sendCommand(PLAY)
}
}
end
rule "W-nuimo-wheel"
when
Item W received command REFRESH
then
{
sendCommand(Volume, W.state)
}
end
This is not an error in the Numo library. It's an intentional openHAB behaviour that, when a Dimmer item gets an "ON" command, it's state is set to 100.
Most cleanest solution:
Group Nuimo
Group:String:AVG W "* ** ** ** ** * ** * * ** * * *** *** *" (Nuimo)
Dimmer Volume "Chromecast Volume" (W) { channel="chromecast:audio:35b4cd61dc478e816659a20cb84b70f6:volume" }
Player Music "Chromecast Player" (W) { channel="chromecast:audio:35b4cd61dc478e816659a20cb84b70f6:control" }
Now, Nuimo commands are directly redirected to both items and you could just remove both rules and set the default command of Nuimo to "TOGGLE" for clicks within the Nuimo configuration. However, this configuration will not work in all cases, it depends a little bit how bindings are handling commands and states. As a more complicated solution you can also change the type of your wrapper item to "String" and adjust your "W-nuimo-wheel" rule:
Item configuration:
Group Nuimo
String W "* ** ** ** ** * ** * * ** * * *** *** *" (Nuimo)
Rule:
rule "W-nuimo-wheel"
when
Item W changed
then
{
if(W.state != "ON" AND W.state != NULL and W.state != "OFF") {
sendCommand(Volume, W.state)
}
}
end
It's probably not the cleanest way to do it, but it should work.
Sorry for the late reply - have been away for some days.
Thanks for the input. I have been trying both suggestions but cannot get them to work. However, I have solved my problem, by altering my rules, so that I always keep the Nuimo wheel state in a global variable, so I can (re)set it to its original value, after clicking the Nuimo (which sets the wheel-value to 100). Probably not the prettiest way to do it, but it works:
var Number nuimo_wheel = CCastVolume.state
rule "W-nuimo-wheel"
when
Item W received command REFRESH
then
{
sendCommand(CCastVolume, W.state)
nuimo_wheel = W.state
}
end
rule "W-nuimo-click"
when
Item W received command ON
then
{
var String ccState = CCastControl.state.toString
if (ccState.contains("PLAY"))
{
CCastControl.sendCommand(PAUSE)
}
else if (ccState.contains("PAUSE"))
{
CCastControl.sendCommand(PLAY)
}
else if (ccState.contains("NULL"))
{
CCastControl.sendCommand(PLAY)
}
// Hack to (re)set Numi wheel state after pressing play/pause (i.e. ON/OFF)
sendCommand(W, nuimo_wheel)
// Hack to (re)set CC volume after pressing play/pause (i.e. ON/OFF)
sendCommand(CCastVolume, nuimo_wheel)
}
end
OK, fine!
Hi,
I am using the Nuimo to control the volume of my Chromecast. This works OK, but once in a while if I have not touched the Nuimo in a minute or so the current volume setting (wheel state) is forgotten and when I turn the wheel again, the returned wheel state starts at 100 (full volume). I also seem to be able to provoke this, by pausing the music (cliking the Nuimo) and restart playing. Then the next time I turn the wheel, the returned value is 100.
I have configured a dimmer item in openHAB that I am using.