LUA script for Sony Bravia TV
Moderator: leecollings
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
The script_time_tvstatus.lua is time script which you seem to use as a device script, as your first post says script_device_tv.lua. Check the wiki for the differences and how to use it.
Not using Domoticz anymore
-
- Posts: 26
- Joined: Monday 15 July 2013 8:17
- Target OS: Linux
- Domoticz version: Beta
- Location: Drenthe
- Contact:
Re: LUA script for Sony Bravia TV
I understand the difference and I use both scripts with the correct name. They work ok, it just logs an error:
and
Code: Select all
2016-06-08 20:48:00.485 LUA: TV ping success
2016-06-08 20:48:00.528 LUA: TV says it is standby
2016-06-08 20:48:00.528 LUA: TV standby, status is OFF, so do nothing.
Code: Select all
2016-06-08 20:48:01.088 Error: EventSystem: Lua script /home/user/domoticz/scripts/lua/script_device_tv.lua did not return a commandArray
-
- Posts: 53
- Joined: Wednesday 16 December 2015 15:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.6792
- Location: Landgraaf, The Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
I got the Power Management working on my Sony tv as well.
Thanks!
Thanks!
Raspberry Pi ~ Fibaro Dimmer (Z-Wave) ~ Several KAKU switches and dimmers (433 MHz) ~ Amazon Echo ~ Somfy RTS ~ Sony TV ~ Kodi/XBMC ~ Essent E-Thermostaat (ICY) ~ Cresta thermostat ~ Wundermap Weather ~ Smoke detectors
-
- Posts: 53
- Joined: Wednesday 16 December 2015 15:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.6792
- Location: Landgraaf, The Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
Still very happy with the current integration!
Any clue if volume control will also be an option?
Any clue if volume control will also be an option?
Raspberry Pi ~ Fibaro Dimmer (Z-Wave) ~ Several KAKU switches and dimmers (433 MHz) ~ Amazon Echo ~ Somfy RTS ~ Sony TV ~ Kodi/XBMC ~ Essent E-Thermostaat (ICY) ~ Cresta thermostat ~ Wundermap Weather ~ Smoke detectors
-
- Posts: 94
- Joined: Monday 30 November 2015 16:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: LUA script for Sony Bravia TV
I have the status script working,
but how can I switch it off/on or use the TV in blockly's?
but how can I switch it off/on or use the TV in blockly's?
-
- Posts: 39
- Joined: Friday 12 December 2014 13:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.9639
- Location: Spain
- Contact:
Re: LUA script for Sony Bravia TV
So after all the changes, the script_device_tv.lua should look like this:
Nice work, guys! Thank you.
Code: Select all
commandArray = {}
if(devicechanged['TV']) then
if (devicechanged['TV'] == 'On') then
if(uservariables['TVOnlyStatusUpdate'] == 1) then
print('TV status update received (ON), resetting user variable.')
commandArray['Variable:TVOnlyStatusUpdate'] = '0'
else
runcommand = '/home/pi/domoticz/scripts/tvremote.sh PowerOn'
os.execute(runcommand)
print('TV got wake up call')
end
end
if (devicechanged['TV'] == 'Off') then
if(uservariables['TVOnlyStatusUpdate'] == 1) then
print('TV status update received (OFF), resetting user variable.')
commandArray['Variable:TVOnlyStatusUpdate'] = '0'
else
runcommand = '/home/pi/domoticz/scripts/tvremote.sh PowerOff'
response = os.execute(runcommand)
if response then
print('TV goes sleepy sleep')
else
print('TV not in the mood for sleepy sleep')
end
end
end
end
return commandArray
Re: LUA script for Sony Bravia TV
Thanks guys! Script is working great!
-
- Posts: 7
- Joined: Wednesday 05 October 2016 16:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: LUA script for Sony Bravia TV
Prerequisites:
1: script_time_tvstatus.lua
For starters i new to domoticz so bare with me. What i want start with is to get a indication if the tv is on or not, i have a sony bravia KDL55HX 823, and i cant set pre-sharedkey neither do i have the ipconfig menu. But in my network i can access and ping the ip for the tv so i think i can get a indication if its on or off. But how should the cript look like'? And how do i use this script? I have followed the steps above but cant get it to work.
EDIT: I have fixed if i ping i get a status that its on and off when i shut down the wifi on the tv. But the standby function.. how do i get this to work?
- Create a virtual switch (On/Off) named "TV"
- Create a user variable (integer) named "TVOnlyStatusUpdate", with value 0
- Install etherwake (sudo apt-get install etherwake)
- Enable remote start on your TV: [Settings] → [Network] → [Home Network Setup] → [Remote Start] → [On]
- Enable pre-shared key on your TV: [Settings] → [Network] → [Home Network Setup] → [IP Control] → [Authentication] → [Normal and Pre-Shared Key]
- Set pre-shared key on your TV: [Settings] → [Network] → [Home Network Setup] → [IP Control] → [Pre-Shared Key] → [sony]
- Give your TV a static IP address, or make a DHCP reservation for a specific IP address in your router.
- Determine the MAC address of your TV: [Settings] → [Network] → [Network Setup] → [View Network Status]
1: script_time_tvstatus.lua
Code: Select all
function getPowerStatus()
local url = 'http://10.101.0.50/sony/system'
local headername = 'X-Auth-PSK'
local headervalue = 'sony'
local jsonbodygetstatus = '{\\"id\\":2,\\"method\\":\\"getPowerStatus\\",\\"version\\":\\"1.0\\",\\"params\\":[]}'
local runcommand = 'curl -v -H \"Content-Type:application/json\" -H \"' .. headername .. ':' .. headervalue .. '\" -d \"' .. jsonbodygetstatus .. '\" ' .. url .. ''
local h=io.popen(runcommand)
local response=h:read("*a")
h:close()
if string.find(response, '{"status":"active"}') then
return 'active'
elseif string.find(response, '{"status":"standby"}') then
return 'standby'
else
return 'unkown'
end
end
commandArray = {}
ping_success=os.execute('ping -c1 10.101.0.50')
if (ping_success) then
print('TV ping success')
powerstatus=getPowerStatus()
print('TV says it is ' .. powerstatus)
if(powerstatus == 'active') then
if(otherdevices['TV'] == 'Off') then
print('TV active, but status is OFF, so update to ON.')
commandArray['Variable:TVOnlyStatusUpdate'] = '1'
commandArray['TV'] = 'On'
else
print('TV active, status is ON, so do nothing.')
end
elseif(powerstatus == 'standby') then
if(otherdevices['TV'] == 'On') then
print('TV standby, but status is ON, so update to OFF.')
commandArray['Variable:TVOnlyStatusUpdate'] = '1'
commandArray['TV'] = 'Off'
else
print('TV standby, status is OFF, so do nothing.')
end
else
print('TV in unknown power status, doing nothing...')
end
else
print("TV ping fail")
if(otherdevices['TV'] == 'On') then
print('TV current status here is ON, so update status to OFF.')
commandArray['Variable:TVOnlyStatusUpdate'] = '1'
commandArray['TV']='Off'
else
print('TV current status here is OFF, so do nothing.')
end
end
return commandArray
For starters i new to domoticz so bare with me. What i want start with is to get a indication if the tv is on or not, i have a sony bravia KDL55HX 823, and i cant set pre-sharedkey neither do i have the ipconfig menu. But in my network i can access and ping the ip for the tv so i think i can get a indication if its on or off. But how should the cript look like'? And how do i use this script? I have followed the steps above but cant get it to work.
EDIT: I have fixed if i ping i get a status that its on and off when i shut down the wifi on the tv. But the standby function.. how do i get this to work?
-
- Posts: 1
- Joined: Friday 29 January 2016 9:29
- Target OS: Linux
- Domoticz version:
- Contact:
Re: LUA script for Sony Bravia TV
@tharland - I think your TV doesn't support the network remote function. Similar to my TV, Sony KLV series. They options of PSK and others are missing in the TV's network menu. I can also ping but not actually control the TV with the scripts. My TV is also not listed (by Sony itself) as being compatible with their "sideview" app. So I think it's futile to use these script on non-compatible TVs.
-
- Posts: 7
- Joined: Wednesday 05 October 2016 16:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: LUA script for Sony Bravia TV
@electronicsguy I have a Sony TV with options for side view that is set to "on". I can control the tv with app for smartphone. But this isn't maybe the same?
-
- Posts: 94
- Joined: Monday 30 November 2015 16:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: LUA script for Sony Bravia TV
The Sony bravia series without android have a notification function.
I cannot find the command to send a notification to the TV.
This can be usefull to use PiP with securitycamera's or just a notification when the doorbell/windowsensor is triggered.
Anyone know how to do this?
I cannot find the command to send a notification to the TV.
This can be usefull to use PiP with securitycamera's or just a notification when the doorbell/windowsensor is triggered.
Anyone know how to do this?
-
- Posts: 29
- Joined: Wednesday 18 June 2014 23:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
I own a Sony XD9305, but I can't get the status or lua-scripts to work. What am i doing wrong? In domoticz I get the error: lua:5: unexpected symbol near char(194).
What does that mean?
What does that mean?
-
- Posts: 18
- Joined: Wednesday 03 February 2016 21:10
- Target OS: Linux
- Domoticz version: 2.4386
- Location: Plailly France
- Contact:
Re: LUA script for Sony Bravia TV
@ StefanPuntNL Thanks for that, works perfectly
Plailly France
X10 Marmitek + Ebode for lights and blinds + CM15
mochad
Domoticz, Domoticz Lite, Geofence
Raspberry Pi III
X10 Marmitek + Ebode for lights and blinds + CM15
mochad
Domoticz, Domoticz Lite, Geofence
Raspberry Pi III
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
Currently working on a Python plugin for the Sony Bravia TV. See the link below for some more information.
http://www.domoticz.com/forum/viewtopic ... 65&t=16910
http://www.domoticz.com/forum/viewtopic ... 65&t=16910
Not using Domoticz anymore
-
- Posts: 1
- Joined: Monday 01 May 2017 23:30
- Target OS: Linux
- Domoticz version:
- Contact:
Re: LUA script for Sony Bravia TV
My 46EX523 doesn't have:
[Settings] → [Network] → [Home Network Setup] → [IP Control]
It does work with SlideView (goes through a handshake to register).
Has anyone figured out that protocol?
[Settings] → [Network] → [Home Network Setup] → [IP Control]
It does work with SlideView (goes through a handshake to register).
Has anyone figured out that protocol?
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
@CodeFestus, have a look at viewtopic.php?f=65&t=16910&start=20#p128866.
You should get this working with the use of a cookie.
You should get this working with the use of a cookie.
Not using Domoticz anymore
Re: LUA script for Sony Bravia TV
Hello G3rard, works fine on my kd-55x9005b. Will it be possible to read out the channel list from TV?
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: LUA script for Sony Bravia TV
You mean the Sony Bravia Python plugin works fine with your TV?
And it is possible to read out the channel list from the TV, but how do you want to use it in Domoticz?
And it is possible to read out the channel list from the TV, but how do you want to use it in Domoticz?
Not using Domoticz anymore
Re: LUA script for Sony Bravia TV
Yes I mean the Python plugin. Sorry i did the replay on wrong topic. Yes and read out the cannel list into your channel plugin...maybe more than 9 channels.
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
LUA script for Sony Bravia TV
Good to hear it's working
The selector switch in Domoticz only supports 10 values, so it's not possible to show all channels.
I am currently testing the remote control from Domoticz, which gives the option to show the EPG and choose a channel.
Edit: see viewtopic.php?f=65&t=16910&p=132330#p132330 for latest version with remote control support.
The selector switch in Domoticz only supports 10 values, so it's not possible to show all channels.
I am currently testing the remote control from Domoticz, which gives the option to show the EPG and choose a channel.
Edit: see viewtopic.php?f=65&t=16910&p=132330#p132330 for latest version with remote control support.
Not using Domoticz anymore
Who is online
Users browsing this forum: Google [Bot] and 0 guests