Besoin d'aide récupération d'info sur site web "Scrape"

OK donc je comprends que tu n’as pas un JSON à la fin de l’appel de l’url.
Mets des logs et regarde ce que ça donne

logger:
  default: info
  logs:
    homeassistant.components.rest: debug

Effectivement il y a bien un probleme d’authentification. Il cherche l’info « puissance » sur la page de connexion…

2022-11-16 10:53:37.589 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'value_json' is undefined when rendering '{{ value_json|truncate(200, True) }}'
2022-11-16 10:53:40.944 WARNING (MainThread) [custom_components.xiaomi_miot.binary_sensor] Capteur Porte Entrée(lumi.sensor_magnet.v2): Get miio data failed: None
2022-11-16 10:53:42.511 DEBUG (MainThread) [homeassistant.components.rest.data] Updating from https://mon.projet-tbh.fr/energie/tableau-de-bord
2022-11-16 10:53:42.597 DEBUG (MainThread) [homeassistant.components.rest.sensor] Data fetched from resource: 


<!DOCTYPE html>
<html lang="">

    <head>
        <meta charset="UTF-8">
        
        <meta name = "description" content = "Le tableau de bord de l'habitat vous apprend à maîtriser vos consommations d'énergie" >
        
        <meta name = "keywords" content = "tableau de bord, habitat, consommations, énergie, tbh" >
        <meta name = "viewport" content = "width = device-width" >
        
        <title>Quarthome-Connexion</title>

        <link rel="shortcut icon" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/images/favicon.png" />
        <link rel="icon" type = "image/x-icon" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/images/quarthome/favicon.png" >
        <link rel="icon" type="image/png" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/images/quarthome/favicon.png" />
        <link rel="apple-touch-icon" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/images/quarthome/favicon.png" >
        
        <link rel="stylesheet" type="text/css" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/css/style.css" />
        
        <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/css/ie.css" />
        <![endif]-->  
        <script src="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/js/jquery-2.1.1.min.js"></script>
        <script src="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/js/main.js"></script>
        <script type="text/javascript" src="/jsi18n/"></script>
        
        
        <link rel="stylesheet" type="text/css" href="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/css/quarthome.css" />
    </head>

    <body>
        <!--[if lt IE 9]>
            <div class="alert alert-warning"><strong>Votre navigateur n'est pas à jour</strong>. Il est nécessaire de le <a href="http://browsehappy.com/">mettre à jour</a> pour visualiser correctement ce site internet.</div>
		<![endif]--> 
        <section id="body">
            <section id="main-section-login">
                
                
    <div class="login">
        <h1><img src="https://storage.gra.cloud.ovh.net/v1/AUTH_e6d38580116f483bbf425f9d3668c44c/quarthome_static/images/quart_home_logo.png" alt="Connexion"/></h1>
        

        <form method="post" action="/accounts/login/">
            <input type='hidden' name='csrfmiddlewaretoken' value='KAAiiMtMWlSlWFMZKKu4I86p6FyxYa6TXlv3YXHBxa25qgOuuqx34v5RduvmVDwv' />
            <p>
                <label>Identifiant</label>
                <br/>
                <input type="text" name="username" autocapitalize="none" maxlength="254" required id="id_username" />
            </p>
            
            <p>
                <label>Mot de passe</label>
                <br/>
                <input type="password" name="password" required id="id_password" />
            </p>
            
            <div>
            <!-- <a class="right button gris" href="mon.quarthome.com//#inscription_panel">s'inscrire</a> -->
            <a class="right button gris red_bold" href="/mdp-oublie/">Mot de passe oublié</a>
            <input  type="submit" value='connexion' />
            </div>
            <input type="hidden" name="next" value="/energie/tableau-de-bord" />
            
        </form>
    </div>

            </section>
        </section>

    </body>

</html>

2022-11-16 10:53:42.597 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'value_json' is undefined when rendering '{{ value_json|truncate(200, True) }}'

il faut trouver la bonne méthode d’authentification

Bonjour @Pulpy-Luke
Effectivement… Je vais continuer à creuser, en espérant trouver.
Merci pour ton aide !

Bonjour à tous,

Je débute sur HA et je cherche à intégrer les commandes de mon visiophone hikvision 8113.
J’ai trouvé la solution pour récupérer l’état d’appel en rest depuis une commande curl :

curl -i --digest -u admin:xxxx http://192.168.1.XX/ISAPI/VideoIntercom/callStatus?format=json&channelType=tripartitePlatform

rest:
  - resource: http://192.168.1.XX/ISAPI/VideoIntercom/callStatus?format=json
    scan_interval: 1 # the default is 30 seconds if you leave this line out, or change it to what you need.
    authentication: digest
    username: admin
    password: xxxx
    sensor:
      - name: "Doorbell Status"
        value_template: "{{ value_json.CallStatus.status }}"

Mais je n’arrive pas à faire fonctionner la sortie de foçage de l’ouverture porte depuis le curl fonctionnel dans putty suivant :

curl -i --digest -u admin:xxxx -X PUT -d '<RemoteControlDoor><cmd>open</cmd></RemoteControlDoor>' http://192.168.1.XX/ISAPI/AccessControl/RemoteControl/door/1

Si quelqu’un a de l’expérience dans ce genre de commande, ça m’aiderait beaucoup.
Merci à Pulpy-Luke pour l’aide, voici la solution pour la commande shell utilisable avec mon Hikvsion DS-KV8113-WME1(B) :

shell_command:
    portail_command: "curl -i --digest -u admin:xxxx -X PUT -d '<RemoteControlDoor><cmd>open</cmd></RemoteControlDoor>' http://192.168.1.XX/ISAPI/AccessControl/RemoteControl/door/1"

@bientôt et merci encore

Salut,

Un curl comme ça qui se balade au milieu d’une config YAML ça ne fonctionne pas, il faut passer par une config de commandline

Merci je teste ça, mon but était plutôt de convertir en rest mais si ça passe en command pourquoi pas.

Le rest, c’est bien quand tu as un retour (typiquement l’interrogation de l’état dans ton exemple).
Là tu n’as besoin que d’envoyer un ordre

C’est noté, ça fonctionne mais par intermittence, je ne sais pas trop ce qu’il se passe mais au moins ma commande vit.
J’investigue dans la semaine.

Merci beaucoup l’aide sur la commande line, désolé si la question était bête.

1 « J'aime »