Philips Android TV component

Hi, this looks like an open discussion. Is there also a working solution for a 49PUS7xxx and a documentation how to use it? Or is this going to be a module inside the standard home assistant?

1 Like

Thank you for this! that works perfectly, how did you find out how to do this? I cant see it on the jointspace API documentation, I ask because I’m trying to set up an automation to switch the ambilights to follow audio, however swapping to {“styleName”:“FOLLOW_AUDIO”} doesn’t seem to work

curl -X GET --digest --insecure -u user:password https://192.x.x.x:1926/6/ambilight/currentconfiguration
you can get the correct command for the ambilight setting that is currently activated on your TV. So for follow audio you can use one of the following:


Have fun :grinning:

I cant thank you enough for sending that over, I now have a fully working input select that can set the ambilights to all of those functions.
Is there a page somewhere with all the available commands/settings you can send over ‘curl’ not shown on the Jointspace API page? or did you figure this out through some other means, I am also intending to add the functionality to change channel, source, and if its possible, open apps, but am struggling with the curl commands. Thanks again for your help


Very nice!

I found the undocumented ambilight commands here:

Changing channels is possible using input/key. I did not find a way to change the source, the command given in the jointSpace API (sources/current) does not work for me. Since it also not possible with the Philips App, I’m not sure if there is a way to directly switch to a specific source at all. Starting apps might be possible, since it’s possible with the App, but I could not find any documentation about it.

I own a Philips 55PFS8209/12 from sometimes around 2014/2015. It’s already Android but uses a different port (1925) and url (/5/) and doesn’t require user authentication.

Based upon Rookeh’s very fine work, I’ve compiled my own script that I’d like to share here. You might want to have a look on my implementation of wakeonlan as well. I’ve found that you can indeed turn on a Philips TV by sending a magic package (to make the TV listen) and then the standby key. Username/password are still in the script but marked optional as it’s not used anyway.

Add this to your configuration.yaml:

  - platform: philips_2014
    name: Fernseher Wohnzimmer
    mac: 01:23:45:67:89:ab

And drop this as in your config folder under custom_components/media_player:

Media Player component to integrate TVs exposing the Joint Space API.
Updated to support Android-based Philips TVs manufactured from 2014 but before 2016.
import homeassistant.helpers.config_validation as cv
import argparse
import json
import random
import requests
import string
import sys
import voluptuous as vol
import time
import wakeonlan

from base64 import b64encode,b64decode
from Crypto.Hash import SHA, HMAC
from datetime import timedelta, datetime
from homeassistant.components.media_player import (PLATFORM_SCHEMA, SUPPORT_TURN_ON, SUPPORT_TURN_OFF, SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_STEP, MediaPlayerDevice)
from homeassistant.const import (
from homeassistant.util import Throttle
from requests.auth import HTTPDigestAuth

MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)


DEFAULT_DEVICE = 'default'
DEFAULT_MAC = 'aa:aa:aa:aa:aa:aa'
BASE_URL = 'http://{0}:1925/5/{1}'

	vol.Required(CONF_HOST, default=DEFAULT_HOST): cv.string,
	vol.Required(CONF_MAC, default=DEFAULT_MAC): cv.string,
	vol.Optional(CONF_USERNAME, default=DEFAULT_USER): cv.string,
	vol.Optional(CONF_PASSWORD, default=DEFAULT_PASS): cv.string,
	vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string

# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None):
	"""Set up the Philips 2016+ TV platform."""
	name = config.get(CONF_NAME)
	host = config.get(CONF_HOST)
	mac = config.get(CONF_MAC)
	user = config.get(CONF_USERNAME)
	password = config.get(CONF_PASSWORD)
	tvapi = PhilipsTVBase(host, mac, user, password)
	add_devices([PhilipsTV(tvapi, name)])

class PhilipsTV(MediaPlayerDevice):
	"""Representation of a 2014-2015 Philips TV exposing the JointSpace API but not authentication."""

	def __init__(self, tv, name):
		"""Initialize the TV."""
		self._tv = tv
		self._name = name
		self._state = STATE_UNKNOWN
		self._min_volume = None
		self._max_volume = None
		self._volume = None
		self._muted = False
		self._connfail = 0

	def name(self):
		"""Return the device name."""
		return self._name

	def should_poll(self):
		"""Device should be polled."""
		return True

	def supported_features(self):
		"""Flag media player features that are supported."""
		return SUPPORT_PHILIPS_2014

	def state(self):
		"""Get the device state. An exception means OFF state."""
		return self._state

	def volume_level(self):
		"""Volume level of the media player (0..1)."""
		return self._volume

	def is_volume_muted(self):
		"""Boolean if volume is currently muted."""
		return self._muted

	def turn_on(self):
		"""Turn on the device."""
		i = 0
		while ((not self._tv.on) and (i < 15)):
			i += 1
		if self._tv.on:
			self._state = STATE_OFF

	def turn_off(self):
		"""Turn off the device."""
		i = 0
		while ((self._tv.on) and (i < 15)):
			i += 1
		if not self._tv.on:
			self._state = STATE_OFF

	def volume_up(self):
		"""Send volume up command."""
		if not self._tv.on:
			self._state = STATE_OFF

	def volume_down(self):
		"""Send volume down command."""
		if not self._tv.on:
			self._state = STATE_OFF

	def mute_volume(self, mute):
		"""Send mute command."""
		if not self._tv.on:
			self._state = STATE_OFF

	def media_title(self):
		"""Title of current playing media."""
		return None

	def update(self):
		"""Get the latest data and update device state."""
		self._min_volume = self._tv.min_volume
		self._max_volume = self._tv.max_volume
		self._volume = self._tv.volume
		self._muted = self._tv.muted
		if self._tv.on:
			self._state = STATE_ON
			self._state = STATE_OFF

class PhilipsTVBase(object):
	def __init__(self, host, mac, user, password):
		self._host = host
		self._mac = mac
		self._user = user
		self._password = password
		self._connfail = 0
		self.on = None = None
		self.min_volume = None
		self.max_volume = None
		self.volume = None
		self.muted = None
		self.sources = None
		self.source_id = None
		self.channels = None
		self.channel_id = None

	def _getReq(self, path):
			if self._connfail:
				self._connfail -= 1
				return None
			resp = requests.get(BASE_URL.format(self._host, path), timeout=TIMEOUT)
			self.on = True
			return json.loads(resp.text)
		except requests.exceptions.RequestException as err:
			self._connfail = CONNFAILCOUNT
			self.on = False
			return None

	def _postReq(self, path, data):
			if self._connfail:
				self._connfail -= 1
				return False
			resp =, path), data=json.dumps(data))
			self.on = True
			if resp.status_code == 200:
				return True
				return False
		except requests.exceptions.RequestException as err:
			self._connfail = CONNFAILCOUNT
			self.on = False
			return False

	def update(self):

	def getName(self):
		r = self._getReq('system/name')
		if r: = r['name']

	def getAudiodata(self):
		audiodata = self._getReq('audio/volume')
		if audiodata:
			self.min_volume = int(audiodata['min'])
			self.max_volume = int(audiodata['max'])
			self.volume = audiodata['current']
			self.muted = audiodata['muted']
			self.min_volume = None
			self.max_volume = None
			self.volume = None
			self.muted = None

	def setVolume(self, level):
		if level:
			if self.min_volume != 0 or not self.max_volume:
			if not self.on:
				targetlevel = int(level)
			except ValueError:
			if targetlevel < self.min_volume + 1 or targetlevel > self.max_volume:
			self._postReq('audio/volume', {'current': targetlevel, 'muted': False})
			self.volume = targetlevel

	def sendKey(self, key):
		self._postReq('input/key', {'key': key})

	def wol(self):

Have fun!

1 Like

any luck with the folder to place the in hassio yet

reload the core

if using hassio folder in config/custom_components/

1 Like


No, I haven’t had the time to “play” with this.
But I would be really interested in doing it in the near future.

I want to learn a lot about Home Assistant and and get it really useful.
For now, it is working almost out-of-the box, as I only know how to do a limited amount of things (basically what is in the instructions of the Help).

Those menus for the TV and Ambilight above, the dashboards, the tabs (I know these are explained somewhere in the Help), I want to learn a lot. I love these thongs, although my programming does not go further than VBA :joy: In there I’m really confortable.:sunglasses:

Would you be able to help out?
I hope you can and I’m getting excited I’ll finally get this to work.

Thanks for great work. I can confirm that your script is working on my philips 2014. Is there any API or script to change a tv channels?

Why I get white screen with text: Forbidden, when I open tv IP address?

import hmac
from hashlib import sha256

def create_signature(secret_key, to_sign):
sign =, to_sign, sha256)
return str(b64encode(sign.hexdigest().encode()))

just change these things if you like me dont want to download visual studio things on windows,
use hmac and hashlib instead of Crypto.

Thank you very much for the great work. I can confirm it works on my new philips 9002 oled. I fisrt thought it wouldnt be possible then i discovered this thread and got reliable tv status control. Thank you

Hi everyone. :slight_smile:

I’m new here and don’t understand about api’s and stuff. The reason I came here is because I googled how to install jointspace on my Philips TV. (55PUS7181/12)

I have a Samsung Galaxy Note 8 and installed the Philips New Ambilight + Hue app on it. But it gives me a message saying ‘something went wrong’. I uploaded a screenshot, hopefully you can see it below.

My TV needs to be enabled with jointspace and I have no idea how to do it.

If anyone can help I’d really appreciate it.

