Kodi Notication

Okay need a little help. :grin:

I installed Kodi Notification component to the letter following this guide

My conf is installed properly on a running 0.33.1 HASS

When invoking an automation which triggers action to notify Kodi nothing happens.
Ran config check and this is what I get

Component not found: kodi_notification

Why is it looking for a kodi_notification notify component instead of the kodi notify compoment?

ps: https://github.com/home-assistant/home-assistant.github.io/compare/current...dennisaion:patch-2

Okay I figured it out already. This kodi_notification: is supposed to be this kodi: in the configuration file.

Instruction needs updating. I posted a PR already for first mishap but second should be done based on this remark.

The example here looks correct. Where you see kodi_notification - that’s defining a script.

I know. But nothing shows.

Config of kodi is correct. The script and calling notify.kodi directly without script is both working but not showing any notification on screen.

I’m not clear what you mean by this. What do you mean by “working” if you don’t see a notification. Post some YAML so that we can see what you’re trying. Are you sure you have the port correct? Do you have Kodi set up as a media platform and is that working?

I see in the logs that it fired but the message is not ending up on screen on my Kodi device.
Config to my Kodi device is correct also.

notify:
  - platform: kodi
    host: 192.168.0.106
    port: 80
    username: kodi_user
    password: kodi_password

automation:
- alias: 'Notify Kodi Test 1'
  hide_entity: true
  trigger:
    platform: state
    entity_id: device_tracker.kylo_ren
    from: 'not_home'
  action:
    service: notify.kodi

- alias: 'Notify Kodi Test 2'
  hide_entity: true
  trigger:
    platform: state
    entity_id: device_tracker.kylo_ren
    from: 'not_home'
  action:
    service: notify.kodi

script:
  kodi:
    alias: 'Notify Kodi Test 3'
    sequence:
    - service: notify.kodi
      data:
        title: "Home Assistant"
        message: "Kylo Ren has entered the home!"
        data:
          displaytime: 20000
          icon: "warning"

Manually entering following in a browser

http://192.168.0.106:8080/jsonrpc?request={"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Sample%20Title","message":"Kylo%20Ren%20is%20standing%20outside.","image":"","displaytime":5000},"id":1}

gives me following result

{"id":1,"jsonrpc":"2.0","result":"OK"}

so I think there is some more work to do? :grin:

When you’re typing this into a browser, are you getting a basic authentication challenge?

And using “kodi_user” / “kodi_password” (or the correct values) to clear it? In your browser, you’ll only be challenged the first time.

And when you get the JSON success result, you’re seeing the notification in Kodi?

With and without username/password using this URL I see a nice notification on my Kodi’'s.
Changing IP I tested on Android and Raspberry units.

What I would like to know i’s if there is anyone who has actually gotten the Kodi notification component to work and if yes what there exact configuration looks like.

Yes. I use it and it works great for me.

I wonder if port 80 is your problem. You reference 8080 in your URL, but 80 in your config.

Here’s what I’ve got:

notify:
  - name: kodi
    platform: kodi
    host: http://192.168.1.110
    port: 8111
    username: xbmc
    password: 1234

and then from within the action block of an automation:

- service: notify.kodi
  data: 
    message: "Motion front porch"
    title: "Front Porch"

80 or 8080 doesn’t matter. Anyway I am using a template now with the URL. Works that way.

Also - I just noticed that you were calling the service in the code you posted without passing it any data. This by itself does nothing:

  action:
    service: notify.kodi

This should work:

action:
  - service: notify.kodi
    data: 
      message: "Motion front porch"
      title: "Front Porch"

I left out the message cause it is obvious.

  action:
    service: notify.kodi
    data: 
      message: "Kylo Ren has entered the home!"
      title: "Front Door"
      data:
        displaytime: 20000
        icon: "warning"

anyway it looks like this in the logs

