Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Niko Home Control : TypeError: string indices must be integers #19283

Closed
pergolafabio opened this issue Dec 14, 2018 · 52 comments
Closed

Niko Home Control : TypeError: string indices must be integers #19283

pergolafabio opened this issue Dec 14, 2018 · 52 comments

Comments

@pergolafabio
Copy link

pergolafabio commented Dec 14, 2018

Hi, i wanted to try and setup the new platform "Niko Home Control" but i receive the error below whan i start HA

any idea whats wrong?

2018-12-13 14:30:08 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform niko_home_control
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/niko_home_control.py", line 44, in setup_platform
    [NikoHomeControlLight(light, hub) for light in hub.list_actions()],
  File "/usr/local/lib/python3.6/site-packages/nikohomecontrol/_init_.py", line 35, in list_actions
    return [Action(action, self) for action in self.list_actions_raw()]
  File "/usr/local/lib/python3.6/site-packages/nikohomecontrol/_init_.py", line 35, in <listcomp>
    return [Action(action, self) for action in self.list_actions_raw()]
  File "/usr/local/lib/python3.6/site-packages/nikohomecontrol/_init.py", line 86, in __init_
    self._id = action['id']
TypeError: string indices must be integers
@cgarwood
Copy link
Member

What does your config look like? What version of Home Assistant?

@pergolafabio
Copy link
Author

pergolafabio commented Dec 14, 2018

tried it with 82.x 83.x and 84.x
config is quite basic, just like this

light:
  - platform: niko_home_control
    host: 192.168.0.10

@pergolafabio
Copy link
Author

also tried manually specifiying port, but didnt help either

also in debug log, i see this :

2018-12-13 14:54:41 INFO (MainThread) [homeassistant.components.light] Setting up light.niko_home_control
but then that error afterwards

@pergolafabio
Copy link
Author

anyone that can help me with this? what info do you guys need?

@Cire2019
Copy link

Cire2019 commented Jan 2, 2019

Hi, i have the same issue. Did you find a way to setup NHC with HA ?

@pergolafabio
Copy link
Author

Nope, not working, also opened a thread on forum, but no reply either

@Cire2019
Copy link

Cire2019 commented Jan 2, 2019

I have this error in the logs:

File "/usr/local/lib/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 1339 (char 1338)

I looked for the decoder.py but i cannot find the folder python3.6
Same for this file(niko_home_control.py) :
/usr/local/lib/python3.6/site-packages/homeassistant/components/light/niko_home_control.py

Do you know how to find them ? Via putty, i dont see them.

@pergolafabio
Copy link
Author

i didnt troubleshoot any further
your error is different though?

@pergolafabio
Copy link
Author

@Cire2019 @raphk82 , have you ever got this plaform to work?

@legovaer can you help us out?

@Cire2019
Copy link

@pergolafabio Unfortunately no.

@pergolafabio
Copy link
Author

hmm, how can we proceed with this?

@legovaer
Copy link
Contributor

All, I know there are some issues with the NHC platform. Next week I will be able to spend 3 full days on improving the functionalities.

I will provide additional documentation on setting up NHC with Hass.

In the integration that has been released, theres no active connection to NHC, which makes it kind of useless. Based upon the feedback I received over the weeks, I will be able to fix the majority of the issues by the end of next week.

@pergolafabio
Copy link
Author

Ah, thnx for the info, appreciate it

@Cire2019
Copy link

Great news. Tell me if I can help by testing.

@raphk82
Copy link

raphk82 commented Jan 25, 2019

@Cire2019 @raphk82 , have you ever got this plaform to work?

@legovaer can you help us out?

No, I just found out that this component exists. I was waiting for this since I got home assistant so I was really surprised when I found it.

But never actually got it to work. Since day one I get the error described above.

@pergolafabio
Copy link
Author

It's under investigation ;)

@raphk82
Copy link

raphk82 commented Jan 25, 2019

Yes I see :) Hopefully it will work one day. This component is the one piece missing to make my HA installation perfect.

If there is any need for testing I can also help.

BtW: This error here is different than the one I get (see Issue #20005)

@pergolafabio
Copy link
Author

hi @legovaer , any updates on this? :)

@pergolafabio
Copy link
Author

hi, when will this component be ready for use?

@Cire2019
Copy link

Hello, I don't know if the component have been updated. But i tried it last WE but still the same issue.
I suppose it's not so easy to adapt it .
I think the problem is that i don't only have lights devices defined for the smartphone (in NHC), but also shutters.

@pergolafabio
Copy link
Author

Don't think there was an update since release... It's strange they even did release it

@raphk82
Copy link

raphk82 commented Mar 9, 2019

I guess there hasn't been any progress regarding this issue. Just updatet to version 0.89.1 but still get the same error as described in issue #20005

@pergolafabio
Copy link
Author

Nope, never worked, seems it was not tested before it get released

@pergolafabio
Copy link
Author

Ah ok ;)

@vincentvanneer
Copy link

Anyone who's been able to get this to work?

It looks like OpenHAB has a nice binding going on at the moment:
https://www.openhab.org/addons/bindings/nikohomecontrol/

I'm thinking about running OpenHAB on another Raspberry PI and using it as a gateway for Niko Home Control, connecting OpenHAB and Home Assistant through MQTT.

I have it up and running in OpenHAB. Working very well. But since I have my whole configuration in Home Assistant, I would like to use it in Home Assistent directly.

When you got the MQTT working, please let me know. That would be an option as well but the problem is that I'm totally not into MQTT. I don't have any clue on how to use it :-)

Regards

Vincent

@Microfi
Copy link

Microfi commented Apr 3, 2019

Hi Vincent. Setup in OpenHAB works perfectly fine, indeed. Almost everything was autodetected after installing the OpenHAB binding. The only thing missing were my switched power sockets.

I've quickly tried playing around with MQTT as well and was able to set up a connection to the MQTT broker I've got running in HomeAssistant (Mosquitto): all the MQTT devices I've got set up in there were automatically discovered by OpenHAB, but none of my "things" in OpenHAB get published to the MQTT broker, meaning I can't see/manipulate them in HomeAssistant. Maybe I need to map my "things" to MQTT objects in some way?!

@pergolafabio
Copy link
Author

closed => #23093

@pergolafabio
Copy link
Author

@NoUseFreak

this was merged in 92.0 ? well we did update, but the same error in log file as in post 1 ?

@pergolafabio pergolafabio reopened this Apr 25, 2019
@pergolafabio
Copy link
Author

pergolafabio commented Apr 25, 2019

error from log 👍

2019-04-25 13:03:38 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform niko_home_control
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/niko_home_control/light.py", line 43, in async_setup_platform
    NikoHomeControlLight(light, niko_data) for light in nhc.list_actions()
  File "/usr/local/lib/python3.7/site-packages/nikohomecontrol/nikohomecontrol.py", line 36, in list_actions
    return [Action(action, self) for action in self.list_actions_raw()]
  File "/usr/local/lib/python3.7/site-packages/nikohomecontrol/nikohomecontrol.py", line 36, in <listcomp>
    return [Action(action, self) for action in self.list_actions_raw()]
  File "/usr/local/lib/python3.7/site-packages/nikohomecontrol/nikohomecontrol.py", line 77, in _init_
    self._id = action['id']
TypeError: string indices must be integers

@pergolafabio
Copy link
Author

if we remove the IP address from config, the error is gone
but how to see lights?

@raphk82
Copy link

raphk82 commented Apr 27, 2019

Anybody got this to work with the new version 0.92.0?

