What I’m trying to do now is to change the Power element node to either On or Standby but I’m confused on how to item state can be inserted in an element node. I created a switch channel and added the above XML payload in the statecontent and changed the Power element node entry to %2$s. I’m still confused if I need to do a command transformation and if so, how the compose the XPATH expression. So far, the logs says the POST statement is timing out.
I have tried the Yamaha binding over the years but it errors out. Several individuals requested support (1st Topic and 2nd topic for the YNC protocol but there has been no responses. I just tried it again before I responded and the binding recognizes the device but fails to initialize and list the appropriate channels.
2021-09-26 06:59:24.740 [INFO ] [openhab.event.InboxAddedEvent ] - Discovery Result with UID 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff' has been added.
2021-09-26 06:59:24.740 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff' to inbox.
2021-09-26 06:59:53.046 [INFO ] [openhab.event.InboxRemovedEvent ] - Discovery Result with UID 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff' has been removed.
2021-09-26 06:59:53.054 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff' changed from UNINITIALIZED to INITIALIZING
2021-09-26 06:59:53.057 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff' changed from INITIALIZING to OFFLINE (CONFIGURATION_PENDING): Waiting for connection with Yamaha device
2021-09-26 06:59:53.231 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler@1393d3bc': null
at org.openhab.binding.yamahareceiver.internal.protocol.xml.DeviceDescriptorXML.load(DeviceDescriptorXML.java:162) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.protocol.xml.DeviceInformationXML.update(DeviceInformationXML.java:100) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler.ensureConnectionInitialized(YamahaBridgeHandler.java:384) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler.onConnectionCreated(YamahaBridgeHandler.java:363) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.protocol.xml.XMLProtocolFactory.createConnection(XMLProtocolFactory.java:50) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler.initialize(YamahaBridgeHandler.java:352) ~[?:?]
2021-09-26 06:59:53.242 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff' changed from OFFLINE (CONFIGURATION_PENDING): Waiting for connection with Yamaha device to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
2021-09-26 06:59:53.242 [ERROR] [core.thing.internal.ThingManagerImpl] - Exception occurred while initializing handler of thing 'yamahareceiver:yamahaAV:5f9ec1b3_ed59_1900_4530_00a0de1b0fff': null
at org.openhab.binding.yamahareceiver.internal.protocol.xml.DeviceDescriptorXML.load(DeviceDescriptorXML.java:162) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.protocol.xml.DeviceInformationXML.update(DeviceInformationXML.java:100) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler.ensureConnectionInitialized(YamahaBridgeHandler.java:384) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler.onConnectionCreated(YamahaBridgeHandler.java:363) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.protocol.xml.XMLProtocolFactory.createConnection(XMLProtocolFactory.java:50) ~[?:?]
at org.openhab.binding.yamahareceiver.internal.handler.YamahaBridgeHandler.initialize(YamahaBridgeHandler.java:352) ~[?:?]
2021-09-26 07:01:31.612 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'YamahaReceiverCRXN560_Power' received command ON
2021-09-26 07:01:31.616 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'YamahaReceiverCRXN560_Power' predicted to become NULL
I’m replying to myself to add more details. In order to power the unit on and off, I used a switch channel and enter the entire xml payload to the onValue and offValue fields. It works but I still have an issue if I try to adjust the volume level or select an input source. This is why I’m trying to understand how to use the XPATH command transformation to change an entry in an element node.
channelTypeUID: http:switch
label: Set Power
description: ""
configuration:
onValue: <?xml version="1.0" encoding="utf-8"?><YAMAHA_AV
cmd="PUT"><System><Power_Control><Power>On</Power></Power_Control></System></YAMAHA_AV>
mode: WRITEONLY
offValue: <?xml version="1.0" encoding="utf-8"?><YAMAHA_AV
cmd="PUT"><System><Power_Control><Power>Standby</Power></Power_Control></System></YAMAHA_AV>