Niko Home Control Topic is solved

Others (MiLight, Hue, Toon etc...)
Post Reply
djmoon
Posts: 26
Joined: Wednesday 16 March 2016 17:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Niko Home Control

Post by djmoon » Thursday 17 March 2016 22:42

Hello world !

I'm Jerome from Belgium.
I have a "Niko Home Control" (NHC) system in my home but the possibilities are limited... :x
I would like to control shutters with "Niko Home Control" and "Daikin altherma Heatpump" with RPi GPIO to limit overheat of my home. But the sun heat the home most of days and it'snt interesting to close the shutters always...

In my project I see the oportunities to use Domoticz to control the temperature part of the home (not possible easily with Niko Home Control)

But...

I would like to show the "Niko Home control" device like Hardware/devices in Domoticz.

I already do some code in Python to control one or more output easily. I can use "dummies" hardware to control them but It'll be better to add them like hardware.

I'm newbies in Domoticz, I look at source code but I don't find hardware to use like a base to do it.

The example here above turn off the light with id=7
The NHC system are "easily" controlable by sending the command by TCP in JSON format.
I already have PHP code to list (return JSON) the peripherals present on the NHC system.

Python 3.x code example

Code: Select all

import socket

TCP_IP = '192.168.0.26'
TCP_PORT = 8000
BUFFER_SIZE = 1024
MESSAGE = '{"cmd":"executeactions","id":"7","value1":"0"}'
//print (MESSAGE)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE.encode('utf-8'))
data = s.recv(BUFFER_SIZE)
s.close()
 
print ("received data:", data.decode('utf-8'))

Do somebody interesting too by this project ?
Some ideas, hardware use like base for starting script ?

Thanks in advance and sorry for my approximate english !
Jerome

djmoon
Posts: 26
Joined: Wednesday 16 March 2016 17:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by djmoon » Friday 18 March 2016 22:29

Hello world,

I continue my projet and I've first basic results.
I'm able to control with domoticz on/off action on Niko Home Control with this simple first python3 script

Code: Select all

#!/usr/bin/python

"""
03/18/2016 Set_NHC V1.0
Niko Home Control (NHC) Set actions from Python3 
Control Actions by sending TCP command

Use : Set_NHC.py [Outpu_ID] [Output_Value] [IP_dest]
example : python3 Set_NHC.py "35" "0" "192.168.0.26"
Output_ID = 6 : The ID of action to control
Output_Value = 100 (Value from 0 to 100 %)
IP_dest = IP of the Niko Home control IP module (use your router to fix the IP with MAC Adress)

Take care of permissions on this file to execute as script from Domoticz use this command before use !
sudo chmod +x Set_NHC.py
""" 

# lib for TCP connection
import socket

# lib to use arguments
import sys

TCP_PORT = 8000
BUFFER_SIZE = 1024

# Read arguments used to launch this command
Output_ID = sys.argv[1]
Output_Value = sys.argv[2]
IP_dest = sys.argv[3]

# Made the message to send to NHC IP controller (JSON format)
TCP_Message = '{"cmd":"executeactions","id":"' + str(Output_ID) + '","value1":"' + str(Output_Value) + '"}'

# print only used for debugging
print ('Connect to NHC IP : '+ IP_dest)
print ('Message send : ' + TCP_Message)

# connect to IP and send message
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((IP_dest, TCP_PORT))
s.send(TCP_Message.encode('utf-8'))

# receive reply from NHC
data = s.recv(BUFFER_SIZE)
s.close()

# Message from NHC (no test of the message in this first version 
print ('Reply from NHC IP : ' + data.decode('utf-8'))

# NHC must reply error 0 : {"cmd":"executeactions", "data":{"error":0}}
 
To use it on Domoticz :
- Create a "Dummies" Hardware
- Create device for this Hardware
- Go to "Switches"
- "Manual Light/switch"
- Select
- the Hardware created
- name the NHC action to control
- Switch type : On/Off
- Type : X10 (I don't find other things to select)
- House code A, Unit code 1 (choose a different one for each actions > I don't find other things to select)
- Add device
- Edit it
- Put On Action script : script:///home/pi/domoticz/scripts/python/Set_NHC.py "6" "100" "192.168.0.26"
- Put OFF Action script : script:///home/pi/domoticz/scripts/python/Set_NHC.py "6" "0" "192.168.0.26"
Where you replace "6" by the Action_ID to control
Where you replace "100" by the value to reach (0 to 100)
Where you replace "192.168.0.26" by the IP of your NHC IP module

Save it and play !

tcorneillie
Posts: 9
Joined: Tuesday 05 April 2016 10:19
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by tcorneillie » Tuesday 05 April 2016 21:49

hi djmoon,

i'm totally interested in your project here! I've been looking all over the Internet to find a solution for this.
They've also installed NHC in my house and i'm very unsatisfied with this 'system'.
The app is too slow, the system always stops working after a few weeks and it is not accessible over the gateway anymore and everything i want to do is very expensive.
So i also want to start controlling it using domoticz (on a raspberry pi)

i hope i can help in some way but i'm completely new at this.

Kind regs,
Tom

djmoon
Posts: 26
Joined: Wednesday 16 March 2016 17:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by djmoon » Wednesday 13 April 2016 21:09

Nice to know that other people are interesting too !

I find an other project to control with HTML5/PHP Niko Home control but like I said I think that's the best way is to do a "connector" to a existing free software like domoticz... https://github.com/jaader/PortailNHC (I use it to list the device at this time...)

Actually I work on the hardware parts in my home (temperature measurment, light measurment) and I don't have a lot of time to continue the NHC part of the project... but my actual code is enough for first try !

I don't have problems with NHC apps or hardware... it work fine in my home... but you don't have a lot of functions... and I don't have money to spend in gateway ! you can buy 10 raspberry Pi2 for the price ! :-)

Keep contact to speek about our work !

Jerome
(sorry for approximate english, my mother langages is french)

tcorneillie
Posts: 9
Joined: Tuesday 05 April 2016 10:19
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by tcorneillie » Wednesday 13 April 2016 22:34

FR => pas de souci. ;-)

i have found a LUA script to update the status of philips HUE lights. they actually have the same problem => they can also be switched on 'externally' (= from outside of domoticz).
https://www.domoticz.com/wiki/Philips_H ... Hue_status
I hope to find a way to get this up and running to update my domoticz with the NHC statuses.

Kind regards,
Tom

djmoon
Posts: 26
Joined: Wednesday 16 March 2016 17:54
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by djmoon » Tuesday 19 April 2016 20:54

Hi Tom,

Yes it'll be a good thinks to work like Hue light... it's seem to work like NHC.

I've to learn about Lua... I don't realy do thinks with it at this time... I begin too in RPi world ! I've tried Python... I would like to use C++ too and I'll be fun to learn Lua too... Itch ! But the example gived is a good start to learn !

thanks !
Jerome

cadeboer
Posts: 1
Joined: Tuesday 10 October 2017 21:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by cadeboer » Tuesday 10 October 2017 21:33

hi

when i try to edit the on and off script i get the notification that my on action is incorrect.What do i do wrong.

Casper

remko2000
Posts: 39
Joined: Thursday 28 December 2017 15:38
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Niko Home Control

Post by remko2000 » Sunday 31 December 2017 13:48

Does Niko use the same protocol like Easywave? I want to add my sunscreen with easywavereceiver import in domoticz but my rflink868 doesnt receive anything. So I am stuck.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests