Code Monkey home page Code Monkey logo

sonyapilib's People

Contributors

jrodriguez142514 avatar kherron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sonyapilib's Issues

NuGet Package

Is Possible to make nuget package with support for .NET Core? Thanks!

Not a code issue per se, but shouldn't there be an easier way?

As I've not written any code since the Commodore 64, I'm a bit stumped with all this. Somehow, I am imagining it should be easier. That for a Bravia Android TV running YouTube, it should be possible to have a very small body of code that, when you add in the 'dfW4edfr03' or whatever is the name of the vid you want, and then POST it with the correct headers, it loads and runs the video you named. As an example, if I run the following code it starts the YouTube app:

{"method":"setActiveApp","params":[{"uri":"com.sony.dtv.com.google.android.youtube.tv.com.google.android.apps.youtube.tv.activity.TvGuideActivity"}],"id":10, "version":"1.0"}

IF I change the to uri to {"method":"setActiveApp","params":[{"uri":"com.sony.dtv.com.amazon.aiv.eu.com.amazon.ignition.IgnitionActivity"}],"id":10, "version":"1.0"}, it opens Amazon Videos.

Short and sweet. Sooo... there isn't a simple short program that will simply open the existing YouTube app and start a particular video?

Delay in execution

There is a long delay during the population of the _mySony object. Is there a way we can manually enter this information, and speed up this process.

Registration failed (KDL-52W5500)

I've just found this library, and am hoping that it would work on KDL-52W5500. However, it seems not based on the compatibility list and this message I'm getting. To start with, perhaps I've got the registration wrong. I can cast media from the laptop to the TV via DLNA. When I look into Settings / Network / Renderer Access Control, where I can see the MAC-address of the laptop listed as Permission=On. Is this the only registration, or is there any other?

`SonyAPILib v5.3 by: Kirk Herron
Starting Console Example Program

Searching for Devices...
Device Count: 1

0 - http://192.168.5.116:52323/dmr.xml

Enter the Device # to Test
0

http://192.168.5.116:52323/dmr.xml: Building Device....
BRAVIA KDL-52W5500: Checking Device Status....

Get Status returned: Error

BRAVIA KDL-52W5500: Performing Registration....
Before continuing, you may need to set the device to Registration Mode,
Confirm Registration or enter the Registration PIN code.
Go to the device and perfrom any step, and be ready before hitting enter below!

Hit any key to continue
Registration returned: False

There was an error

BRAVIA KDL-52W5500: Retrieving Remote Command List
ERROR Retrieving Command List

BRAVIA KDL-52W5500: Retrieving Command Value for: VolumeUp

Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at SonyAPILib.APILibrary.SonyDevice.GetCommandString(String CmdName) in \Ccsg\f\OSA Files\Sony API\SonyAPILib_5.4\SonyAPILib\SonyAPILib\sonyAPILib.cs:line 947
at ConsoleExample.Program.Main(String[] args) in \Ccsg\f\OSA Files\Sony API\SonyAPILib_5.4\ConsoleExample\Program.cs:line 286`

Forms "Discover All Button" Causes Unhandled Exception

When starting the forms application and clicking the Discover All Button, the application closes with an unhandled exception error. No devices are saved and application closes.

System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null.
Parameter name: source
Source=System.Core
StackTrace:
at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)
at Sony_Forms_Example.Form3.showDevice(SonyDevice cDev) in C:\Users*\Downloads\SonyAPILib-master\SonyAPILib-master\Sony_Forms_Example\Sony_Forms_Example\Form3.cs:line 49
at Sony_Forms_Example.Form3.Device_SelectedIndexChanged(Object sender, EventArgs e) in C:\Users*
\Downloads\SonyAPILib-master\SonyAPILib-master\Sony_Forms_Example\Sony_Forms_Example\Form3.cs:line 97
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
at Sony_Forms_Example.Form3.Form3_Load(Object sender, EventArgs e) in C:\Users****\Downloads\SonyAPILib-master\SonyAPILib-master\Sony_Forms_Example\Sony_Forms_Example\Form3.cs:line 1061
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Question - power IRCC not working on KDL-32CX523, other commands are ok

Hi,

Please close if this is unwanted but thought you may be able to help. Pretty please?

I've an old KDL-32CX523 and I can use most commands over IRCC commands, except for Power Off
Well, and Power on but I'm pretty sure the WOL doesn't work for that and not sure if IRCC works when in standby (?)

There's a bit more information from the xml here, which would seem to indicate I'm using the correct command.. https://community.openhab.org/t/sony-devices-binding/14052/422

Just wondered if you'd come across anything similar?

Many thanks for even looking at this and hope you'll forgive me asking but have been pulling my hair out and a bit out of my depth on this.

Create API Class Objects

Create a SonyDevice Class Object to contain all device information and methods.
Create a SonyCommands Class Object to contain all devices IRCC commands

More of a question. Didn't know where to post

I have full control of the TV using Amazon echo. Thanks to you for the method to authenticate my PC. My only issue is that when I issue a volume change, it works perfectly except for when I have a Sony sound bar on. The volume change affects the Home screen but this value is not passed to system volume or the sound bar. Seems to be a HDMI/ARC or CEC issue. Any way to pass this volume change?

?

.

sonyAPILib.cs - function HttpGet(string Url) - HttpWebRequest req.Host variable is set wrong

I am testing the SonyAPILib together with my Sony STR-DN1040 AV Receiver.

After I managed the registration process with the STR-DN1040, I was able to read the RemoteCommandList XML file.
But there is one bug in function HttpGet(string Url) in file sonyAPILib.cs: the port of the HttpWebRequest req.Host variable is set wrong. The port must be parsed from the Url string parameter and not from this.Device_Port.

The description.xml of the STR-DN1040 must be read via port 8080, the ActionList.xml and /cers/getRemoteCommandList must be read via port 50001.

I made following hack to read the STR-DN1040's command list:

//req.Host = this.Device_IP_Address + ":" + this.Device_Port;
req.Host = this.Device_IP_Address + ":50001";

I used buildFromDocument(string dDoc, string fPath) to generate my SonyDevice via your DLNA_Control_Panel GUI button "Build Device from Document".

SonyDevice.Commands not getting Populated

Currently the example application uses the getRemoteCommandList() to populate the sonyDevice.Commands list. This should automatically happen during the SonyDevice.Initialize() method.

Gen 3 already registered, but No cookie

It has come to attention that if your device was previously registered, but you no longer have the cookie, clicking Register on a Gen3 device, it will not display a PIN code to be entered. However, by clicking OK without entering a PIN will retrieve a new cookie and the device will operate.

This process needs to be cleaned up, and if the device has previously been registered, it should get the new cookie and move on without displaying the form to enter the PIN code.

callbacks possible?

have you encountered any way for adding callbacks[/event handlers/hooks/whatever you may call it] so you can react to certain events? i'm currently looking into this and saw you have quite some expertise in this area :)

Try to use with a UBP-X800

I hope this is a good place to post this.
I have a home automation system that controls many things, including a Sony Blu-ray player that uses ircc commands. I was trying out your library to see if I could use it and tried your ConsoleExample. It finds several "devices" at the correct IP address, however not always the same list. What happens is if I select a device, as far as I can tell, I cannot find anything on the UHD player as to how to register the device. It does have an item to view registered controllers. As an aside, many of the ircc commands that work on the older blu-ray player also work on the new one. If you have any suggestions on debugging this I will provide any feedback on my results. I am running your ConsoleExample under VS2015.
I do get responses back from the following (using a web browser):
http://192.168.1.13:64321/bdp-cx-ms.xml
http://192.168.1.13:50201/dial.xml
http://192.168.1.13:50202/appslist
http://192.168.1.13:50001/Ircc.xml
http://192.168.1.13:52323/dmr.xml
http://192.168.1.13:50002/actionList
http://192.168.1.13:50002/getSystemInformation

http://192.168.1.13:50002/actionList returns
HTTP/1.1 200 OK
Connection: close
Cache-Control: no-cache
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/xml
Date: Wed, 14 Jun 2017 18:32:56 GMT
Server: Linux/3.10 Sony-BDP/2.0

2C9

Thanks

2011 AV Amp STR-DN1030

I am experimenting with my Sony TV and Amp - both from around 2011.
I have the TV working - using the ConsoleExample.exe to check things out.
However, the Amp is not getting through the registration phase with ConsoleExample.exe

I don't have the tools to build from source - but my intention, once I get things working, is to merge some equivalent functions back into some Python code that, today, only handles newer generation devices.

The Amp is on the list as supported - STR-DN1030 is a "mode 1" device for registration.
...:50001/cers/ActionList.xml
contains

<actionList>
<action name="register" mode="1" url="http://192.168.2.140:50001/cers/register"/>
<action name="getSystemInformation" url="http://192.168.2.140:50001/cers/getSystemInformation"/>
<action name="getRemoteCommandList" url="http://192.168.2.140:50001/cers/getRemoteCommandList"/>
<action name="getStatus" url="http://192.168.2.140:50001/cers/getStatus"/>
<action name="getText" url="http://192.168.2.140:50001/cers/getText"/>
<action name="sendText" url="http://192.168.2.140:50001/cers/sendText"/>
</actionList>

To try to understand what needs to be sent and checked for, I was looking in sonyAPILib.cs and saw this


                if (this.Actionlist.RegisterMode == 1)
                {
                    reg = HttpGet(this.Actionlist.RegisterUrl + "?" + args1);
                    _Log.AddMessage("Register Mode: 2 Sony Device", false);
                }
                else if (this.Actionlist.RegisterMode == 2)
                {
                    reg = HttpGet(this.Actionlist.RegisterUrl + "?" + args2);
                    _Log.AddMessage("Register Mode: 1 Sony Device", false);
                }

I am sure it is correct as you have said that you have an old Amp as well - but the log entries appear to be the wrong way around (if mode==1 then log as "2" )

In the Amp I have a menu item for access control - including the ability to have "auto" enabled or not - I have tried both ways.
I have had a new id appear under the list of devices with access - although the id is not very meaningful (I cannot use it to determine what the other 3 control devices are).