I still get an error:
2019-04-26 22:23:33 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform niko_home_control Traceback (most recent call last): File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform SLOW_SETUP_MAX_WAIT, loop=hass.loop) File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for return fut.result() File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result raise self._exception File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step result = coro.throw(exc) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/niko_home_control/light.py", line 37, in async_setup_platform await niko_data.async_update() File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/niko_home_control/light.py", line 113, in async_update self._nhc.list_actions_raw) File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/lib/python3.5/site-packages/nikohomecontrol/nikohomecontrol.py", line 33, in list_actions_raw return self._command('{"cmd":"listactions"}') File "/srv/homeassistant/lib/python3.5/site-packages/nikohomecontrol/nikohomecontrol.py", line 51, in _command data = json.loads(self.connection.send(cmd)) File "/usr/lib/python3.5/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes'

When I remove the IP address I get an invalid configuration notification even though the host parameter is said to be optional on the component page of the Niko component.

@vincentvanneer
Copy link

Hi Raphael

I have the same issue...

Regards

Vincent

@Microfi
Copy link

Microfi commented Apr 27, 2019

Hi Vincent, Raph, Fabio,

I just upgraded to 0.92.0 as well and my lights are coming up as entities.
I had to specify the IP address of my Niko IP Interface, though. Otherwise I was getting a config error.

I'm currently playing around a bit and a "bug" I've immediately noticed, is that there is a significant delay in the reading of the state (on/off) of my lights. This means that - if you want to change the state in Home Assistant, while the current state hasn't been updated yet - the action will fail.

The lights also seem to only support simple on/off state changes. No dimming.

@pergolafabio
Copy link
Author

Yes, state is not implemented yet, will be better in newer release, this version was just a bugfix...
Strange that it works on your end...

@Microfi
Copy link

Microfi commented Apr 27, 2019

Are you not even seeing the entities coming up, after changing configuration?
Have you specified the IP address of the Niko IP Interface and performed a restart of Home Assistant?

@pergolafabio
Copy link
Author

Yes , well Vincent did, I don't have Niko, just helping... Tried with and without ip address and offcourse restarted Hassio, still the same error as in first post

@Microfi
Copy link

Microfi commented Apr 27, 2019

I just found out some of my lights are NOT detected after all.
Will try to find out what the difference is in my Home Control config and will report back ...

@NoUseFreak
Copy link
Contributor

@pergolafabio It was indeed merged into 0.92.0

@Microfi I am aware of the delays of the states. Can you verify the missing lights are dimmable? These are expected not to work as NHC1 does not support these. They also don't show up in the Official NHC app.

@NoUseFreak
Copy link
Contributor

@raphk82 Can you verify your installation is v1, I'm unable to reproduce your error?

@Microfi
Copy link

Microfi commented Apr 27, 2019

@Microfi I am aware of the delays of the states. Can you verify the missing lights are dimmable? These are expected not to work as NHC1 does not support these. They also don't show up in the Official NHC app.

You're absolutely correct. They don't show up in the app either.
I don't remember this always being the case, though ... or am I incorrect?

Do you know whether there is some kind of workaround to get them integrated anyway?
I see that the people at OpenHAB have been able to integrate dimmers as well: https://www.openhab.org/v2.2/addons/bindings/nikohomecontrol/

@pergolafabio
Copy link
Author

But what about the error as in 1st post? What could it be?

@raphk82
Copy link

raphk82 commented Apr 27, 2019

@raphk82 Can you verify your installation is v1, I'm unable to reproduce your error?

@NoUseFreak : Yes according to my iOs app I'm running version 1.10.0.34209 of Niko Home Control and API 1.19.

@stale
Copy link

stale bot commented Jul 26, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 26, 2019
@NoUseFreak
Copy link
Contributor

@legovaer Did you have any luck reproducing this issue. From the error, it seems the action is decoded as a string instead of a list. I'm unable to get this in my current setup.

For reference, I only use lights and switches.

@stale stale bot removed the stale label Jul 28, 2019
@stale
Copy link

stale bot commented Oct 26, 2019

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants