Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send commands #5

Open
brendandebeasi opened this issue Sep 1, 2014 · 1 comment
Open

How to send commands #5

brendandebeasi opened this issue Sep 1, 2014 · 1 comment

Comments

@brendandebeasi
Copy link

I have tried to follow the protocol docs for sending a command, but am having difficulty figuring out where to add the "{"type":"IRCommand","deviceId":"13154865","command":"PowerOff"}:status=press".
Any help would be appreciated.
Right now I have:

iq_cmd = self.Iq()
        iq_cmd['type'] = 'get'
        action_cmd = ET.Element('oa')
        action_cmd.attrib['xmlns'] = 'connect.logitech.com'
        action_cmd.attrib['mime'] = (
            'vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction')
        action_cmd.attrib['action'] = '{"type":"IRCommand","deviceId":"13154865","command":"PowerOff"}:status=press'
        iq_cmd.set_payload(action_cmd)
        result = iq_cmd.send(block=True)
        payload = result.get_payload()
        assert len(payload) == 1
        action_cmd = payload[0]
        assert action_cmd.attrib['errorcode'] == '200'
        response = action_cmd.text
        return json.loads(response)
@ftz
Copy link

ftz commented Oct 16, 2014

I´m trying to accomplish the same, but i also have trouble to get it to work :-(
iq_cmd = self.Iq()
iq_cmd['type'] = 'get'
action_cmd = ET.Element('oa')
action_cmd.attrib['xmlns'] = 'connect.logitech.com'
action_cmd.attrib['mime'] = ('vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction')
cmd = '{"type"::"IRCommand","deviceId"::"21569835","command"::"VolumeUp"}:status=press'
action_cmd.text = cmd
iq_cmd.set_payload(action_cmd)
pprint.pprint (iq_cmd)

"action={"type"::"IRCommand","deviceId"::"21569835","command"::"VolumeUp"}:status=press"

Any idea?
THX

siam28 pushed a commit to siam28/pyharmony that referenced this issue Apr 2, 2017
Always return a value from client.turn_off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants