openHAB for Kodi

kodi
openhab
xbmc
Tags: #<Tag:0x00007f51e0fdd778> #<Tag:0x00007f51e0fdd4d0> #<Tag:0x00007f51e0fdd0e8>

(Wassilis) #21

This is truly good stuff. Unfortunately it seems not to work under OpenHab2. Any plans to support OH2.
I tested it and ran into the following error:

14:44:08 T:1764750352 NOTICE: fetching json url=http://192.xxx:8080/rest/sitemaps, headers={‘accept’: ‘application/json’}
14:44:08 T:1764750352 NOTICE: response for url=http://192.xxx:8080/rest/sitemaps, text=[{“name”:“bill”,“label”:“Bills Main Menu”,“link”:“http://´192.xxx:8080/rest/sitemaps/bill","ho
mepage”:{“link”:“http://192.xxx:8080/rest/sitemaps/bill/demo",“leaf”:false,“widgets”:[]}},{“name”:"_default",“label”:“Home”,“link”:“http://192.xxx:8080/rest/sitemaps/_default”,"home
page”:{“link”:“http://192.xxx:8080/rest/sitemaps/_default/_default",“leaf”:false,"widgets”:[]}}], headers={‘Date’: ‘Sun, 17 Apr 2016 12:44:08 GMT’, ‘Content-Length’: ‘386’, ‘Content-Typ
e’: ‘application/json’, ‘Server’: ‘Jetty(9.2.14.v20151106)’}
14:44:08 T:1764750352 NOTICE: Previous line repeats 1 times.
14:44:08 T:1764750352 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<–
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type ‘exceptions.TypeError’>
Error Contents: list indices must be integers, not str
Traceback (most recent call last):
File “/home/pi/.kodi/addons/script.module.openhab-1.0.1/default.py”, line 200, in
show_sitemaps()
File “/home/pi/.kodi/addons/script.module.openhab-1.0.1/default.py”, line 186, in show_sitemaps
sitemaps = sorted(oh.load_sitemaps().iterkeys())
File “/home/pi/.kodi/addons/script.module.openhab-1.0.1/resources/lib/openhab1.py”, line 233, in load_sitemaps
for i in as_array(result[‘sitemap’]):
TypeError: list indices must be integers, not str
–>End of Python script error report<–


(dot850) #22

I tried this today with OpenHab 1.8.1. I am new to OpenHab and to KODI.

I am able to successfully put in my server settings and when I open up the program inside KODI I do not get a connection error but the window is blank. Any ideas?


(mampfes) #23

Hi, did you try to ping the openhab server from your Kodi box (to ensure that you have a route to the openhab server)? Then check the sitemap name (or use the menu in the settings dialog to select the appropriate sitemap).


(dot850) #24

Hi mampfes,

Yes. I can ping the server from my KODI box.The addon also detects the sitename automatically so I figured that is a good sign?

I also tried reverting the OpenHAB server back to the default port of 8080. That didn’t seem to change the performance.

Any other ideas or things I can try?

Thanks!


(mampfes) #25

Strange. You can try the demo sitemap which should work. Otherwise enable the debug switch in the settings dialog and check the kodi log.


(dot850) #26

Does this help at all? I recently upgraded to OpenHab 1.8.3 hoping that would makes a difference but nothing seems different.


(Thomas) #27

Looks promising.

I had issues installing this addon though. Ended up manually unzipping it and adding it to the .kodi/plugins folder.
I’m running this on the current openelec version, and did download the zip for 1.0.2 of your plugin.

I have entered the IP, port, and sitemap for my openhab install (which is openhab2 - so perhaps thats the issue?)

Is there anything I can edit / tinker with / check etc to get this going?


(mampfes) #28

Hi Thomas. You’re right - 1.0.2 doesn’t work with OpenHAB2. But there is already a test version in the conversation with Baumi1245: https://github.com/mampfes/script.module.openhab/issues/2. Please try this one - it work with the Demo sitemap for me.


(Frank Sautter-Steisslinger) #29

Hello,
I’ve been updating to libreELEC 8.0.0 (Kodi 17.0).
openHAB for Kodi does not run on Kodi 17.0, maybe the directory structure has changed.
Is it planned to support also Kodi 17.0 ?


(Frank Sautter-Steisslinger) #30

Fixed it with a hack:
Just faked the addon.xml. Set gui to 5.12.0
-> import addon=“xbmc.gui” version=“5.12.0”/
Also moved the fanart.jpg and icon.png to resorces folder.
Now it works again.


(Frank Sautter-Steisslinger) #31

… but just until the next boot. Will be disabled again.


(Matt Shepherd) #32

Hey Frank,

Did you manage to get it working?


(Frank Sautter-Steisslinger) #33

Yes. I made my “private” version 1.0.3 and it works well now.
Since I’m not the originator of this SW I have not uploaded it.
If you want I can give you the zip


(Matt Shepherd) #34

Yes please!!


(Yannick Schaus) #35

Had to spend a couple hours and fix some little things in order to get working correctly for me with OH2 and Kodi 17 but glad I found it, this is exactly what I was looking for! Great work @mampfes!

I submitted a PR to your repo with my changes:

Basically I moved the selection list and color picker to left since the background was not working, and changed a bunch of colors. There are some issues remaining but it does the job.

(Note: your 2.0 release .zip doesn’t include the openHAB 2 bits…!)


(Joachim Boeddeker) #36

That’s a nice addon i’ve been looking for. But sadly it doesn’t work on my LibreElec 8.2.2 Kodi 17.6 / openHAB 2.2 stable.

I am able to select the sitemap i want, but nothing is shown? Did i miss something?


(mampfes) #37

Please enable debug logging (in settings) and check kodi’s debug log.


(Joachim Boeddeker) #38

Thanks for looking into it.

The Kodi process jumped to more than 100% CPU usage until i closed the openHAB window.

Here is the log. Alonger excerpt is at pastebin

14:06:30.454 T:1226830752  NOTICE: fetching json url=http://10.10.10.10:8080/rest/sitemaps/Neu/00000707, headers={'x-atmosphere-transport': 'long-polling', 'accept': 'application/json'}
14:06:30.479 T:1218442144  NOTICE: fetching json url=http://10.10.10.10:8080/rest/sitemaps/Neu/000007080000, headers={'x-atmosphere-transport': 'long-polling', 'accept': 'application/json'}
14:06:30.496 T:1210053536  NOTICE: fetching json url=http://10.10.10.10:8080/rest/sitemaps/Neu/000007080100, headers={'x-atmosphere-transport': 'long-polling', 'accept': 'application/json'}
14:06:30.531 T:1430246304   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.AttributeError'>
                                            Error Contents: 'NoneType' object has no attribute 'attribs'
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/menulist.py", line 438, in onInit
                                                self.build_menu()
                                              File "/storage/.kodi/addons/script.module.openhab/default.py", line 61, in build_menu
                                                self.homepage = sitemap.load_page()
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 367, in load_page
                                                self.page = self.oh.create_page_class(self, result['homepage'])
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 259, in create_page_class
                                                i = Page(sitemap, pageData, prevPage)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 384, in __init__
                                                self.init(pageData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 399, in init
                                                self.create_all_widgets(as_array(pageData['widgets']))
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 405, in create_all_widgets
                                                i = self.oh.create_widget_class(self, w)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 324, in create_widget_class
                                                i = FrameWidget(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 479, in __init__
                                                super(FrameWidget, self).__init__(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 430, in __init__
                                                self.init(widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 487, in init
                                                i = self.oh.create_widget_class(self.page, w)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 338, in create_widget_class
                                                i = TextWidget(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 573, in __init__
                                                super(TextWidget, self).__init__(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 430, in __init__
                                                self.init(widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 579, in init
                                                self.page = self.oh.create_page_class(self.page.sitemap, widgetData['linkedPage'], self.page)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 259, in create_page_class
                                                i = Page(sitemap, pageData, prevPage)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 384, in __init__
                                                self.init(pageData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 399, in init
                                                self.create_all_widgets(as_array(pageData['widgets']))
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 405, in create_all_widgets
                                                i = self.oh.create_widget_class(self, w)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 324, in create_widget_class
                                                i = FrameWidget(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 479, in __init__
                                                super(FrameWidget, self).__init__(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 430, in __init__
                                                self.init(widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 487, in init
                                                i = self.oh.create_widget_class(self.page, w)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 338, in create_widget_class
                                                i = TextWidget(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 573, in __init__
                                                super(TextWidget, self).__init__(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 430, in __init__
                                                self.init(widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 579, in init
                                                self.page = self.oh.create_page_class(self.page.sitemap, widgetData['linkedPage'], self.page)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 259, in create_page_class
                                                i = Page(sitemap, pageData, prevPage)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 384, in __init__
                                                self.init(pageData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 399, in init
                                                self.create_all_widgets(as_array(pageData['widgets']))
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 405, in create_all_widgets
                                                i = self.oh.create_widget_class(self, w)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 324, in create_widget_class
                                                i = FrameWidget(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 479, in __init__
                                                super(FrameWidget, self).__init__(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 430, in __init__
                                                self.init(widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 487, in init
                                                i = self.oh.create_widget_class(self.page, w)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 336, in create_widget_class
                                                i = SwitchWidget(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 561, in __init__
                                                super(SwitchWidget, self).__init__(page, widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 430, in __init__
                                                self.init(widgetData)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 62, in func_wrapper
                                                func(self, *args, **kwargs)
                                              File "/storage/.kodi/addons/script.module.openhab/resources/lib/openhab2.py", line 567, in init
                                                if self.attribs['mapping'] and self.attribs['value'] is None and self.item.attribs['state'] is not None:
                                            AttributeError: 'NoneType' object has no attribute 'attribs'
                                            -->End of Python script error report<--
14:06:43.119 T:1944899584   DEBUG: SECTION:UnloadDelayed(DLL: libnfs.so.8)
14:07:00.848 T:1361048480  NOTICE: response for url=http://10.10.10.10:8080/rest/sitemaps/Neu/00000100, text={"id":"00000100","title":"Modus","icon":"text","link":"http://10.10.10.10:8080/rest/sitemaps/Neu/00000100","parent":{"id":"0000","title":"Heizung","icon":"radiator","link":"http://10.10.10.10:8080/rest/sitemaps/Neu/0000","leaf":false,"timeout":true},"leaf":true,"timeout":true,"widgets":[{"widgetId":"00000100_16","type":"Text","label":"MiHK [Unbekannt]","icon":"radiator","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/MiHK_MODE","state":"NULL","transformedState":"Unbekannt","stateDescription":{"pattern":"","readOnly":false,"options":[{"value":"AUTO-MODE","label":"Auto mode"},{"value":"MANU-MODE","label":"Manu mode"},{"value":"PARTY-MODE","label":"Holiday mode"},{"value":"BOOST-MODE","label":"Boost function"}]},"type":"String","name":"MiHK_MODE","label":"Modus MiHK","category":"radiator","tags":[],"groupNames":["MiHK_Heizung"]},"widgets":[]}]}, headers={'Content-Length': '870', 'Content-Type': 'application/json', 'Server': 'Jetty(9.3.22.v20171030)'}
14:07:00.860 T:1361048480  NOTICE: fetching json url=http://10.10.10.10:8080/rest/sitemaps/Neu/00000100, headers={'x-atmosphere-transport': 'long-polling', 'accept': 'application/json'}
14:07:01.047 T:1454371744  NOTICE: response for url=http://10.10.10.10:8080/rest/sitemaps/Neu/00000600, text={"id":"00000600","title":"Luftfeuchtigkeit [44.2 %]","icon":"humidity","link":"http://10.10.10.10:8080/rest/sitemaps/Neu/00000600","parent":{"id":"0000","title":"Heizung","icon":"radiator","link":"http://10.10.10.10:8080/rest/sitemaps/Neu/0000","leaf":false,"timeout":true},"leaf":false,"timeout":true,"widgets":[{"widgetId":"00000600_0","type":"Frame","label":"","icon":"frame","mappings":[],"widgets":[{"widgetId":"00000600_0_0","type":"Text","label":"AZ [45 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/AZWT_ACTUAL_HUMIDITY","state":"45.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"AZWT_ACTUAL_HUMIDITY","label":"AZ","category":"humidity","tags":[],"groupNames":["AZWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1","type":"Text","label":"Ar [44 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/ArWT_ACTUAL_HUMIDITY","state":"44.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"ArWT_ACTUAL_HUMIDITY","label":"Ar","category":"humidity","tags":[],"groupNames":["ArWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2","type":"Text","label":"B1 [47 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/B1WT_ACTUAL_HUMIDITY","state":"47.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"B1WT_ACTUAL_HUMIDITY","label":"B1","category":"humidity","tags":[],"groupNames":["B1WT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3","type":"Text","label":"FE [45 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/FEWT_ACTUAL_HUMIDITY","state":"45.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"FEWT_ACTUAL_HUMIDITY","label":"FE","category":"humidity","tags":[],"groupNames":["FEWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3_4","type":"Text","label":"K [44 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/KUWT_ACTUAL_HUMIDITY","state":"44.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"KUWT_ACTUAL_HUMIDITY","label":"KU","category":"humidity","tags":[],"groupNames":["KUWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3_4_5","type":"Text","label":"Mi [44 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/MiWT_ACTUAL_HUMIDITY","state":"44.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"MiWT_ACTUAL_HUMIDITY","label":"Mi","category":"humidity","tags":[],"groupNames":["MiWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3_4_5_6","type":"Text","label":"Le [42 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/LeWT_ACTUAL_HUMIDITY","state":"42.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"LeWT_ACTUAL_HUMIDITY","label":"Le","category":"humidity","tags":[],"groupNames":["LeWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3_4_5_6_7","type":"Text","label":"SZ [43 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/SZWT_ACTUAL_HUMIDITY","state":"43.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"SZWT_ACTUAL_HUMIDITY","label":"SZ","category":"humidity","tags":[],"groupNames":["SZWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3_4_5_6_7_8","type":"Text","label":"WZ [44 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/WZWT_ACTUAL_HUMIDITY","state":"44.00","stateDescription":{"pattern":"%.0f %%","readOnly":false,"options":[]},"type":"Number","name":"WZWT_ACTUAL_HUMIDITY","label":"WZ","category":"humidity","tags":[],"groupNames":["WZWT_Heizung","gHumidity","gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]},{"widgetId":"00000600_0_0_1_2_3_4_5_6_7_8_9","type":"Text","label":"Draussen [91 %]","icon":"humidity","mappings":[],"item":{"link":"http://10.10.10.10:8080/rest/items/LOCAL_ACTUAL_HUMIDITY","state":"91","stateDescription":{"pattern":"%d %%","readOnly":false,"options":[]},"type":"Number","name":"LOCAL_ACTUAL_HUMIDITY","label":"Luftfeuchtigkeit draussen","category":"humidity","tags":[],"groupNames":["gRestoreOnStartup","gPersist","gPersistNumber"]},"widgets":[]}]},{"widgetId":"00000600_1","type":"Frame","label":"","icon":"frame","mappings":[],"widgets":[{"widgetId":"00000600_1_0","type":"Switch","label":"Zeitraum","icon":"line","mappings":[{"command":"0","label":"-"},{"command":"4","label":"12h"},{"command":"1","label":"D"},{"command":"5","label":"2D"},{"command":"2","label":"W"},{"command":"3","label":"M"}],"item":{"link":"http://10.10.10.10:8080/rest/items/gHumidity_chart_period","state":"0","type":"Number","name":"gHumidity_chart_period","label":"Zeitraum","category":"line","tags":[],"groupNames":["gRestoreOnStartup"]},"widgets":[]}]}]}, headers={'Content-Length': '5570', 'Content-Type': 'application/json', 'Server': 'Jetty(9.3.22.v20171030)'}
14:07:01.125 T:1454371744  NOTICE: fetching json url=http://10.10.10.10:8080/rest/sitemaps/Neu/00000600, headers={'x-atmosphere-transport': 'long-polling', 'accept': 'application/json'}
14

(mampfes) #39

Hi, there is one (or maybe more) yet unsupported items in your sitemap. At first glance I didn’t find the responsible item as the log is too long for me. Therefore I recommend to strip down the sitemap until it works again.


(Joachim Boeddeker) #40

Thanks for your time. I will check with a simpler sitemap.