Ankündigung

Einklappen
Keine Ankündigung bisher.

Integration of Gardena smart system in SHNG

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Integration of Gardena smart system in SHNG

    Hello, i would like to integrate my gardena mower in smarthome but i'm not a developper ...

    I've find this python API : https://github.com/grm/py-smart-gardena it work's well with pyton but i don't know how to integrate this into smarthome ...

    Can anybody help me ?

    thanks a lot for your help

    #2
    Hm. I have no such device. Maybe husky is something for you as Gardena seems to be OEM of Husqvarna devices ...

    Kommentar


      #3
      Unfortunately, Husqvarna and gardena didn't use the same protocol :/

      Kommentar


        #4
        Finaly, i use a logic to talk with py-smart-gardena and it work's ;-)

        Result in smartvisu :

        status with battery level and next start date

        chacha.png

        and panel to force the mower to stop or start ...

        chacha_manuel.png

        Kommentar


          #5
          Hey, well done! Maybe you want to share your script with others? What about an article on the smarthomeng.de blog?

          Kommentar


            #6
            Forsure for the script but i just use, the py-smart-gardena !
            It's very very simple i'm not a developer !

            i create an item 'chacha' with fue values in SHNG :

            Code:
            ext:
                chacha:
                    status:
                        type: str
                    last_status:
                        type: str
                        database: 'yes'
                    in_charge:
                        type: bool
                    battery:
                        type: num
                    next_start:
                        type: str
                    radio_quality:
                        type: num
                    park_until_next_timer:
                        type: bool
                        value: false
                    park_until_further_notice:
                        type: bool
                        value: false
                    start_resume_schedule:
                        type: bool
                        value: false
                    start_override_timer:
                        type: bool
                        value: false
                    last_command:
                        type: str
                        database: 'yes'

            and i use the API to assist the values :

            Code:
            #!/usr/bin/env python3
            # gardena_status.py
            
            import pytest
            import unittest
            import requests
            import requests_mock
            
            #SmartSystem need : https://github.com/grm/py-smart-gardena
            from datetime import datetime
            from requests import HTTPError
            from gardena.smart_system import SmartSystem
            
            #mail and password of the official Gardena apps
            smart_system = SmartSystem(email="XXX@gmail.com", password="XXXXXXX")
            smart_system.authenticate()
            smart_system.update_locations()
            
            for location in smart_system.locations.values():
                # To update devices information for a location (mower, gateway, sensor, ..)
                location.update_devices()
            
                # Iterate over mowers
                for mower in location.mowers.values():
                    
                    #forced command check
                    #if you check a case, the other will be uncheck and command is send to mower
                    if (sh.ext.chacha.park_until_next_timer() and sh.ext.chacha.last_command() != 'park_until_next_timer'):
                        logger.info('Commande forcer : park_until_next_timer')
                        sh.ext.chacha.park_until_further_notice('false')
                        sh.ext.chacha.start_resume_schedule('false')
                        sh.ext.chacha.start_override_timer('false')
                        sh.ext.chacha.last_command('park_until_next_timer')
                        mower.park_until_next_timer()
                    if (sh.ext.chacha.park_until_further_notice() and sh.ext.chacha.last_command() != 'park_until_further_notice'):
                        logger.info('Commande forcer : park_until_further_notice')
                        sh.ext.chacha.park_until_next_timer('false')
                        sh.ext.chacha.start_resume_schedule('false')
                        sh.ext.chacha.start_override_timer('false')
                        sh.ext.chacha.last_command('park_until_further_notice')
                        mower.park_until_further_notice()
                    if (sh.ext.chacha.start_resume_schedule() and sh.ext.chacha.last_command() != 'start_resume_schedule'):
                        logger.info('Commande forcer : start_resume_schedule')
                        sh.ext.chacha.park_until_next_timer('false')
                        sh.ext.chacha.park_until_further_notice('false')
                        sh.ext.chacha.start_override_timer('false')
                        sh.ext.chacha.last_command('start_resume_schedule')
                        mower.start_resume_schedule()
                    if (sh.ext.chacha.start_override_timer() and sh.ext.chacha.last_command() != 'start_override_timer'):
                        logger.info('Commande forcer : start_override_timer')
                        sh.ext.chacha.park_until_next_timer('false')
                        sh.ext.chacha.park_until_further_notice('false')
                        sh.ext.chacha.start_resume_schedule('false')
                        sh.ext.chacha.last_command('start_override_timer')
                        mower.start_override_timer()
                        
                    
                    #get battery level and send alert if < 10%
                    sh.ext.chacha.battery(mower.battery_level)
                    if (mower.battery_level < 10) :
                        sh.pushbullet.note('CHACHA', 'ALERTE BATTERIE CRITIQUE : %d '% mower.battery_level)
                    
                    # get charging status
                    sh.ext.chacha.in_charge(mower.battery_charging)
                    
                    # get radio quality
                    sh.ext.chacha.radio_quality(mower.radio_quality)
                    
                    #translate status into french
                    if mower.mower_status == 'parked_park_selected':
                        sh.ext.chacha.status('Stationnée jusqu\'a nouvel ordre')
                    elif mower.mower_status == 'ok_cutting_timer_overridden':
                        sh.ext.chacha.status('Tonte forcée en cours')
                    elif mower.mower_status == 'ok_searching':
                        sh.ext.chacha.status('Recherche de la base')
                    elif mower.mower_status == 'parked_timer':
                        sh.ext.chacha.status('Stationnée jusqu\'au prochain cycle de tonte')
                    else :
                        sh.ext.chacha.status(mower.mower_status)
                        
                    if (sh.ext.chacha.last_status() != sh.ext.chacha.status()):
                        sh.pushbullet.note('CHACHA', 'Nouveau status : %s' % sh.ext.chacha.status())
                        sh.ext.chacha.last_status(sh.ext.chacha.status())
                    
                    #get next start date and convert into comprehensive format
                    if (mower.mower_timestamp_next_start == '1969-12-31T22:00Z'):
                        sh.ext.chacha.next_start('Aucune programmation')
                    else :
                        d = datetime.strptime(mower.mower_timestamp_next_start, '%Y-%m-%dT%H:%MZ')
                        day_string = d.strftime('%d-%m-%Y à %H:%M')
                        sh.ext.chacha.next_start(day_string)
            a real plugin would have been better, but I managed with that!


            G
            M
            T
            Y




            Détecter la langueAfrikaansAlbanaisAllemandAmhariqueAnglaisAra beArménienAzériBasqueBengaliBiélorusseBirmanBosnia queBulgareCatalanCebuanoChichewaChinois SimpChinois TradCingalaisCoréenCorseCréole haïtienCroateDanoisEspagnolEspérantoEstonienFinnoi sFrançaisFrisonGaélique ÉcosseGalicienGalloisGéorgienGrecGudjaratiHaoussaH awaïenHébreuHindiHmongHongroisIgboIndonésienIrland aisIslandaisItalienJaponaisJavanaisKannadaKazakhKh merKirghizKurdeLaotienLatinLettonLituanienLuxembou rgeoisMacédonienMalaisienMalayalamMalgacheMaltaisM aoriMarathiMongolNéerlandaisNépalaisNorvégienOuzbe kPachtôPanjabiPersanPolonaisPortugaisRoumainRusseS amoanSerbeSesothoShonaSindhîSlovaqueSlovèneSomaliS oudanaisSuédoisSwahiliTadjikTagalogTamoulTchèqueTe luguThaïTurcUkrainienUrduVietnamienXhosaYiddishYor oubaZoulou AfrikaansAlbanaisAllemandAmhariqueAnglaisArabeArmé nienAzériBasqueBengaliBiélorusseBirmanBosniaqueBul gareCatalanCebuanoChichewaChinois SimpChinois TradCingalaisCoréenCorseCréole haïtienCroateDanoisEspagnolEspérantoEstonienFinnoi sFrançaisFrisonGaélique ÉcosseGalicienGalloisGéorgienGrecGudjaratiHaoussaH awaïenHébreuHindiHmongHongroisIgboIndonésienIrland aisIslandaisItalienJaponaisJavanaisKannadaKazakhKh merKirghizKurdeLaotienLatinLettonLituanienLuxembou rgeoisMacédonienMalaisienMalayalamMalgacheMaltaisM aoriMarathiMongolNéerlandaisNépalaisNorvégienOuzbe kPachtôPanjabiPersanPolonaisPortugaisRoumainRusseS amoanSerbeSesothoShonaSindhîSlovaqueSlovèneSomaliS oudanaisSuédoisSwahiliTadjikTagalogTamoulTchèqueTe luguThaïTurcUkrainienUrduVietnamienXhosaYiddishYor oubaZoulou




            Fonction Sound est limitée à 200 caractères



            Kommentar


              #7
              Hallo.
              ich hole mal das alte Thema wieder nach oben...

              Ich musste mein System neu aufsetzen und komme hier irgendwie nicht sinnvoll weiter...
              Vielleicht hat sich jemand schon mit der neuen Version (0.6.16) von py-smart-gardena auseinander gesetzt.
              Es muss ja nun ein API Key erstellt werden auf der Husqvarna Cloud (https://developer.1689.cloud), diese wird dann in die Anmeldung im Script integriert.
              Soweit ... so gut...


              Leider sind nun in der API nur 3000 anfragen im Monat auf die herkömmliche Art erlaubt.
              Es kann wohl via Websocket eine Dauerverbindung hergestellt werden die dann auf Änderungen reagiert.

              Hat dies jemand umgesetzt?


              Danke.


              Gruß
              Christian

              Kommentar

              Lädt...
              X