Hi All,
I've started developing a plugin for the Onkyo receiver.
I'm basing my plugin on the Python script I've already developed and posted in this forum.
However, I'm hitting a bump.
The Onkyo receiver does not communicate using plain text, but eISCP frames.
These frames can contain for example bytes holding the value 0. As such, sending and receiving as strings is not an option.
The onMessage function, actually returns a byte array instead of a string, but the data stops as the first hit of a zero byte.
The send function, only seems to accepts strings, and hence, I've got the same issue here.
Is there another option to send and receive using the build in Domoticz functions? Otherwise I would need to implement using raw sockets, which is not a problem, but I will lose the event system which I think is very nice.
Might it be an option for a feature request, to accept byte arrays in the Domoticz.Send function?
The onMessage alreade returns the data in byte array format, but truncates this. I don't think it would be an issue for anyone using devices that communicate in strings, to return all received data as a byte array. At least, that will allow me to use the onMessage event.
Kind regards,
Jorg
Need Domoticz.Send and onMessage to handle byte arrays Topic is solved
Moderator: leecollings
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Need Domoticz.Send and onMessage to handle byte arrays
@jorgh,
The intention is to allow both onMessage and Send to work properly with bytes arrays.
I've been limited by the devices that I have on what I can test but if you have a device that needs it I'm happy to uplift it now, backwards compatibility will not be a problem.
If you build Domoticz from source you could switch to the Python-Plugins branch and I could push changes quickly otherwise updates will take a little longer to test.
The changes are quite small, I should be able to have something available in the next day or so.
The intention is to allow both onMessage and Send to work properly with bytes arrays.
I've been limited by the devices that I have on what I can test but if you have a device that needs it I'm happy to uplift it now, backwards compatibility will not be a problem.
If you build Domoticz from source you could switch to the Python-Plugins branch and I could push changes quickly otherwise updates will take a little longer to test.
The changes are quite small, I should be able to have something available in the next day or so.
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
- jorgh
- Posts: 124
- Joined: Friday 27 June 2014 23:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8224
- Location: Netherlands
- Contact:
Re: Need Domoticz.Send and onMessage to handle byte arrays
@Dnpwwo,
Well, that's great news to wake up to
It should not be an issue for me to compile from source. I'm running on a spare pi (yes a slow one) so building will take quite some time. But I'm happy to try.
One silly question, what do I have to change on the git command to pull the Python-Plugins branch? I guess this is the only difference with the procedure documented on the wiki to build from source.
Regards,
Jorg
Well, that's great news to wake up to

