Git Product home page Git Product logo

Comments (4)

NoUseFreak avatar NoUseFreak commented on August 22, 2024

@pergolafabio Hi, sorry to hear it's not working for you.

Could you check what the following setup gives if we use just the hnc repo?

mkdir /tmp/testing
cd /tmp/testing
pip3 install venv
python3 -m venv .venv
source .venv/bin/activate
pip3 install niko-home-control==0.2.1

test.py

from nikohomecontrol import NikoHomeControl

nhc = NikoHomeControl({
	'ip': '<your_nhc_ip>',
	'port': 8000,
	'timeout': 20000,
	'events': True
})

for action in nhc.list_actions_raw():
    print(action)
python3 test.py

Could you share the output.

from niko-home-control.

vincentvanneer avatar vincentvanneer commented on August 22, 2024

@NoUseFreak

Hi Dries

I did some testing and can inform you about the results.

I was able to install NHC using the command (pip3 install niko-home-control==0.2.1)

I then tried to run the test.py but received an error. I looked in the class and methods of your solution and also tried to call some other methods. None of them worked.

When I opened Putty and connected to my NHC on port 8000, using TELNET, I was able to paste the commands and I received information from my installation.

For example. When I pasted the command {"cmd":"listactions"} I received this in the putty terminal:

{"cmd":"listactions"}
{"cmd":"listactions","data":[ {"id":16,"name":"Ledstrip keukeneiland","type":1,"location":4,"value1":0},{"id":22,"name":"Toilet gelijkvloers","type":1,"location":2,"value1":0},{"id":23,"name":"Technische ruimte","type":1,"location":3,"value1":0},{"id":25,"name":"Alles uit","type":0,"location":5,"value1":0},{"id":55,"name":"Thuiskomen","type":0,"location":5,"value1":0},{"id":33,"name":"Spots zithoek","type":2,"location":5,"value1":0},{"id":34,"name":"Automatische verlichting","type":1,"location":1,"value1":0},{"id":40,"name":"Stopcontact living","type":1,"location":5,"value1":0},{"id":42,"name":"Spots speelruimte","type":2,"location":5,"value1":0},{"id":43,"name":"Verlichting eetplaats","type":2,"location":5,"value1":0},{"id":44,"name":"Verlichting berging","type":1,"location":6,"value1":0},{"id":49,"name":"TV kijken","type":1,"location":5,"value1":0},{"id":50,"name":"Zwembadpomp","type":1,"location":8,"value1":100},{"id":51,"name":"Zwembadverlichting","type":1,"location":8,"value1":0},{"id":52,"name":"Buitenverlichting poolhouse","type":1,"location":8,"value1":0},{"id":54,"name":"Verlichting garage","type":1,"location":7,"value1":0},{"id":56,"name":"Verlichting keukeneiland","type":2,"location":4,"value1":100},{"id":61,"name":"Koken","type":1,"location":4,"value1":0}]}

I was also able to turn on and off my devices using the correct ID.

For example. When I entered: {"cmd": "executeactions","data":[{"id":16,"value1":100}]}

my kitchen ledstrip turned on immedialtely. I also noticed the change of the value when I reran the {"cmd":"listactions"}

The same when I ran: {"cmd": "executeactions","data":[{"id":16,"value1":0}]}

Kitchen ledstrip turned off

For my dimmers I figured out that I could use:

{"cmd":"executeactions","data":[{"id":56,"value1":10, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":20, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":30, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":40, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":50, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":60, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":70, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":80, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":90, "value2":0}]}
{"cmd":"executeactions","data":[{"id":56,"value1":100, "value2":0}]}

And

{"cmd":"executeactions","data":[{"id":56,"value1":0, "value2":0}]}

To turn them off.

Hope this can help you.

I think it's somewhere in the way the commands are send to the NHC controller.

I tried different ways to get it working but for now, it only worked using putty and connect with telnet

Kind regards

Vincent

from niko-home-control.

vincentvanneer avatar vincentvanneer commented on August 22, 2024

This is the sysinfo by the way:

{"cmd":"systeminfo"}
{"cmd":"systeminfo","data":{"swversion":"1.3.2.38","api":"1.21","time":"20190515154115","language":"NL","currency":"EUR","units":0,"DST":3600,"TZ":3600,"lastenergyerase":"","lastconfig":"20190125185345"}}

from niko-home-control.

NoUseFreak avatar NoUseFreak commented on August 22, 2024

@vincentvanneer Could you share some errors you get when running the test.py file.

I expect something it can't handle in the result it's getting.
It points to some case where the raw action is not an object but a string.

Would you mind printing the value of action in the __init__ method of Action.

class Action:
   def __init__(self, action, hub):
       print(action)
       self._id = action['id']
       self._state = action
       self._hub = hub```

from niko-home-control.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.