Is there an API call to access the list of accepted control devices and perhaps get more details about them?

The Amp info is at ...:8080/description.xml
and contains - among other stuff...

<device>
<av:X_UNR_DeviceInfo xmlns:av="urn:schemas-sony-com:av">
<av:X_UNR_Version>1.2</av:X_UNR_Version>
<av:X_CERS_ActionList_URL>http://192.168.2.140:50001/cers/ActionList.xml</av:X_CERS_ActionList_URL>
<av:X_Remote_Type>RM-AAP078</av:X_Remote_Type>
<av:X_Remote_Type>RM-AAP079</av:X_Remote_Type>
</av:X_UNR_DeviceInfo>
</device>

and ...:50001/cers/ActionList.xml contains

<actionList>
<action name="register" mode="1" url="http://192.168.2.140:50001/cers/register"/>
<action name="getSystemInformation" url="http://192.168.2.140:50001/cers/getSystemInformation"/>
<action name="getRemoteCommandList" url="http://192.168.2.140:50001/cers/getRemoteCommandList"/>
<action name="getStatus" url="http://192.168.2.140:50001/cers/getStatus"/>
<action name="getText" url="http://192.168.2.140:50001/cers/getText"/>
<action name="sendText" url="http://192.168.2.140:50001/cers/sendText"/>
</actionList>

and
and

<device>
<servicelist>
<service>
<serviceType>urn:schemas-sony-com:service:IRCC:1</serviceType>
<serviceId>urn:schemas-sony-com:serviceId:IRCC</serviceId>
<SCPDURL>/IRCCSCPD.xml</SCPDURL>
<controlURL>/upnp/control/IRCC</controlURL>
<eventSubURL>/</eventSubURL>
</service>
</serviceList>
</device>

_mySony object is not getting populated

The _mySony object is not getting populated during creation.

Current Work-Arround: Run sonyDiscovery to populate like this:
List<SonyAPI_Lib.SonyDevice> fDev = mySonyLib.API.sonyDiscover(null);

Unhandled device/BRAVIA KDL-46X4500

Hi ...

I'm encountering a bug when using the Console Example Program. Is it because of a unsupported device?

See the following:

...

Enter the Device # to Test
26

http://192.168.1.4:52323/mr.xml: Building Device....
BRAVIA KDL-46X4500 : Checking Device Status....

Get Status returned: Error

BRAVIA KDL-46X4500 : Performing Registration....
Before continuing, you may need to set the device to Registration Mode,
Confirm Registration or enter the Registration PIN code.
Go to the device and perfrom any step, and be ready before hitting enter below!

Hit any key to continue

Registration returned: False

There was an error

BRAVIA KDL-46X4500 : Retrieving Remote Command List
ERROR Retrieving Command List

BRAVIA KDL-46X4500 : Retrieving Command Value for: VolumeUp

Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) [0x00010] in <63992662b765477a898ef49cdcc99ee2>:0
at SonyAPILib.APILibrary+SonyDevice.GetCommandString (System.String CmdName) [0x00036] in :0
at ConsoleExample.Program.Main (System.String[] args) [0x004cf] in <976d2998bd1746d8ac37016f02463cc0>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) [0x00010] in <63992662b765477a898ef49cdcc99ee2>:0
at SonyAPILib.APILibrary+SonyDevice.GetCommandString (System.String CmdName) [0x00036] in :0
at ConsoleExample.Program.Main (System.String[] args) [0x004cf] in <976d2998bd1746d8ac37016f02463cc0>:0

WOL function needs added

It has been brought to my attention that i have missed added in the WOL function to this API. Only Gen3 devices have this function.

This will need to be added to 5.2 and 5.1 as well.

Gen 3 Cookie Expires

It was reported that the stored cookie for generation 3 devices will expire. Currently the work-around is to remove the controlling device from the Sony devices registration, then re-Run the registration to get a new cookie.

Need to make API look at existing cookie, if expired, get new cookie from device and store new cookie for use.

Can't find TV

I have a Bravia XBR-55X930D that I can't seem to find on my Network. I've had similar problems with the network and have tried turning off firewalls, DMZ etc. with no luck. Apps can see the TV though.

When I run SonyAPILib, it doesn't find any devices. I'm new to Json but was wondering if there is a way with the API to send the request to a particular IP?

Any suggestions welcome for my problem.

How to use this project?

I have a Sony NAS-SV20i that exposes the ircc commands and I was hoping to be able to control it.

I have been unable to find any premade CLI or GUI application to just input the IP and send the commands.

This project has been the closest thing but I have no idea how to make use of it.

Service Methods

Looking for input from all users of this API

Currently all service methods of the devices are actually in the API class and not the devices class.

For example, to send a command to your device with the current API structure, you would do something like this:
string results = mySonyLib.Ircc.SendIRCC(mySonyDevice,irccCmd);
However, this leaves it a bit confusing, because it seems it should be a part of the device.

So, the question is, should I change it to be like this?
string results = mySonyDevice.Ircc.SendIRCC(mySonyDevice,irccCmd);

A little redundant, but seems to make more sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.