cryptk / python-omnilogic-local

Python Omnilogic Library for local access
Apache License 2.0
3 stars 1 forks source link

Add support for "EditUIScheduleCmd" to allow toggling of schedules #3

Open cryptk opened 1 year ago

cryptk commented 1 year ago

EditUIScheduleCmd is used to modify schedule entries. It is msg type 233. Below is an example of the XML

<?xml version="1 0" encoding="utf-8"?>
<Request>
    <Name>EditUIScheduleCmd</Name>
    <Parameters>
        <Parameter name="EquipmentID" dataType="int">15</Parameter>
        <Parameter name="Data" dataType="int">50</Parameter>
        <Parameter name="ActionID" dataType="int">164</Parameter>
        <Parameter name="StartTimeHours" dataType="int">8</Parameter>
        <Parameter name="StartTimeMinutes" dataType="int">30</Parameter>
        <Parameter name="EndTimeHours" dataType="int">19</Parameter>
        <Parameter name="EndTimeMinutes" dataType="int">30</Parameter>
        <Parameter name="DaysActive" dataType="int">127</Parameter>
        <Parameter name="IsEnabled" dataType="bool">0</Parameter>
        <Parameter name="Recurring" dataType="bool">1</Parameter>
    </Parameters>
</Request>

That API request maps to the following schedule entry in the MSPConfig

        <sche>
            <bow-system-id>7</bow-system-id>
            <equipment-id>8</equipment-id>
            <schedule-system-id>15</schedule-system-id>
            <event>164</event>
            <data>50</data>
            <enabled>0</enabled>
            <start-minute>30</start-minute>
            <start-hour>8</start-hour>
            <end-minute>30</end-minute>
            <end-hour>19</end-hour>
            <days-active>127</days-active>
            <recurring>1</recurring>
        </sche>

For now at least, creating/deleting schedules is out of scope, lets stick with just being able to toggle them on/off

djrobx commented 4 months ago

It's good to see this is possible.

I'm interested in creating an automation that shifts the pump schedule to run during the day or night, based on water temperature and weather. Being able to toggle schedules would work perfectly for that.