<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Name="Configuration Tree" Expanded="True" Version="1462" Guid="{C818BF21-44A7-496C-979D-48011674A3A5}" Time="1276302016.1">
    <Autostart Name="Autostart">
        <Plugin File="FHZ1300PC" Identifier="FHZ1300PC">
            gAIpLg==
        </Plugin>
        <Action Name="Set Heater State Variable to unknown">
            EventGhost.PythonCommand(u'eg.globals.HeatingState = "unknown"')
        </Action>
        <Action Name="Set Target Temperature to 21.0 C">
            EventGhost.PythonCommand(u'eg.globals.HeatingTargetTemp = 21.0')
        </Action>
        <Action Name="Set current Temperature to unknown">
            EventGhost.PythonCommand(u'eg.globals.HeatingCurrentTemp = "unknown"')
        </Action>
    </Autostart>
    <Macro Name="Water Alarm">
        <Event Name="FHZ1300PC.HMS100WD,Water: Yes,35912" />
        <Action>
            EventGhost.PythonCommand(u'eg.globals.temp = eg.WinApi.SoundMixer.GetMasterVolume()')
        </Action>
        <Action>
            System.SetMasterVolume(100.0, 0)
        </Action>
        <Action>
            System.PlaySound(u'C:\\beep.wav', 0)
        </Action>
        <Action>
            EventGhost.Wait(3.0)
        </Action>
        <Action>
            System.PlaySound(u'C:\\beep.wav', 0)
        </Action>
        <Action>
            EventGhost.Wait(3.0)
        </Action>
        <Action>
            System.PlaySound(u'C:\\beep.wav', 0)
        </Action>
        <Action>
            EventGhost.PythonCommand(u'eg.WinApi.SoundMixer.SetMasterVolume(eg.globals.temp)')
        </Action>
    </Macro>
    <Folder Name="Electrical Heater" id="17">
        <Macro Name="Electrical Heating Control" Expanded="True">
            <Event Name="FHZ1300PC.HMS100T,2986" />
            <Action Name="Heating on/off">
                EventGhost.PythonScript(u'FS20_Switch_Address = "2222-3333-1234"\n\n\ndef GetAddressFromString(addressString):\n        addressString=\'\'.join(i for i in addressString if i.isdigit())\n        address = 0\n        for i in range(12):\n            address &lt;&lt;= 2\n            address += int(addressString[i]) - 1\n        return address\n\ntry:\n    event = eg.event.payload\n    parts = event.split(",")\n    temp = parts[0].split(":")\n    temp = temp[1].strip()\n    temp = float(temp)\n    eg.globals.HeatingCurrentTemp = temp\nexcept:\n    print "error parsing event for temperature"\n    temp = 20.0\n\nug = eg.plugins.EventGhost.actions["ShowOSD"]()\n\nif temp &lt; eg.globals.HeatingTargetTemp:\n    print "Heating on ("+ str(temp) +" &lt; "+ str(eg.globals.HeatingTargetTemp) +")"\n    eg.plugins.FHZ1300PC.On(GetAddressFromString(FS20_Switch_Address))\n    if eg.globals.HeatingState != "On":\n        eg.globals.HeatingState = "On"\n        ug("Heating on, "+ str(temp) + " C", None, (255,255,255), (0,0,0), 4, (20,0), 0, 1.0, None)\nelse:\n    print "Heating off ("+ str(temp) +" &gt;= "+ str(eg.globals.HeatingTargetTemp) +")"\n    eg.plugins.FHZ1300PC.Off(GetAddressFromString(FS20_Switch_Address))\n    if eg.globals.HeatingState != "Off":\n        eg.globals.HeatingState = "Off"\n        ug("Heating off, "+ str(temp) + " C", None, (255,255,255), (0,0,0), 4, (20,0), 0, 1.0, None)')
            </Action>
        </Macro>
        <Macro Name="Heating++">
            <Event Name="FHZ1300PC.FS20_ON,1124-2133-4111" />
            <Event Name="FHZ1300PC.FS20_DIM_UP,1124-2133-4111" />
            <Action>
                EventGhost.PythonCommand(u'eg.globals.HeatingTargetTemp += 1.0')
            </Action>
            <Action Name="Show Target Temperature">
                EventGhost.ShowOSD(u'{eg.globals.HeatingTargetTemp} Celsius', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 3.0, True)
            </Action>
            <Action>
                EventGhost.PythonCommand(u'print "New Target Temperature: "+ str(eg.globals.HeatingTargetTemp)')
            </Action>
        </Macro>
        <Macro Name="Heating--">
            <Event Name="FHZ1300PC.FS20_OFF,1124-2133-4111" />
            <Event Name="FHZ1300PC.FS20_DIM_DOWN,1124-2133-4111" />
            <Action>
                EventGhost.PythonCommand(u'eg.globals.HeatingTargetTemp -= 1.0')
            </Action>
            <Action Name="Show Target Temperature">
                EventGhost.ShowOSD(u'{eg.globals.HeatingTargetTemp} Celsius', u'0;-64;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 3.0, True)
            </Action>
            <Action>
                EventGhost.PythonCommand(u'print "New Target Temperature: "+ str(eg.globals.HeatingTargetTemp)')
            </Action>
        </Macro>
        <Macro Name="Show current state">
            <Event Name="FHZ1300PC.FS20_OFF,1124-2133-1112" />
            <Event Name="FHZ1300PC.FS20_ON,1124-2133-1112" />
            <Action Name="Show current state of Heater">
                EventGhost.ShowOSD(u'Heater is currently: {eg.globals.HeatingState}\n\nCurrent Temperature: {eg.globals.HeatingCurrentTemp}\n\nTarget Temperature: {eg.globals.HeatingTargetTemp}', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 3.0, True)
            </Action>
        </Macro>
    </Folder>
    <Macro Name="Disable: Electrical Heater">
        <Event Name="FHZ1300PC.FS20_OFF,1124-2133-1113" />
        <Event Name="FHZ1300PC.FS20_DIM_DOWN,1124-2133-1113" />
        <Action>
            FHZ1300PC.Off(5614107)
        </Action>
        <Action>
            EventGhost.DisableItem(XmlIdLink(17))
        </Action>
        <Action>
            EventGhost.ShowOSD(u'Heater disabled', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 3.0, True)
        </Action>
    </Macro>
    <Macro Name="Enable: Electrical Heater">
        <Event Name="FHZ1300PC.FS20_DIM_UP,1124-2133-1113" />
        <Event Name="FHZ1300PC.FS20_ON,1124-2133-1113" />
        <Action>
            EventGhost.EnableItem(XmlIdLink(17))
        </Action>
        <Action>
            EventGhost.ShowOSD(u'Heater enabled', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 3.0, True)
        </Action>
    </Macro>
</EventGhost>
