GC100 Sent Serial HEX command to Sony amplifier using a rule

Hello,

I’m new to openhab and i installed it on a Pi3.
Added Sonos and GC100, the purpose it to turn the Sony Amp on, on a specified volume when I press Play on the sonos connect.
I’m sur the command is correct, but not sure how to write it (with “,”, with quotes, or spaces, …)

Here is the code created by the rule designer.

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: SonosConnectAmpCuisine_MediaControl
      state: ON
      previousState: OFF
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: GlobalCacheGC10012_Slm2_C1direct
      command: '"0x02,0x04,0xa0,0x42,0x00,0x02,0x18"'
    type: core.ItemCommandAction

You might tell us more about this Item. What type is it? Is it linked to some channel of some Thing of some binding?

Does the rule run, have you seen the command event in your events.log? Or a problem reported in your openhab.log?

It is the serial output of the Global Caché GC100-12
I added the Global Caché pluging that created the thing and items.
This is the item for serial output 2

The log says:

2022-12-09 16:12:45.233 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘GlobalCacheGC10012_Slm2_C1direct’ received command “0x02,0x04,0xa0,0x42,0x00,0x02,0x18”
2022-12-09 16:12:45.236 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘GlobalCacheGC10012_Slm2_C1direct’ predicted to become “0x02,0x04,0xa0,0x42,0x00,0x02,0x18”

Si it seems it fires the command, in facht i think it is just a syntax problem.

I keep looking andtrying, trial and error…
i downloaded the iTest app and this works, so, i keep thinking it is just a matter of syntax in OH.
Tried different syntaxes but no luck.

0x02,0x04,0xa0,0x60,0x00,0x01,0xfb,0x03
0x020x040xa00x600x000x010xfb0x03
0x02 0x04 0xa0 0x60 0x00 0x01 0xfb 0x03
02 04 a0 60 00 01 fb 03
0204a0600001fb03
02%04%a0%60%00%01%fb%03

Tried variations with “”, (), both, also without the 03 wich is a carriage return i think.

Looking at the docs, and guessing this is a “cl-direct” type channel from the Item name …

That looks to be the closest, although a leading % is missing?

I wonder though if you might need to escape the % characters in the GUI, not sure if that would be %% or /%

OMG that was it i forgot the % at the begin of the string!!!

Ok so i’m making progress, next problem, i need to introduce timer between 2 and 3 : 500ms
and between 3 and 4: 200ms

Can’t find how to do it in the UI. but maybe in the code?

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: SonosConnectSalon_MediaControl
      state: PLAY
      previousState: UNDEF
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      itemName: GlobalCacheGC10012_Slm1_C1direct
      command: "%02%04%a0%60%00%01%fb"
    type: core.ItemCommandAction
  - inputs: {}
    id: "3"
    configuration:
      itemName: GlobalCacheGC10012_Slm1_C1direct
      command: "%02%04%a0%42%x00%02%x18"
    type: core.ItemCommandAction
  - inputs: {}
    id: "4"
    configuration:
      itemName: GlobalCacheGC10012_Slm1_C1direct
      command: "%02%06%a0%52%00%01%ff%fe%0a"
    type: core.ItemCommandAction

Then you need to add a script section to your rule (the built-in UI actions are by design very limited and simple).
You’ve got a choice of rule languages for that - if a beginner, you might use Blockly.

Wel i started using Blockly, it seems easy and handy. The basics works!

I’m trying to bluid a logic that if i stop playing on sonos OH sends the command in 30 min if there has ben no other request to play in those 30 min.

Not there yet, any tips welcome.

Thanks for your help.

Still learning, tried this, but does not work :face_with_raised_eyebrow:

It should cancel the timer if this happens:

2022-12-10 20:54:22.160 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SonosConnectSalon_MediaControl' changed from UNDEF to PLAY

This doesn’t have much to do with serial commands and Sony amps.
You’d be wise to start a new thread about using timers in Blockly rules.

You are right sorry got taken in the heat of the progress…

So this topic is closed, yo found the problem.

Thank you

You can actually mark your problem “solved” if you wish.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.