Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 207 on Ring set value (alarm) #8

Open
multinet33 opened this issue Jun 15, 2021 · 10 comments
Open

Error 207 on Ring set value (alarm) #8

multinet33 opened this issue Jun 15, 2021 · 10 comments

Comments

@multinet33
Copy link

Hello

I'm using ring plugin under hombridge i'ts ok

Now I want to automate my alarm mode via script and i'm using homescript

It is correctly installed because when I run python3 hs.py -l I get all my accessories :
pi@domoticz:~$ python3 hs.py -l
Accessory/Group not found.
Here are a list of accessories:

Alarm security-panel
Base_Station hub.redsky
Baie_vitree sensor.contact
Pavé_numérique_entree security-keypad
Salle_à_manger sensor.motion
Salon Indoor Cam (stickup_cam_mini)

Now I can get the mode for Alarm :
pi@domoticz:~$ python3 hs.py -g Alarm
Alarm [{'iid': 10, 'description': 'Security System Current State', 'value': 3}, {'iid': 11, 'description': 'Security System Target State', 'value': 3}]

But now i don't now how to set the value for alarm mode (target state i believe)
I get the value for each mode :
Disarm : 3
Home: 0
Away : 1

I tried multiple things but I get every time this

<Response [207]>
Alarm Error: -70404

thans for all

@wesmwitt
Copy link

Ive been getting something similar ever since I moved my PC to a new house. I can list accessories but when I try to set I get

<Response [207]>
________ Error: -70410

@multinet33
Copy link
Author

I have a solution via curl

curl -X PUT http:https://192.168.1.156:51728/characteristics --header "Content-Type:Application/json" --header "authorization: HID-DD-EN" --data "{"characteristics":[{"aid":2,"iid":11,"value":1}]}"

replace the ip/port with your homebridge IP/port
replace HID-DD-EN with the 3x3x3 digits of your home bridge for pairing
Check the aid with this command : python3 hs.py -l aid

Value for mode :
Disarmed : 3
ArmedHome : 0
ArmedAway : 1

@menahishayan
Copy link
Owner

Judging by @multinet33's comment you should be able to do:

 python3 hs.py -s Alarm 3 # Disarmed
 python3 hs.py -s Alarm 0 # ArmedHome
 python3 hs.py -s Alarm 1 # ArmedAway

Let me know if it works.

@shanemcw
Copy link

I have the exact error codes when attempting to set a position on blinds:

./hs.py -g Study_South_Blinds
Study_South_Blinds [{'iid': 10, 'description': 'Current Position', 'value': 100}, {'iid': 11, 'description': 'Position State', 'value': 2}, {'iid': 12, 'description': 'Target Position', 'value': 

./hs.py -s Study_South_Blinds 0
<Response [207]>
Study_South_Blinds Error: -70404

As an aside while I was debugging, I seem to also be getting an error when attempting to use the -d option. When I use -d (e.g. using -d with the above or even ./hs.py -d -l) both
homescript_debug_2021.10.27.log and homescript_exception_2021.10.27.log are zero bytes and the following is sent to the console:

Traceback (most recent call last):
  File "./hs.py", line 56, in <module>
    hs = homescript.HomeScript(__HOSTNAME__,__PORT__,__AUTH__, args.debug, sys.argv)
  File "/usr/local/lib/python3.8/dist-packages/homescript/__init__.py", line 29, in __init__
    self.debugHandler('init',argv)
  File "/usr/local/lib/python3.8/dist-packages/homescript/__init__.py", line 191, in debugHandler
    logging.basicConfig(filename=self.exceptionFile,filemode = 'a',encoding='utf-8', level=logging.DEBUG)
  File "/usr/lib/python3.8/logging/__init__.py", line 2009, in basicConfig
    raise ValueError('Unrecognised argument(s): %s' % keys)
ValueError: Unrecognised argument(s): encoding
Debug logged: homescript_debug_2021.10.27.log

@colinrblake
Copy link

I have the same problem. Anyone have a solution?

./hs.py -g Nest
Nest_Thermostat [{'iid': 10, 'description': 'Target Heating Cooling State', 'value': 2}, {'iid': 11, 'description': 'Current Temperature', 'value': 26.1222}, {'iid': 12, 'description': 'Target Temperature', 'value': 26.1}, {'iid': 13, 'description': 'Temperature Display Units', 'value': 1}, {'iid': 14, 'description': 'Current Relative Humidity', 'value': 55}, {'iid': 15, 'description': 'Cooling Threshold Temperature', 'value': 26.1}, {'iid': 16, 'description': 'Heating Threshold Temperature', 'value': 20}, {'iid': 17, 'description': 'Status Active', 'value': 1}, {'iid': 18, 'description': 'Fan Timer Active', 'value': 1}, {'iid': 19, 'description': 'Fan Timer Duration', 'maxValue': 1440, 'minValue': 0, 'minStep': 15, 'value': 0}, {'iid': 20, 'description': 'Has Leaf', 'value': 0}, {'iid': 21, 'description': 'Sunlight Correction Enabled', 'value': 0}, {'iid': 22, 'description': 'Sunlight Correction Active', 'value': 0}, {'iid': 23, 'description': 'Using Emergency Heat', 'value': 0}]

./hs.py -s Nest 28
<Response [207]>
Nest_Thermostat Error: -70410

./hs.py -d -s Nest 28
Traceback (most recent call last):
  File "./hs.py", line 56, in <module>
    hs = homescript.HomeScript(__HOSTNAME__,__PORT__,__AUTH__, args.debug, sys.argv)
  File "/Library/Python/3.8/site-packages/homescript/__init__.py", line 29, in __init__
    self.debugHandler('init',argv)
  File "/Library/Python/3.8/site-packages/homescript/__init__.py", line 191, in debugHandler
    logging.basicConfig(filename=self.exceptionFile,filemode = 'a',encoding='utf-8', level=logging.DEBUG)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/logging/__init__.py", line 2009, in basicConfig
    raise ValueError('Unrecognised argument(s): %s' % keys)
ValueError: Unrecognised argument(s): encoding
Debug logged: homescript_debug_2022.08.17.log

And the log files are empty except for:

HSDB: End homeScript debug filescrape

@colinrblake
Copy link

OK, the debug error was because I wasn't running the latest Python3 (now running 3.10.5). Here's the debug logs:

homescript_debug_2022.08.18.log
homescript_exception_2022.08.18.log

@colinrblake
Copy link

Found the problem for trying to set a Nest thermostat temperature. setStates is hardwired to use a valueIndex of 0, where it should be using a valueIndex of 2 (in my case) because that's the 'Target Temperature'.

{'aid': 21,
 'value': [
  {'iid': 10, 'description': 'Target Heating Cooling State', 'value': 30},
  {'iid': 11, 'description': 'Current Temperature', 'value': 24.4222},
  {'iid': 12, 'description': 'Target Temperature', 'value': 27.8},
  {'iid': 13, 'description': 'Temperature Display Units', 'value': 1},
  {'iid': 14, 'description': 'Current Relative Humidity', 'value': 34},
  {'iid': 15, 'description': 'Cooling Threshold Temperature', 'value': 27.8},
  {'iid': 16, 'description': 'Heating Threshold Temperature', 'value': 23.3},
  {'iid': 17, 'description': 'Status Active', 'value': 1},
  {'iid': 18, 'description': 'Fan Timer Active', 'value': 0},
  {'iid': 19, 'description': 'Fan Timer Duration', 'maxValue': 1440, 'minValue': 0, 'minStep': 15, 'value': 0},
  {'iid': 20, 'description': 'Has Leaf', 'value': 0},
  {'iid': 21, 'description': 'Sunlight Correction Enabled', 'value': 0},
  {'iid': 22, 'description': 'Sunlight Correction Active', 'value': 0},
  {'iid': 23, 'description': 'Using Emergency Heat', 'value': 0}
 ]
}

@shanemcw
Copy link

In my jaunts though these aid/iid data structures, I learned not to rely on the array index being deterministic, but rather I have to loop over the array index until I find the appropriate iid (which is I believe deterministic).

@colinrblake
Copy link

In my jaunts though these aid/iid data structures, I learned not to rely on the array index being deterministic, but rather I have to loop over the array index until I find the appropriate iid (which is I believe deterministic).

Absolutely. I would iterate to find the correct IID or a description of "Target Temperature".

@shanemcw
Copy link

I don't see "type" in that data structure. I believe "type" is the field to be looking for. "Type" is unique to the item.

Here's some Perl code example snippets.

use constant {
    HB_S_INFO            => '3E',
    HB_C_NAME            => '23',
    
    HB_BLINDS_S_STATE    => '8C',
    HB_BLINDS_C_TARG_POS => '7C',
    HB_BLINDS_C_CURR_POS => '6D',
    
    HB_BUTTON_S_STATE    => '89',
    HB_BUTTON_C_VALUE    => '73',
    
    HB_OUTLET_S_STATE    => '47',
    HB_OUTLET_C_VALUE    => '25',
    
    HB_SWITCH_S_STATE    => '49',
    HB_SWITCH_C_VALUE    => '25',
    
    HB_CONTACT_S_STATE   => '80',
    HB_CONTACT_C_VALUE   => '6A'
    };
my %st = %{ decode_json $j };

my $aa = $st{'accessories'};

my %hb;

foreach my $a ( @$aa ) {
    my ( $aid, $type, $name, $value, $iid, $cpvalue, $tpvalue, $tpvmin, $tpvmax, $cpiid, $tpiid );
       
    my %a = %$a;
  
    $aid  = $a{'aid'};
    next unless ( $aid );
   
    my $sr = $a{'services'};

    $type    = undef;
    $name    = undef;
    $iid     = undef;

    $tpvalue = undef;
    $tpvmin  = undef;
    $tpvmax  = undef;
    $tpiid   = undef;
    $cpvalue = undef;
    $cpiid   = undef;

    foreach my $s ( @$sr ) {
        my %sh = %$s;
             
        TYPE: {
            if ( $sh{'type'} eq HB_S_INFO ) {       
                my $cr = $sh{'characteristics'};
                  
                foreach my $c ( @$cr ) {
                    my %ch = %$c;
                      
                    if ( $ch{'type'} eq HB_C_NAME ) {
                        $name = $ch{'value'};
                        } 
                    } 
                  
                last TYPE;
                }

            if ( $sh{'type'} eq HB_BLINDS_S_STATE ) {             
                $type = $sh{'type'};
                  
                my $cr = $sh{'characteristics'};
                  
                foreach my $c ( @$cr ) {
                    my %ch = %$c;
                      
                    if ( $ch{'type'} eq HB_BLINDS_C_TARG_POS ) {
                        $tpvalue = $ch{'value'};
                        $tpvmin  = $ch{'minValue'};
                        $tpvmax  = $ch{'maxValue'};
                        $tpiid   = $ch{'iid'};
                    } elsif ( $ch{'type'} eq HB_BLINDS_C_CURR_POS ) {
                        $cpvalue = $ch{'value'};
                        $cpiid   = $ch{'iid'};
                        }
                    } 
                 
                last TYPE;
                }
                  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants