Can anyone tell me if this is possible?
<div class="scene" ng-click="sendCmd('Zone_1_Scene', 'Scene 3')">Fire TV</div>
I want to send the Zone_1_Scene command and also a command to the TV…
Can anyone tell me if this is possible?
<div class="scene" ng-click="sendCmd('Zone_1_Scene', 'Scene 3')">Fire TV</div>
I want to send the Zone_1_Scene command and also a command to the TV…
ng-click="sendCmd('Zone_1_Scene', 'Scene 3'); sendCmd('Zone_2_Scene', 'Scene 3')"
Thanks Harry That works fine. Is there a way to delay the commands? some how? ie: the TV needs a few seconds to turn on, before the second command is sent
Or would I need some kind of rule?
I think, you have to use a rule.
Hmmm. Can you suggest how to trigger a rule using a ng-click state?
rule "xxx"
when
Item yourItem1 changed to ON
then
Thread::sleep(1000)
yourItem2.postUpdate(ON)
end
Thanks Harry. I think I need a Proxy item, because that rule would trigger on other items such as Turning the TV on for other things.
If i create a dummy item TVProxy, as a switch. Then I could do
rule "xxx"
when
Item Proxy changed to ON
then
Thread::sleep(1000)
TV.postUpdate(ON)
Scene_1.postUpdate('Scene 1')
end
would that be right?
rule "xxx"
when
Item Proxy changed to ON
then
TV.postUpdate(ON)
Thread::sleep(1000)
Scene_1.postUpdate('Scene 1')
end
or
rule "xxx"
when
Item TV changed to ON
then
Thread::sleep(1000)
Scene_1.postUpdate('Scene 1')
end
Thanks Harry, then my widget code would be this?
Unforunately it does not work I tried changing postUpdate to sendCommand
20:11:44.654 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TVProxyFTA' received command ON
20:11:50.157 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TVProxyFTA' received command ON
rule "Apply Scene and turn the TV to the correct input for Free to Air"
when
Item TVProxyFTA changed to ON
then
TV.sendCommand(ON)
Thread::sleep(1000)
Zone_1_Scene.sendCommand('Scene 1')
end
Does it work now, else post you item-definition and the log.
It doesnt work.
Rule:
rule "Apply Scene and turn the TV to the correct input for Free to Air"
when
Item TVProxyFTA changed to ON
then
TV.sendCommand(TVOnOff)
Thread::sleep(1000)
Zone_1_Scene.sendCommand('Scene 1')
end
Item:
/* This switch will be used in the Entertainment Rule to change Input to FTA */
Switch TVProxyFTA "FTA Switch"
Item for the TV
String TV "TV" { channel="broadlink:rm3:78-0f-77-18-43-03:command" }
Log
20:20:11.727 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'TVProxyFTA' received command ON
And my widget
<div class="widget" ng-class="{true: 'disabled'}[itemValue('Main_Zone_Power')=='PowerOff']">
<div class="icon off"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/squidink.svg#controal-4"></use></svg></div>
<div class="name" ng-init="soundOptions=0" ng-click="soundOptions=1">Scene<svg viewBox="0 0 180 180"><use xlink:href="/static/matrix-theme/squidink.svg#down-arrow-2"></use></svg></div>
<div class="sceneGroup" ng-if="soundOptions==1">
<div class="scene" ng-click="sendCmd('TVProxyFTA', 'ON')">Netflix/TV</div>
<div class="scene" ng-click="sendCmd('Zone_1_Scene', 'Scene 2')">PS4</div>
<div class="scene" ng-click="sendCmd('Zone_1_Scene', 'Scene 3')">Fire TV</div>
</div>
</div>
If TV is a string you have to change to
TV.sendCommand("TVOnOff")
or the right command.
There must be a warning in the editor and a log entry.
OK, ill update that. Im just using nano… There was no warning about a syntax issue.
Same issue:
This is the broadlink.map file used for the TV
/* Hisense N7 TV
TVOnOff=260050000001248f1114111312131113121311131213111411381138113811381136133812
Do you ever have switched the TV before from openHAB?
yes, it works fine by using this piece of code
<div class="widget" ng-click="sendCmd('TV', 'TVOnOff')">
<div class="icon off" ><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/matrixicons.svg#off"></use></svg></div>
<div class="name">Power</div>
</div>
You must have got at least messages like this
==> /var/log/openhab2/openhab.log <==
2018-07-13 13:31:18.690 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'tmp.rules'
==> /var/log/openhab2/events.log <==
2018-07-13 13:31:34.819 [ome.event.ItemCommandEvent] - Item 'TVProxyFTA' received command OFF
2018-07-13 13:31:34.839 [vent.ItemStateChangedEvent] - TVProxyFTA changed from ON to OFF
2018-07-13 13:31:37.193 [ome.event.ItemCommandEvent] - Item 'TVProxyFTA' received command ON
2018-07-13 13:31:37.210 [vent.ItemStateChangedEvent] - TVProxyFTA changed from OFF to ON