It should not be an issue for me to compile from source. I'm running on a spare pi (yes a slow one) so building will take quite some time. But I'm happy to try.
One silly question, what do I have to change on the git command to pull the Python-Plugins branch? I guess this is the only difference with the procedure documented on the wiki to build from source.
Regards,
Jorg
- jorgh
- Posts: 124
- Joined: Friday 27 June 2014 23:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8224
- Location: Netherlands
- Contact:
Re: Need Domoticz.Send and onMessage to handle byte arrays
Ok,
I'm currently compiling the Python-Plugins branch. So I should be up and running quickly after the code update. Any idea when I could expect the code to be updated?
Kind regards,
Jorg
I'm currently compiling the Python-Plugins branch. So I should be up and running quickly after the code update. Any idea when I could expect the code to be updated?
Kind regards,
Jorg
- Dnpwwo
- Posts: 820
- Joined: Sunday 23 March 2014 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Melbourne, Australia
- Contact:
Re: Need Domoticz.Send and onMessage to handle byte arrays
@jorgh,
Shouldn't be too long, already got sending working (with minimal testing)
Edit: Committed to branch with sending. If you turn on debugging you now get something like this:
Edit 2: Has issues compiling on Linux so hold off updating to this.
Shouldn't be too long, already got sending working (with minimal testing)
Edit: Committed to branch with sending. If you turn on debugging you now get something like this:
Code: Select all
2017-03-04 18:16:58.609 (Test Kodi) Transport set to: 'TCP/IP', 192.168.0.247:9090.
2017-03-04 18:16:58.609 (Test Kodi) Protocol set to: 'JSON'.
2017-03-04 18:16:58.609 (Test Kodi) Heartbeat interval set to: 10.
2017-03-04 18:16:58.610 PluginSystem: Starting I/O service thread.
2017-03-04 18:16:58.610 (Test Kodi) Connect directive received, transport connect initiated successfully.
2017-03-04 18:16:58.661 (Test Kodi) Calling message handler 'onConnect'.
2017-03-04 18:16:58.661 (Test Kodi) Connected successfully to: 192.168.0.247:9090
2017-03-04 18:16:58.661 (Test Kodi) Sending 127 bytes of data:.
2017-03-04 18:16:58.661 (Test Kodi) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2017-03-04 18:16:58.662 (Test Kodi) 74 68 6f 64 22 3a 22 53 79 73 74 65 6d 2e 47 65 74 50 72 6f thod":"System.GetPro
2017-03-04 18:16:58.662 (Test Kodi) 70 65 72 74 69 65 73 22 2c 22 70 61 72 61 6d 73 22 3a 7b 22 perties","params":{"
2017-03-04 18:16:58.663 (Test Kodi) 70 72 6f 70 65 72 74 69 65 73 22 3a 5b 22 63 61 6e 68 69 62 properties":["canhib
2017-03-04 18:16:58.663 (Test Kodi) 65 72 6e 61 74 65 22 2c 22 63 61 6e 73 75 73 70 65 6e 64 22 ernate","cansuspend"
2017-03-04 18:16:58.663 (Test Kodi) 2c 22 63 61 6e 73 68 75 74 64 6f 77 6e 22 5d 7d 2c 22 69 64 ,"canshutdown"]},"id
2017-03-04 18:16:58.663 (Test Kodi) 22 3a 31 30 30 37 7d .. .. .. .. .. .. .. .. .. .. .. .. .. ":1007}
2017-03-04 18:16:58.664 (Test Kodi) Sending 107 bytes of data:.
2017-03-04 18:16:58.664 (Test Kodi) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2017-03-04 18:16:58.664 (Test Kodi) 74 68 6f 64 22 3a 22 41 70 70 6c 69 63 61 74 69 6f 6e 2e 47 thod":"Application.G
2017-03-04 18:16:58.664 (Test Kodi) 65 74 50 72 6f 70 65 72 74 69 65 73 22 2c 22 69 64 22 3a 31 etProperties","id":1
2017-03-04 18:16:58.664 (Test Kodi) 30 31 31 2c 22 70 61 72 61 6d 73 22 3a 7b 22 70 72 6f 70 65 011,"params":{"prope
2017-03-04 18:16:58.665 (Test Kodi) 72 74 69 65 73 22 3a 5b 22 76 6f 6c 75 6d 65 22 2c 22 6d 75 rties":["volume","mu
2017-03-04 18:16:58.665 (Test Kodi) 74 65 64 22 5d 7d 7d .. .. .. .. .. .. .. .. .. .. .. .. .. ted"]}}
2017-03-04 18:16:58.665 (Test Kodi) Sending 62 bytes of data:.
2017-03-04 18:16:58.665 (Test Kodi) 7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 2c 22 6d 65 {"jsonrpc":"2.0","me
2017-03-04 18:16:58.666 (Test Kodi) 74 68 6f 64 22 3a 22 50 6c 61 79 65 72 2e 47 65 74 41 63 74 thod":"Player.GetAct
2017-03-04 18:16:58.666 (Test Kodi) 69 76 65 50 6c 61 79 65 72 73 22 2c 22 69 64 22 3a 31 30 30 ivePlayers","id":100
2017-03-04 18:16:58.666 (Test Kodi) 31 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. 1}
2017-03-04 18:16:58.667 (Test Kodi) Calling message handler 'onMessage'.
2017-03-04 18:16:58.667 (Test Kodi) 1007 response received: {"id":1007,"jsonrpc":"2.0","result":{"canhibernate":false,"canshutdown":true,"cansuspend":false}}
2017-03-04 18:16:58.667 (Test Kodi) Kodi shutdown options response processed.
2017-03-04 18:16:58.667 (Test Kodi) Calling message handler 'onMessage'.
2017-03-04 18:16:58.668 (Test Kodi) 1011 response received: {"id":1011,"jsonrpc":"2.0","result":{"muted":false,"volume":100}}
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
- jorgh
- Posts: 124
- Joined: Friday 27 June 2014 23:19
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8224
- Location: Netherlands
- Contact:
Re: Need Domoticz.Send and onMessage to handle byte arrays
@Dnpwwo,
Ok, good to know there is progress. I've continued developing Python code in stand-alone scripts, so I should have something to share soon after the send and receive code is working.
Edit: I'ts working after the last commit. Thanks
Regards,
Jorg
Ok, good to know there is progress. I've continued developing Python code in stand-alone scripts, so I should have something to share soon after the send and receive code is working.
Edit: I'ts working after the last commit. Thanks
Regards,
Jorg
Who is online
Users browsing this forum: No registered users and 1 guest