I have the following rule: rule "radio on" when Item Radio changed from OFF to ON then sendCommand(philips_power, ON) sendCommand(philips, PLAY) sendCommand(stereo, ON)
end
It’s works.
I want to add an action by sending a command to my harmony hub. I made an activity in the app namend “Radio”
What do i add to send the command.
i’m totally lost
harmonyhub:hub:HarmonyHub2:activityStarting Radio ?
maybe you are wrong way?
I don’t work with any items, therefore I don’t have any thing files. I just request the state of the currentActivity at the Harmony hub. Based on the state, I created a rule.
I have defined different activities at the Harmony Hub i.e. Radio.
If I call Radio from the Harmony Remote, the Harmony Hub starts my Receiver (it is that old, it does not have a LAN connection to integrated it into openhab directly) and switch it to Tuner. In addition, openhab switch a plug on which enables a bluetooth device for further operations.
rule "Starting Radio"
when
Item harmony changed from OFF to ON
then
sendCommand(Harmonyhub2Activity, Radio)
end
when pressing the switch to change (fake) switch harmony from off to on the log says:
Rule 'Starting Radio': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,org.eclipse.smarthome.core.types.Command) on instance: null
Herewith another example, how I use Alexa (in your case a switch, etc.) to switch on the stereo:
rule "Alexa schaltet Stereoanlage ein"
when
Item EG_wz_alexa_radio changed to ON or
Item Echo_Living_Room_Player changed to PLAY
then
logInfo("Info", "Alexa schaltet Stereoanlage ein rule Start")
harmonyhub_hub_Wohnzimmer.sendCommand('Radio')
logInfo("Info", "Alexa schaltet Stereoanlage ein rule Stop")
end
The rule calls the activity ‘Radio’ at my Harmony Hub.
I hope this helps
Oke, that does not do anything. By the way this is what exactly what i try to do. To get Alexa put on the radio.
So the 'first" rule is. When i say Alexa Radio on:
rule "radio on"
when
Item Radio changed from OFF to ON
then
sendCommand(philips_power, ON)
sendCommand(philips, PLAY)
sendCommand(stereo, ON)
end
It send a command to a tradfri plug to put power an the reciever (stereo ON, it send 2 commands to a squeezeplayer PLAY and ON.
The problem i tried to solve, the reciever is standard on cd and not on AUX. The Harmony so send a command to change the input.
So i made an activity called radio that changes the input.
When i press it on the android app, it does that (duh) ans i see in the openhab2 event log:
2020-10-05 14:51:14.124 [vent.ChannelTriggeredEvent] - harmonyhub:hub:HarmonyHub2:activityStarted triggered Radio
2020-10-05 14:51:14.140 [vent.ItemStateChangedEvent] - harmonyhub_hub_HarmonyHub2_currentActivity changed from PowerOff to Radio
So i can make (like you did) another rule, like this:
rule "Alexa schaltet Stereoanlage ein"
when
Item philips changed to PLAY
then
logInfo("Info", "Alexa schaltet Stereoanlage ein rule Start")
Harmonyhub2.sendCommand('Radio')
logInfo("Info", "Alexa schaltet Stereoanlage ein rule Stop")
end
I will give this a try
When starting the activity on my phone it says in my event log:
2020-10-06 08:28:49.471 [vent.ChannelTriggeredEvent] - harmonyhub:hub:HarmonyHub2:activityStarted triggered Radio
2020-10-06 08:28:49.492 [vent.ItemStateChangedEvent] - harmonyhub_hub_HarmonyHub2_currentActivity changed from PowerOff to Radio
So what is the rule for starting the same activity ?
you need an item „current activity“ in harmony thing.
then in the rule just use:
itemname.sendCommand(“Radio”)
OR:
you post your thing config and your items regarding harmony stuff.
otherwise it will be hard to help you here.
again, the docs should help. check the examples (thing, items, sitemap).
and is your harmony thing online in paperUI ?