#!C:\Python36\python.exe
# -*- coding: utf-8 -*-
import json
import random
print("Content-Type: text/html")
print("")
A0  = str(random.choice([0,1]))
A1  = str(random.choice([0,1]))
A2  = str(random.choice([0,1]))
A3  = str(random.choice([0,1]))
A4  = str(random.choice([0,1]))
A5  = str(0)
A6  = str(random.choice([0,1]))
A7  = str(random.choice([0,1]))

bitmask = A0 + A1 + A2 + A3 + A4 + A5 + A6 + A7

JSON = {
  "AC": 218.8,
  "DC": 230.4,
  "in_freq": 50.0,
  "out_freq": 50.0,
  "pwr": 40.0,
  "line_fail": 1,
  "low_battery": 1,
  "bat_cap": 92.0,
  "inner_temp": 27.0,
  "bat_time_left": 230.0,
  "di1": "1",
  "ro1": "0",
  "ro2": "1",
  "ro3": "1",
  "batsym": "Норма",
  "mode": "Профилактика сульфатации",
  "u_alarm": "5",
  "m_alarm": "0",
  "utc": "3.0",
  "netsettings_changed": "false"
}
print(json.dumps(JSON))
