Skip to content

Latest commit

 

History

History
89 lines (57 loc) · 5.75 KB

SCHEDFORMAT.md

File metadata and controls

89 lines (57 loc) · 5.75 KB

EDIMAX Smart Plug Switch SP-1101W - Scheduling-Format

27.12.2014 Stefan Wendler [email protected]

This document describes the format used to schedule ON/OFF times with the "EDIMAX Smart Plug Switch SP-1101W".

General XML Format

When retrieving the schedules from the Plug, the following XML is returned:

<?xml version="1.0" encoding="UTF8"?>
<SMARTPLUG id="edimax">
  <CMD id="get">
    <SCHEDULE>
      <Device.System.Power.Schedule.0 value="ON">F80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Device.System.Power.Schedule.0>
      <Device.System.Power.Schedule.1 value="ON">000000000000000FFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Device.System.Power.Schedule.1>
      <Device.System.Power.Schedule.2 value="OFF">000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Device.System.Power.Schedule.2>
      <Device.System.Power.Schedule.3 value="OFF">000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFF000000000000000000000000000000000000000000000</Device.System.Power.Schedule.3>
      <Device.System.Power.Schedule.4 value="OFF">000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Device.System.Power.Schedule.4>
      <Device.System.Power.Schedule.5 value="OFF">000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Device.System.Power.Schedule.5>
      <Device.System.Power.Schedule.6 value="OFF">000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</Device.System.Power.Schedule.6>
    </SCHEDULE>
  </CMD>
</SMARTPLUG>

For each day an entry like this is included:

<Device.System.Power.Schedule.X value="ON">...</Device.System.Power.Schedule.X>

X = 0 is Sunday, X = 1 is Monday, X = 6 is Saturday. The “value” attribute is “ON” if the schedule for this day is active or “OFF” if disabled. The data of the “Device.System.Power.Schedule.X” tag is 360 characters long. Each hour is represented by 15 characters, thus 360 characters = 24h. For further discussion we will focus on that 360 characters (let's call this "packed schedule".

Packed Schedule Format in Detail

Once again, we have 360 characters representing 24 hours. Thus 15 characters represent 1 hour. This again tells us, that one characters needs to represent 4 minutes to allow as to represent every minute of an hour.

The interesting question now is: how is the 60 minute information encoded (packed) into 15 characters? Well this is very simple. Each character represents four bits. If a bit is set, the minute is set. Then if one transforms each 4-bit value into its corresponding hex value, and if this hex values are joined together, the 15 character string for each hour could be build. By joining together all the 15 characters hour values, we get a whole days schedule.

The above could be best illustrated by example.

To schedule the minute from 00:00 - 00:01 the bits for the first hour would look like this:

1000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

Which would be in hex:

8 0 0 0 0 0 0 0 0 0 0 0 0 0 0

And for 00:00 - 00:02:

1100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

Again in hex:

C 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Now 00:00 - 00:03:

1110 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

In hex:

E 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Then 00:00 - 00:04:

1111 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

In hex:

F 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The same for the next for bytes with 00:00 - 00:05:

1111 1000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

In hex:

F 8 0 0 0 0 0 0 0 0 0 0 0 0 0

... And so forth