Code Monkey home page Code Monkey logo

braviarc's Introduction

Hi there 👋

I'm a passionate programming motherfucker, specialised on Internet full-stack and dev-sec-ops. I love blockchain, web 3, micro-services architectures, single-page applications, mobile apps, continuous delivery, IoT, games development, and ... everything else!

I created long long time ago (more than 15 years ago) my own framework for rapid web development of PHP applications (https://github.com/antonioparraga/phal) porting most of the patterns from other non-PHP frameworks such as Spring-style Dependency Injection and Webflows. I also love IoT and I have submitted a few contribs to Home Assistant Project (https://home-assistant.io). I also cofounded and collaborated actively on Open Coronavirus project (https://github.com/open-coronavirus/open-coronavirus), a contact tracing app for iOS and Android.

Check my complete bio at Linked in

... btw, I usually publish some of my thoughts at my own Youtube channel and my website Solo Programadores, don't doubt to visit it (and subscribe!)

braviarc's People

Contributors

alexandre-leites avatar antonioparraga avatar azuwis avatar dnschneid avatar laf avatar napyk avatar ngraziano avatar qdel avatar rayrayndwiga avatar robbiet480 avatar schmittx avatar scottrfrancis avatar temeteke avatar ttroy50 avatar ttu 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  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

braviarc's Issues

Exception 40005

Hey, my Bravia returns error 40005 sometimes. I want to know what request is being done while this happens.
Any ideas ?

JSON request error:{
"error": [
40005,
"Display Is Turned off"
],
"id": 1
}

Edit: I'm using home assistant,wl which uses this software

Can't send commands to the TV

This module is amazing!

Maybe it is just me who messes something up, but for some reason I can't get the command to work with my TV. May I ask for an example for how a request should work?

Control ARC device volum?

Hi,

This is a really weird one. I have a Bravia tv and have recently purchased a not-so-smart soundbar. It is hooked up via HDMI ARC. This passes through vol-up/vol-down commands to the soundbar from the tv remote.

I think it makes sense even that this isn't controllable via the default api/control, but I'm wondering if you know -- is there an API to maybe manipulate the ARC volume? It seems like the TV doesn't read the volume level out of arc device (not sure if that's even possible) but maybe there's still a way to remotely volume up/down as if it were the remote pointed at the TV?

Support analog inputs (component/composite)

Currently load_source_list seems to ignore component and composite inputs, and only returns HDMI and TV inputs. It would be useful if the analog inputs were included as well.

Connection Refused

Hi,

i'm trying to connect to my Sony Bravia TV 32wd753b but when i try i get "Connection refused" error.
I have a doubt regarding the two parameters passed to "connect" function
I am calling the connect function in the following way:

pin = "1879"
braviarc.connect(pin, 'my_device_id', 'my device name')

My questions are:

  1. should i change the PIN from 1879 to another value?
  2. "my_device_id" what does it means?

Thanks

Struggling with SONY BRAVIA KD43XE8077SU

Using the latest version of BraviaRC on Home-Assistant (Hassio) version 0.55.2

Description of problem:
I am struggling to configure my TV above with Home-Assistant. Here is what I tried (and what happened):

added the “platform: braviatv” with the correct host IP; no bravia.conf file. Rebooted everything. The configuration module appears, enter 0000, a pin then appears on my TV, which I then enter in HA - the TV then says “configuration cancelled” and nothing else happens… note: I had removed all prior associated devices on the TV;
as above but created a bravia.conf with the right host, pin, mac (quick question: the pin is the pre-shared pin? and the mac is the tv mac, right? that is what I have assumed anyway). Now two things happen after I reboot everything:
2.1) if the TV is off whilst HA is rebooting: I see a Sony Bravia TV module and can see the on/off state, but none of the controls work;
2.2) if the TV is on whilst HA is rebooting: I cannot see a module in HA and the TV presents me with a pin to enter every 30 seconds or so (the prompt only stays on for 10 seconds or so), I have no configuration modules etc…
In terms of config, everything is up to date etc…

Basically, I am stumped, don’t really know what else to try, so any help is appreciated!

Expected:
Configuration panel shows, enter 0000, pin is displayed on TV, enter the pin from the TV in the panel, TV added as a component.

Problem-relevant configuration.yaml entries and steps to reproduce:

media_player:

  • platform: braviatv
    host: 192.168.1.234
    Click on configure in the Bravia configuration panel
    Enter 0000, Click confirm, a pin is displayed on the TV
    Enter the pin from the TV in the panel, press 'Confirm' - TV says 'configuration cancelled', panel says wrong pin

setAudioVolume as a string

Hi,

I just find out that the volume should be set as a string not as int.
I also tested with a string and the set works fine...

"If you look at the setAudioVolume method definition in the audio.getMethodTypes() response:

["setAudioVolume", [{
	"target": "string",
	"volume": "string"
}], ["int"], "1.0"]

The volume needs to be given as a string and not as an integer."

waynehaffenden/bravia#3

KD-49XD7005

Hey guys,

I have been trying to use the braviarc lib to control my Sony Bravia KD-49XD7005 Tv without any success.

I obnly get this error whenever I try to connect :

from braviarc.braviarc import BraviaRC
braviarc = BraviaRC('192.168.*.*')
pin = '0000'
braviarc.connect(pin, 'Tv_salon', 'Tv salon')
[W] HTTPError: 404 Client Error: Not Found for url: http://192.168.1.11/sony/accessControl

What am I doing wrong ??

Sony Bravia KD-43X8307C

Hi,

Firstly thank you for the excellent library. I'm making use of it within home-assistant.io at present but I am seeing an issue which I've tracked down to the TV not responding to:

getPlayingContentInfo

I get the following when I debug

{'id': 1, 'error': [7, 'Illegal State']}

I've tested this by utilising your library directly and can't get this function to work.

As I'm mainly only interested in the status of the TV, I did add the following:

    def get_power_status(self):
        """Get power status."""
        return_value = {}
        resp = self.bravia_req_json("sony/system", self._jdata_build("getPowerStatus", None))
        if resp is not None and not resp.get('error'):
            power_data = resp.get('result')[0]
            return_value['status'] = power_data.get('status')
        return return_value

This will return:

{'status': 'active'}
{'status': 'standby'}

Is it worth me doing a pull request for this or am I doing something wrong in the first place causing the original library not to work.

Thanks in advance.

Bravia recordings

Hi, I was very glad i found the library because I've tried to implement the same functionality to communicate with my Bravia from a microcontroller by sniffing the protocol between the tv and android application. Now I can use my Raspberry Pi 3 instead but I am very new to Python.

