• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Shelly device
#12
(08-25-2019, 09:15 AM)Ulrich.Arnold Wrote:
(08-24-2019, 04:34 PM)curlymo Wrote: That's probably because the first hit already sets the state of the device to up or down. The second hit is ignored because the status is already set.

Maybe you can build a rule that resets the status after each press.

Yes I think that is what happens. But that should be the special thing for shutters instead of the normal switch, that you can hit it again. Works for real shutters too.

Uli

Hi!
This is the relevant device part of the config.json

Code:
        "ShellyHofrolloRauf": {
            "protocol": [ "program" ],
            "id": [{
                "name": "ShellyHofrolloRauf"
            }],
            "program": "php /home/pi/ShellyAction.php",
            "arguments": "",
            "stop-command": "",
            "start-command": "php /home/pi/ShellyAction.php Hofrollo roller/0?go=open",
            "state": "stopped",
            "pid": 0
        },
        "ShellyHofrolloRunter": {
            "protocol": [ "program" ],
            "id": [{
                "name": "ShellyHofrolloRunterOff"
            }],
            "program": "php /home/pi/ShellyAction.php",
            "arguments": "",
            "stop-command": "",
            "start-command": "php /home/pi/ShellyAction.php Hofrollo roller/0?go=close",
            "state": "stopped",
            "pid": 0
        },
        "HofRollo": {
            "protocol": [ "generic_screen" ],
            "id": [{
                "id": 95
            }],
            "state": "up"
        },

and that is the relevant rule-part
Code:
        "HofrolloRauf": {
            "rule": "IF HofRollo.state == up THEN switch DEVICE ShellyHofrolloRauf TO running",
            "active": 1
        },
        "HofrolloRunter": {
            "rule": "IF HofRollo.state == down THEN switch DEVICE ShellyHofrolloRunter TO running",
            "active": 1
        },

and the script
Code:
<?php

printf( "ShellyAction.php Version 1.0.2 2019.08.24\n" );

//phpinfo();

if ( strpos( $argv[2], "roller" ) !== false )
{
    $url = "http://shelly-" . $argv[1] . ".fritz.box/roller/0";
    printf( "%s\n", $url );
    $response = file_get_contents( $url );
    printf( "1. Result=%s\n", $response );
    if ( strpos( $response, "\"state\":\"stop\"" ) === false )
    {
        $stop = "http://shelly-" . $argv[1] . ".fritz.box/roller/0?go=stop";
        printf( "2. %s\n", $stop );
        $response = file_get_contents( $stop );
        printf( "3. Result=%s\n", $response );
    }
    else
    {
        $url = "http://shelly-" . $argv[1] . ".fritz.box/" . $argv[2];
        printf( "4. %s\n", $url );
        $response = file_get_contents( $url );
        printf( "5. Result=%s\n", $response );
    }
}
else
{
    $url = "http://shelly-" . $argv[1] . ".fritz.box/" . $argv[2];
    printf( "%s\n", $url );
    $response = file_get_contents( $url );
    printf( "Result=%s\n", $response );
}

?>

I tried to reset the generic screen by
Code:
http://raspberrypi.fritz.box:5001/control?device=HofRollo&state=undefined
but only up and down are accepted.

The real screen-devices accept the second hit, but the rules seem to ignore the second hit, although the underlying device is a (generic) screen and not a switch

Uli
 
Reply
  


Messages In This Thread
Shelly device - by Ulrich.Arnold - 03-09-2019, 11:24 AM
RE: Shelly device - by curlymo - 03-09-2019, 04:57 PM
RE: Shelly device - by curlymo - 03-09-2019, 05:45 PM
RE: Shelly device - by Ulrich.Arnold - 03-09-2019, 05:58 PM
RE: Shelly device - by curlymo - 03-10-2019, 10:12 AM
RE: Shelly device - by Ulrich.Arnold - 08-16-2019, 04:45 PM
RE: Shelly device - by curlymo - 08-16-2019, 07:02 PM
RE: Shelly device - by Ulrich.Arnold - 08-16-2019, 09:19 PM
RE: Shelly device - by Ulrich.Arnold - 08-24-2019, 03:52 PM
RE: Shelly device - by curlymo - 08-24-2019, 04:34 PM
RE: Shelly device - by Ulrich.Arnold - 08-25-2019, 09:15 AM
RE: Shelly device - by Ulrich.Arnold - 08-27-2019, 05:24 PM
RE: Shelly device - by Ulrich.Arnold - 09-18-2019, 05:43 PM
RE: Shelly device - by curlymo - 09-18-2019, 06:17 PM
RE: Shelly device - by curlymo - 09-26-2019, 02:03 PM
RE: Shelly device - by Ulrich.Arnold - 09-26-2019, 03:23 PM
RE: Shelly device - by Ulrich.Arnold - 10-06-2019, 10:09 AM
RE: Shelly device - by curlymo - 10-06-2019, 10:17 AM
RE: Shelly device - by Ulrich.Arnold - 10-06-2019, 11:36 AM
RE: Shelly device - by curlymo - 10-06-2019, 12:19 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  re-recognition of device sending signals n0l0cale 1 525 02-21-2019, 12:30 PM
Last Post: TerryLewis

Forum Jump:


Browsing: 1 Guest(s)