NC800 8CH Relay

I am looking to add a few NC800 8-Channel Ethernet controlled relays to my house…

I suspect that I will need to add these as restful switches, but can use help setting up the templates (including knowing which templates to use).

They are pretty cookie cutter… the first one is IP address 172.16.251.11

To get the status of the first four relays, you make the following call:
http://172.16.251.11/30000/42 or from the terminal, you can use curl.
Sending the same request a second time gives you the next four relays.

curl 172.16.251.11/30000/42

Relay-ALL &nbspON&nbsp&nbsp&nbsp &nbsp ALL-ON

Relay-ALL OFF &nbsp&nbsp&nbsp ALL-OFF

Relay-01: OFF&nbsp&nbsp ON/OFF-01

Relay-02: OFF&nbsp&nbsp ON/OFF-02

Relay-03: OFF&nbsp&nbsp ON/OFF-03

Relay-04: OFF&nbsp&nbsp ON/OFF-04

Change IP/Port:&nbsp&nbsp&nbsp&nbsp Enter

Next Page

**%**

curl 172.16.251.11/30000/42

Relay-ALL &nbspON&nbsp&nbsp&nbsp &nbsp ALL-ON

Relay-ALL OFF &nbsp&nbsp&nbsp ALL-OFF

Relay-05: OFF&nbsp&nbsp ON/OFF-05

Relay-06: OFF&nbsp&nbsp ON/OFF-06

Relay-07: OFF&nbsp&nbsp ON/OFF-07

Relay-08: OFF&nbsp&nbsp ON/OFF-08

Change IP/Port:&nbsp&nbsp&nbsp&nbsp Enter

Next Page

**%**

172.16.251.11/30000/00 - Turns Relay 1 Off
172.16.251.11/30000/01 - Turns Relay 1 On
172.16.251.11/30000/02 - Turns Relay 2 Off
172.16.251.11/30000/03 - Turns Relay 2 On
172.16.251.11/30000/04 - Turns Relay 3 Off
172.16.251.11/30000/05 - Turns Relay 3 On
172.16.251.11/30000/06 - Turns Relay 4 Off
172.16.251.11/30000/07 - Turns Relay 4 On
172.16.251.11/30000/08 - Turns Relay 5 Off
172.16.251.11/30000/09 - Turns Relay 5 On
172.16.251.11/30000/10 - Turns Relay 6 Off
172.16.251.11/30000/11 - Turns Relay 6 On
172.16.251.11/30000/12 - Turns Relay 7 Off
172.16.251.11/30000/13 - Turns Relay 7 On
172.16.251.11/30000/14 - Turns Relay 8 Off
172.16.251.11/30000/15 - Turns Relay 8 On

172.16.251.11/30000/44 - Turns Relay’s 1-8 Off
172.16.251.11/30000/45 - Turns Relay’s 1-8 On

I want to define this as 8 individual toggles on one switch/unit that shows the correct status for each toggle and that has an all on / all off option…

OK… so I wound up doing this as a command-line switch…

# NC800 Command Line Support
switch:
  - platform: command_line
    switches:
      nc_800_01_relay_1:
        unique_id: nc_800_01_relay_01
        friendly_name: "NC-800-01 Relay-01"
        command_off: "curl 172.16.251.11/30000/00"
        command_on: "curl 172.16.251.11/30000/01"
      nc_800_01_relay_2:
        unique_id: nc_800_01_relay_02
        friendly_name: "NC-800-01 Relay-02"
        command_off: "curl 172.16.251.11/30000/02"
        command_on: "curl 172.16.251.11/30000/03"
      nc_800_01_relay_3:
        unique_id: nc_800_01_relay_03
        friendly_name: "NC-800-01 Relay-03"
        command_off: "curl 172.16.251.11/30000/04"
        command_on: "curl 172.16.251.11/30000/05"
      nc_800_01_relay_4:
        unique_id: nc_800_01_relay_04
        friendly_name: "NC-800-01 Relay-04"
        command_off: "curl 172.16.251.11/30000/06"
        command_on: "curl 172.16.251.11/30000/07"
      nc_800_01_relay_5:
        unique_id: nc_800_01_relay_05
        friendly_name: "NC-800-01 Relay-05"
        command_off: "curl 172.16.251.11/30000/08"
        command_on: "curl 172.16.251.11/30000/09"
      nc_800_01_relay_6:
        unique_id: nc_800_01_relay_06
        friendly_name: "NC-800-01 Relay-06"
        command_off: "curl 172.16.251.11/30000/10"
        command_on: "curl 172.16.251.11/30000/11"
      nc_800_01_relay_7:
        unique_id: nc_800_01_relay_07
        friendly_name: "NC-800-01 Relay-07"
        command_off: "curl 172.16.251.11/30000/12"
        command_on: "curl 172.16.251.11/30000/13"
      nc_800_01_relay_8:
        unique_id: nc_800_01_relay_08
        friendly_name: "NC-800-01 Relay-08"
        command_off: "curl 172.16.251.11/30000/14"
        command_on: "curl 172.16.251.11/30000/15"