One goal is to add recording time since the tv doesn't include this feature and often I miss the end of a recording if the show is delayed by a fem minutes. This is implemented by reading the recording list and if the program title doesn't include an asterisk/*, the recording in deleted, five minutes are added to the duration time and recording is added to the list again but now with an asterisk in its title so the script wont add another five minutes next time. I also check if there are a recording following and in this case I don't add time, just an asterisk to the title. Three new functions has been added, but I don't have the knowledge yet to handle the error control:

def get_recordings(self):
"""Returns list of recordings - Max 100"""
original_content_list = []
content_index = 0
while True:
resp = self.bravia_req_json("sony/recording",
self._jdata_build("getScheduleList", {"cnt":100,"stIdx":0}))
if not resp.get('error'):
if len(resp.get('result')[0]) == 0:
break
original_content_list.extend(resp.get('result')[0])
else:
break
break
return original_content_list

def add_schedule(self,datarow):
"""Add a recording to the list"""
original_content_list = []
content_index = 0
while True:
# ["addSchedule",["{"type":"string","uri":"string","title":"string","startDateTime":"string","durationSec":"int","repeatType":"string","quality":"string"}"],["{"annotation":"int"}"],"1.0"],

    resp = self.bravia_req_json("sony/recording",
                                self._jdata_build("addSchedule", datarow))
    if not resp.get('error'):
        if len(resp.get('result')[0]) == 0:
            break
        original_content_list.extend(resp.get('result')[0])
    else:
        break
    break
return original_content_list

def delete_schedule(self, datarow):
"""Delete a scheduled recording"""
while True:
#["deleteSchedule",["{"id":"string","type":"string","uri":"string","title":"string","startDateTime":"string","durationSec":"int"}"],[],"1.0"],

    resp = self.bravia_req_json("sony/recording",
                                self._jdata_build("deleteSchedule", datarow))
    break
return 

To add the time, I use the demo code to connect to the tv:

# Get the recordings
tv_rec = braviarc.get_recordings()

# Go through all entries
for line in tv_rec:	
  # Check entries without asterisk
  if line['title'].find('*') < 0 :
       # Edit the start time format so a datetime variable can be used
       Date1 = line['startDateTime'].split('+')
       Date = datetime.strptime(Date1[0], "20%y-%m-%dT%H:%M:%S")
       print("Start:",Date)
       Date = Date + timedelta(seconds=line['durationSec'])
       print("End:",Date.strftime("20%y-%m-%dT%H:%M:%S+0200"))
       # Ensure there aren't a recording following this one
       found = 0
       for line2 in tv_rec:	
          if line2['startDateTime'] == Date.strftime("20%y-%m-%dT%H:%M:%S+0200") :
            print("Collision")
            found = 1
       # Unless the recording has been started - edit the entry     
       if line['recordingStatus'] == 'notStarted' :
         # Delete the entry
         braviarc.delete_schedule(line)
         # Don't add any time if there are a recording following this one
         if found == 0 :
           line.update({'durationSec':(300+line['durationSec'])})
         # Update the title 
         line.update({'title': line['title']+'*'})
         # Add the recording to the list again
         braviarc.add_schedule(line)

Issue pairing with Brava TV (XBR850C & XBR830C)

Greetings,

I'm not sure if this is the correct venue for this, but I'm having issues pairing my TVs with the braviarc HomeAssistant implementation.

I tried using the HA configurator as directed, but after I enter 0000, the TV flashes a code momentarily and then says the pair was cancelled. HA immediately adds the TV without ever prompting for the code and then the TV shows up as a media player card, however it doesn't do anything or update status (obviously the pair didn't complete successfully.) I've deleted the bravia.conf in the hass root directory and tried to repair multiple times with the same result.

Also, every time I reboot HA, the TVs display the pairing request dialog from HA, but HA never gives me the option to enter a code.

I have two Bravia XBRs, 850C & 830C, same result with both.

Any advice?

Limit of 50 sources

getContentList only returns 50 items. We need to loop the request using cnt and stIdx parameters to get the next batch and so on until last one is returned.

Is possible to send to Bravia a command for open a youtube video/url?

Hi mates, please excuse me to open an issue to ask a question, I hope you may help to clear my problem, the way to open Youtube app is welle discussed and supported, but what is the sense to open app without play a video? I don't understand there is any documentation about passing Youtube some parameters, my goal is to create with Node Red scenarios where TV is used, for example showing a fireplace.
If it's not supported, any other way/trick to achive that? Maybe creating a shortcut on the home containing the url too?

In all the documentation I read I've found this that may sound interesting somehow..
Thank you for your suppport!

REST-API HTTP Request Example (Pre-Shared Key: “1234”)

POST /sony/system HTTP/1.1
Host: 192.168.0.1
Accept: */*
Cache-Control: no-cache
Connection: close
Content-Type: application/json; charset=UTF-8
Pragma: no-cache
X-Auth-PSK: 1234
Content-Length: 70

{"method": "getPowerStatus", "params": [], "id": 50, "version": "1.0"}

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.