Niko Home Control status check

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

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

Niko Home Control status check

Post by tcorneillie »

hi all,

i'm looking for a way to update the status of my Domoticz switches, which control my Niko Home Control lights.
The on and off actions in Domoticz are controlled via a python script which executes a JSON request to the NHC gateway. For instance:

script:///home/pi/domoticz/scripts/python/Set_NHC.py "2" "100" "<IP of the nHC gateway>"

this would set the lights for id 2 (kitchen) to ON (100)

I can also execute a script which returns me the full list of all devices and their statuses (in JSON)

So now i would like to match them every X secs. Because it is possible to change the status from outside of Domoticz by pressing a light button in the house (= NHC button).

I thought it would be somewhat like the script i found about updating Philips HUE light statuses, but i can't seem to manage to tweak it for my needs.
https://www.domoticz.com/wiki/Philips_H ... Hue_status

Any suggestions?

Thanks in advance!

Kind regards,
Tom
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Niko Home Control status check

Post by deennoo »

For Niko : use a crontab every 1 minute
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
tcorneillie
Posts: 9
Joined: Tuesday 05 April 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Niko Home Control status check

Post by tcorneillie »

thanks deennoo,

i went running this morning (my usual think-it-over-routine) and i came up with exactly the same thing: why not doing it with a cron and that http://[domoticzip]:[port]/json.htm?...
So if you think this is an option too, chances are higher it'll work ;-)

Kind regs,
Tom
JHTechnics
Posts: 1
Joined: Monday 09 May 2016 15:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Niko Home Control status check

Post by JHTechnics »

Hi,

You should write an interface in nodeJS and open a socket to Niko Home Control.
below some details on what to send :

Tcp port 8000 packets to sent

{"cmd": "startevents"} #to receive events
{"cmd": "listactions"} #to get action list and status
{"cmd": "listlocations"}#to get location list
{"cmd": "executeactions", "id": 1, "value1": 100}

Packets received :

after listations cmd :
{"cmd":"listactions","data":[ {"id":0,"name":"Light hall","type":1,"location":1,"value1":0},{"id":1,"name":"Light Living","type":1,"location":3,"value1":100},{"id":2,"name":"Light Kitchen","type":1,"location":2,"value1":0}]}

after executeactions cmd :
{"event":"listactions","data":[{"id":0,"value1":0}]}

In your case you need to open a socket and send the {"cmd": "startevents"} to receive information on what action is started by a hardware switch.

Regards,
Jeroen Hollemans
JH Technics
tcorneillie
Posts: 9
Joined: Tuesday 05 April 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Niko Home Control status check

Post by tcorneillie »

hi Jeroen,

Sounds like you know what you're talking about. That's great!
the cronjob is implemented for the moment, but it is occasionally causing issues with events and timers, so it's good for now, but certainly not a keeper.

Unfortunately, i don't have NodeJS experience, so your solution sounds a bit 'unknown territory' to me.

You don't have, by any chance, some kind of example?

Thank you in advance and thank you already for the hint.

Kind regards,
Tom
tcorneillie
Posts: 9
Joined: Tuesday 05 April 2016 10:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Niko Home Control status check

Post by tcorneillie »

i am thinking about somehow adding the status update script to the web interface of domoticz.

the only time i need to know the status of devices is when i'm accessing the user interface. Or am i overlooking something...

The cronjob every 1min is causing troubles on timers and sometimes it switches lights back to the previous state on pressing the Niko Home Control switches.

Maybe someone can help me on this? Is there a way to add an extra script to the index.html (for instance) of domoticz?

Kind regs and thanks for all info!
Tom
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest