Skip to content

Mijia Smart Socket 2 China (ZNCZ07CM)

Sergey edited this page Sep 14, 2025 · 1 revision

Before using this device you need to get ip/token
Please follow this guide to get them

var socket = new MijiaSmartSocket2China("ip", "token");

// Get socket info
Console.WriteLine(socket.ToString());

// Is socket turned on
Console.WriteLine(socket.IsTurnedOn);

// Turn on socket
socket.TurnOn();

// Turn off socket
socket.TurnOff();

// Toggle socket state
socket.TogglePower();

// Get socket temperature (in celsius)
Console.WriteLine(socket.Temperature);

// Enabled led indicator
socket.LedEnabled = true;

// Is led indicator enabled
Console.WriteLine(socket.LedEnabled);

// Get curret electric of the socket
Console.WriteLine(socket.ElectricCurrent);

// Get voltage of the socket
Console.WriteLine(socket.Voltage);

// Get electric power of the socket
Console.WriteLine(socket.ElectricPower);

// Is over power protection enabled
Console.WriteLine(socket.OverPowerEnabled);

// Enable over power protection
socket.OverPowerEnabled = true;

// Set socket power protation to 2500 watt
socket.OverPowerThreshold = 2500;

Clone this wiki locally