16-11-22 20:56:18 homeassistant.components.automation: Executing Notify Kodi Test
16-11-22 20:56:18 homeassistant.core: Bus:Handling <Event logbook_entry[L]: domain=automation, name=Notify Kodi Test, entity_id=automation.notify_kodi_test, message=has been triggered>
16-11-22 20:56:18 homeassistant.helpers.script: Script Notify Kodi Test: Running script
16-11-22 20:56:18 homeassistant.helpers.script: Script Notify Kodi Test: Executing step call service
16-11-22 20:56:18 homeassistant.core: Bus:Handling <Event call_service[L]: domain=notify, service_data=message=Kylo Ren has entered the home!, data=displaytime=20000, icon=warning, title=Front Door, service_call_id=1977260816-14, service=kodi>
16-11-22 20:56:18 homeassistant.components.automation: Executing Kylo Ren State Change Alert
16-11-22 20:56:18 homeassistant.core: Bus:Handling <Event logbook_entry[L]: domain=automation, name=Kylo Ren State Change Alert, entity_id=automation.kylo_ren_state_change_alert, message=has been triggered>
16-11-22 20:56:18 homeassistant.helpers.script: Script Kylo Ren State Change Alert: Running script
16-11-22 20:56:18 homeassistant.helpers.script: Script Kylo Ren State Change Alert: Executing step call service
16-11-22 20:56:18 homeassistant.core: Bus:Handling <Event call_service[L]: domain=persistent_notification, service_data=notification_id=Kylo Ren, message=Kylo Ren is home since 20:56:18, service_call_id=1977260816-15, service=create>
16-11-22 20:56:18 homeassistant.core: Unable to find service notify/kodi

Ah. You missed the name parameter.

name: kodi

You could call it name: mediaserver and you’d have notify.mediaserver.

It might get a default name if you don’t specify. Dunno. You can look in your states dev tool in HASS’ UI (icon that looks like < > in sidebar). That’ll list all entity_id’s that are defined.

My friend. You are guessing now. The name parameter is optional.

I told you already that it is configured correctly and I posted log contents which show i triggers correctly.

Only thing is that message is not ending up on my kodi while if I post a straight URL entry in my browser it pops up nicely.

Meaning the travel from one PC to Kodi is not the issue.
The issue is between Kodi component and Kodi.
It can not be HA since it clearly has no problems operating my Kodi.

Problem is communication between Kodi component and Kodi.

What version Kodi do you have and what version json rpc?

Mine is 16.1 and 6

jsonrpc = 2.0
kodi = 15.2

So that suggests we’ve both got the same API version.

Confirming: You’ve got a notify.kodi in your states tab?

Hi,

I use Kodi notifications and they work perfectly.
And my configuration looks pretty much the same as yours, but I also have
name: Kodi

Omg I found the culprit. Moi overlooked following

host: 192.168.0.106

Should be

host: http://192.168.0.106

So it needed the http:// part to formulated the adres correctly for the JSON RPC call.

I think this is broken for me. I can’t do http://myip as it only accepts ip now. But I always get this in the log even though my Kodi Media Player instance works fine.

17-03-29 22:26:20 WARNING (Thread-8) [homeassistant.components.notify.kodi] Unable to fetch Kodi data, Is Kodi online?

My notify config:

- name: kodi_notify
  platform: kodi
  host: 192.168.0.32

I’m using the Services tab to do a call with data in JSON like this:

{ "title" : "test", "message" : "this is a test" }

looking at the jsonrpc output from kodi @ http://192.168.0.32:8080/jsonrpc both title and message are required:

"GUI.ShowNotification": {
			"description": "Shows a GUI notification",
			"params": [
				{
					"name": "title",
					"required": true,
					"type": "string"
				},
				{
					"name": "message",
					"required": true,
					"type": "string"
				},
				{
					"default": "",
					"name": "image",
					"type": [
						{
							"enums": [
								"info",
								"warning",
								"error"
							],
							"type": "string"
						},
						{
							"type": "string"
						}
					]
				},
				{
					"default": 5000,
					"description": "The time in milliseconds the notification will be visible",
					"minimum": 1500,
					"name": "displaytime",
					"type": "integer"
				}
			],
			"returns": {
				"type": "string"
			},
			"type": "method"
		},

If memory serves, 9090 is the default port. Have you tried setting the port in your config?

  - name: kodi_notify
    platform: kodi
    host: http://192.168.0.32
    port: 8080
    username: xbmc
    password: 1234

I did. I did some more testing yesterday with jsonrpc-asyn (used in the component) and I think my config is valid. Also on the latest version of HA 0.40.2 (version I’m on) there where some changes to the kodi notify component to make it async. I think the issue is kodi is expecting image as one of the data attributes but HA is passing icon instead.