Jump to content

Recommended Posts

Posted (edited)

First request (in order of time, not necessarily by urgency)
1. Limiting global current on a multiswitch by temporarily shutting some loads. Used when there is a maximum current that can be drawn by grid, but is possible that local user try to absorb more than allowed (For example a kitchen with oven, dishwasher, microwave, fridge.)
when total absorbed current (by all the 4/2 lines) is over a settable threshold the script should remove one or more loads according a table that for every utilizer specifies the maximum time can remain without supply [0 means that cannot be interrupted, 99999 that can be always turned off, otherwise seconds], removing first the ones that have more available off-time, when one arrive 2/3 of allowed off time is switched off next one an the first one is resupplied, regaining "off-time" at the same rate.
2. Shelly 4PM and 2PM
3. Input: internal current meter Output: local relay [optionally: webhook to command other devices]
4. N/A
5. (optional) possibility to connect more PM devices as a group
6. N/A
7. Example of algorithm:
     I₀…Iₙ are the current readings from the nth output [read by device]
     Iₐₗₗ it the maximum allowed absorb from net [user set]
     Moff_time₀…Moff_timeₙ are the maximum times that each consumer may be set off [user set, 0 means never, otherwise are seconds
     Iₜₒₜ OC₀…OCₙ are temporary registers
     - every 10 seconds is computed Iₜₒₜ=∑Iₙ and if it is greater than Iₐₗₗ then:
     -      if there is an output with Iₙ>Iₐₗₗ-Iₜₒₜ it is set off and started counting OCₙ [actually OCₙ may be set to the time when have been forced off so works both as counter and as flag]
            else are taken one at a time all active loads in order of decreasing Moff_time.
            every 90 seconds [this number should be programmable according the characteristics of main switch] looking for every at (now()-OCₙ)/Moff_timeₙ value the decision of what to switch is reevaluated [for the load supplied: OCₙ+=(90*2) ] . You assume that the load of a restored output would be the same as when it was detached.
            if some load is reattached after 10 second start again the process [that is every 10 seconds you check if there is overcurrent, but to reinstate a detached load you wait at least 90 seconds 


              

 

Edited by wooly
Posted (edited)

Second request:

It is more a request for firmware update...
1. on 2PM used as cover add to the open and close commands [either as action and as rpc calls] also the position option as in go_to , allowing to shut to a certain position (or to open at a certain position) only if can be made with a closing (opening) movement . In short: if i ask "close do 10%" and is already closed, would not end in an "open to 10%" [to make an example: /rpc/Cover.close?id=0 would work as now, but /rpc/Cover.close?id=0&pos=25 would go to 25 only if current_position>25 , that is if can reach pos only with a closing movement. 
Example: the blind to the balcony closes to 5% at sunset. it doe not have to close automatically at 0% since if someone were outside with 5% may manually open it. If you close it manually however you are aware if someone is out, so you may close to 0%. With current situation, if you manually close to 0% because outside is cold and you do not need natural light at sunset it would actually _open_ to 5%
2. 2PM in all variants [only cover mode]
3. same as current one
4. n/a
5. n/a
6. n/a [being a  new suboption would not change the current API - old code would continue to work as now]
7. someone posted something about ... a complete integration would be better

Edited by wooly
more details on usage
Posted

Good Day,

I have 2 requests, but i will start with the simpler one below:

Script Description:

The script is intended to control a sliding door at the main entry to a building. The device will close the door automatically at 6pm every day. The door is controlled by 2
access control terminals that have dry contacts momentary PB operation to activate the motor. Between 6pm and 6am daily if a signal is received by any of the access terminals, output 1 of the
Shelly should mimic the PB functionality to open the door, wait 45  secs and then send a PB signal on output 2 to close the door.

 

2. Target Device(s):

Shelly Pro 2

 

3. Inputs and Outputs:

• Inputs: 1 dry contact input from access control terminal

• Outputs: Activate Output 1 (duration 1sec), wait 45sec, Activate Output 2 (duration 1 sec)

 

4. Third-Party Integration:

• Required Protocol/API: No

• Documentation or Link: NA

 

5. Additional Features:

During the operation of receiving a signal, opening the gate, waiting and closing, the shelly should ignore any other input it receives.
Total time of script execution is estimated to be 130sec

 

6. Known Constraints:

None

 

7. Existing Code or Examples (Optional):

Below is my pseudocode for the project:

Begin
On Input 1 active

    If Time > 18:00 OR Time <6:00 Then
        Suppress inputs for 90sec
        Activate Output 1 (1sec duration)
        Wait 45sec
        Activate Output 2 (1sec duration)
        Wait 45sec
        Unsuppress inputs
    Else
        Suppress inputs for 45sec
        Activate Output 1 (1sec duration)
        Unsuppress inputs
    End If
End    

 

Any assistance given will be much appriciated.

Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...