What this doesn’t give me is the status of the switches… so I am thinking about setting it up as a command line sensor…

If I do the following:

curl 172.16.251.11/30000/42 | grep -m 1 -o 'Relay-0[^>]*' > status.txt  ; curl 172.16.251.11/30000/42 | grep -m 1 -o 'Relay-0[^>]*' >> status.txt

Then I get output:

Relay-01: <font color="#FF0000"
Relay-02: <font color="#FF0000"
Relay-03: <font color="#FF0000"
Relay-04: <font color="#FF0000"
Relay-05: <font color="#00FF00"
Relay-06: <font color="#00FF00"
Relay-07: <font color="#00FF00"
Relay-08: <font color="#FF0000"

Where font color="#FF0000" (red) means off and font color="#00FF00" (green) means on… so now I need to figure out how to have this parsed into status for each of the 8 entities…

Help would be much appreciated!

Hello,

I would also like to know how to easily integrate that as i’m also using nc801 8ch ethernet controller for my board. I’m able to control the relays but no way to get the status of each one.

Thanks

Hi,

Is the web server have some UI?

If yes, is there a user manual the explains how screen looks like?

If no, how easy is to change IP address?

Hi,

I have prepared a script in Python, you only need to change the IP address. Add a new file in the config folder, e.g. “process_data.py”, paste the script code inside, setting the IP as you gave it to your relay.:

import requests

Relay_Results = []
Cyfry = []
Stan = []
Wyniki = []

# The URL of the local page
url = 'http://192.168.1.4/30000/42'
response = requests.get(url)
if response.status_code == 200:
    page_content = response.text

    # Link the results to the next page
    url = 'http://192.168.1.4/30000/42'
    response = requests.get(url)
    if response.status_code == 200:
        page_content += response.text

# Divide the content of the page into lines
lines = page_content.split('/a')

# Search for lines containing "Relay-0"
Relay_Lines_Position = [line.find('Relay-0') for line in lines]

for i in range(len(Relay_Lines_Position)):
    if Relay_Lines_Position[i] > 0:
        Relay_Results.append(lines[i])
        Cyfry.append(int(lines[i][Relay_Lines_Position[i] + 7]))
        Stan.append('<font color="#00FF00">' in lines[i])

# Iterate through Digits and retrieve the appropriate State
for Cyfra in Cyfry:
    Wyniki.append(Stan[Cyfra-1])

# View relay status information
for i, element in enumerate(Wyniki):
    print(f"Relay {i+1}: {'ON' if element else 'OFF'}")

result = Wyniki

#print(result)

Then you need to invoke this script:

sensor
  - platform: command_line
    name: Relay_State
    command: "python3 /config/process_data.py"

The state of relays is now available in the Entity: Relay_State

Is this referring to this relay? https://www.amazon.co.uk/gp/product/B0DX71QT23

I am interested in buying this relay and Google referred me to this page, however, there are no technical specifications that I can find anywhere. The photo clearly says it requires a 12V DC power supply, but not the maximum current/power draw, it does not say if it is a dry contact relay, and it does not say what is the maximum AC/DC voltage and current it can drive per relay. It’s not even clear to me who the manufacturer is. Is there a PDF manual somewhere? Thank you!