Git Product home page Git Product logo

Comments (10)

wesmwitt avatar wesmwitt commented on May 31, 2024

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

from homescript.

multinet33 avatar multinet33 commented on May 31, 2024

I have a solution via curl

curl -X PUT http://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

from homescript.

menahishayan avatar menahishayan commented on May 31, 2024

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.

from homescript.

shanemcw avatar shanemcw commented on May 31, 2024

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

from homescript.

colinrblake avatar colinrblake commented on May 31, 2024

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

from homescript.

colinrblake avatar colinrblake commented on May 31, 2024

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

from homescript.

colinrblake avatar colinrblake commented on May 31, 2024

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}
 ]
}

from homescript.

shanemcw avatar shanemcw commented on May 31, 2024

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).

from homescript.

colinrblake avatar colinrblake commented on May 31, 2024

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".

from homescript.

shanemcw avatar shanemcw commented on May 31, 2024

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;
                }
                  

from homescript.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.