Many thanks in advance. :slight_smile:


I don’t think the app is working on the new tv’s from philips, because on my 9002 oled it also say it doesn’t find the tv. But you can go in the menu and find ambilight+hue and pair the hue bridge and it’s working just fine. I read about the jointspace api on forums, but it seems that you cannot enable it because it’s already enabled.

I hope i’m right. If somebody knows more, feel free to answer.

1 Like

For anyone interested, I have successfully set up an automation which sets the Ambilights of a 2016+ Philips Android TV to follow (copy) the colour of another light from Home Assistant, say you have RGB LED strips around the room, and want the TV ambilights, at certain times, to automatically match the colour of the target lights.
Things to note:

  • This method uses Hue and Saturation to set the colour of the ambilights, so the ‘hs_color’ attribute of the light component is used to update the parameters, this may be labelled differently for your lights
  • The scaling of the Hue and Saturation within home assistant will probably be different to the scale used within the Phillips API, and thus, a scaling factor is needed

Through experimenting with the Jointspace API, I could set all the Ambilight LED’s to one colour via the terminal command:

curl -X POST --digest --insecure -u XXXXX https://192.168.X.XXX(TVs_local_IP):1926/6/ambilight/currentconfiguration -d ‘{“styleName”:“FOLLOW_COLOR”,“isExpert”:true,“algorithm”:“MANUAL_HUE”,“colorSettings”:{“color”:{“hue”:{{ ((state_attr(‘light.[enitity_id of target light]’, ‘hs_color’)[0]) * ([Scaling Factor]) |int }},“saturation”:{{ ((state_attr(‘light.[enitity_id of target light]’, ‘hs_color’)[1]) ([Scaling Factor])) |int }},“brightness”:{{ state_attr(‘light.[enitity_id of target light]’, ‘brightness’) |int }}},“colorDelta”:{“hue”:0,“saturation”:0,“brightness”:0},“speed”:255}}’

As this is very messy, I will give an example:

  • The IP of the TV being
  • The entity_id of the light I want the tv to copy is light.bedroom_light
  • The scaling of the HS(&B) values within home assistant are:
  • The scaling of the HS(&B) values for the Philips TV (yours will most likely be the same) are:

The following shell_command will be added to config.yaml:

curl -X POST --digest --insecure -u XXXXXXXXXXXX -d '{“styleName”:“FOLLOW_COLOR”,“isExpert”:true,“algorithm”:“MANUAL_HUE”,“colorSettings”:{“color”:{“hue”:{{ ((state_attr('light.bedroom_light, ‘hs_color’)[0]) * (255/360)) |int }},“saturation”:{{ ((state_attr('light.bedroom_light, ‘hs_color’)[1]) * (255/100)) |int }},“brightness”:{{ state_attr(‘light.bedroom_light, ‘brightness’) |int }}},“colorDelta”:{“hue”:0,“saturation”:0,“brightness”:0},“speed”:255}}’

Then, an automation can be created to run the shell command any time the state of the target light is changed, thus keeping the ambilights in sync:

– alias: Follow Room Colour
– entity_id: light.bedroom_light
platform: state
– condition: state
entity_id: switch.ambilight
state: ‘on’
– service: shell_command.set_ambilights_to_strips

This automation can be turned on and off, to allow the ambilights to continue following video or audio if this function is not needed. I did look into expanding this into a fully functional RGB light from within Home Assistant, but could not find any shell_command light component that would work (although there seems to be an MQTT light component which may be similar), if anyone knows of a more elegant solution to this I would love to hear it, otherwise, this is a very nice way of tying in your TV to your current RGB lights, controlled by Home Assistant


Thank you for your job! Really nice feature!
Do you know if it would be possible to do it reversed, i.e. get the current colour of the TV ambilight and match a colour of any RGB lamp via automation?

Unfortunately not at the moment, as this is automation based, and simply sends a command to match the target light when it is changed, I am starting to look at creating a light component for the ambilights separately, which would be much better, as it would work both ways as you say, and the ambilights could then be controlled by any automation or integration such as alexa, google home and siri etc, I have never written a component so I cant promise anything, but ill be sure to post it here if I get anywhere :slight_smile:

1 Like

First of all good job!
Guys python absolute newbie here but learning.
Is there a way to add the channels list to this? For the 2016 Philips tv’s the channel list is found with https://tvip:1926/6/channeldb/tv/channelLists/all

I’ve been trying to use the current component from here but cannot understand the code nor how the list can be obtained.
Tried similarly to the current channel function but with no success.

I really want to learn. Anyone please?
Thank you


I managed to hack my way to what I wanted. Now Channel list is available e you can choose your tv channel in the source list.

Here is the file philips_2016_b.xml (8.6 KB)
Just change .xml to .py

Lots of doubts in my mind still as I cannot understand much of the how to build a component, specially from ground up.