{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "waiting-chance",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "moving-alexandria",
   "metadata": {},
   "outputs": [],
   "source": [
    "d=DeviceProxy(\"STAT/Docker/1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ranking-aluminum",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Device is now in on state\n"
     ]
    }
   ],
   "source": [
    "state = str(d.state())\n",
    "\n",
    "\n",
    "if state == \"OFF\" or state == \"FAULT\":\n",
    "    d.initialise()\n",
    "    time.sleep(1)\n",
    "state = str(d.state())\n",
    "if state == \"STANDBY\":\n",
    "    d.on()\n",
    "state = str(d.state())\n",
    "if state == \"ON\":\n",
    "    print(\"Device is now in on state\")\n",
    "else:\n",
    "    print(\"warning, expected device to be in on state, is: \", state)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0caa8146",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "version_R *L2SS-379-docker-device [0c12e90b1c311df82edf9ebd0b0e9a3a530f0a81]\n",
      "archiver_maria_db_R True\n",
      "archiver_maria_db_RW False\n",
      "databaseds_R True\n",
      "databaseds_RW False\n",
      "device_recv_R False\n",
      "device_recv_RW False\n",
      "device_sdp_R True\n",
      "device_sdp_RW False\n",
      "device_sst_R True\n",
      "device_sst_RW False\n",
      "device_xst_R False\n",
      "device_xst_RW False\n",
      "device_unb2_R True\n",
      "device_unb2_RW False\n",
      "device_docker_R True\n",
      "dsconfig_R True\n",
      "dsconfig_RW False\n",
      "elk_R True\n",
      "elk_RW False\n",
      "grafana_R True\n",
      "grafana_RW False\n",
      "hdbpp_cm_R True\n",
      "hdbpp_cm_RW False\n",
      "hdbpp_es_R True\n",
      "hdbpp_es_RW False\n",
      "itango_R True\n",
      "itango_RW False\n",
      "jupyter_R True\n",
      "jupyter_RW False\n",
      "prometheus_R True\n",
      "prometheus_RW False\n",
      "tangodb_R True\n",
      "tangodb_RW False\n",
      "tango_prometheus_exporter_R False\n",
      "tango_prometheus_exporter_RW False\n",
      "tango_rest_R True\n",
      "tango_rest_RW False\n",
      "State <function __get_command_func.<locals>.f at 0x7f84a8b4fb70>\n",
      "Status <function __get_command_func.<locals>.f at 0x7f84a8b4fb70>\n"
     ]
    }
   ],
   "source": [
    "attr_names = d.get_attribute_list()\n",
    "\n",
    "\n",
    "for i in attr_names:\n",
    "    exec(\"value = print(i, d.{})\".format(i))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "StationControl",
   "language": "python",
   "name": "stationcontrol"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}