Control of Sonnen Batteries via Virtual Output

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • Not as smart as my home
    Azubi
    • 11.02.2024
    • 6

    #1

    Control of Sonnen Batteries via Virtual Output

    Hi All,

    Hope you can help me. I have spent days trawling the web and trying various options and combinations in the Virtual Output block.

    I am trying to set up a PUT command to control my Sonnen battery. I can do this with the following command in Terminal (not in Safari for some reason) and get the expected results. However I have not worked out how to break it down into a usable format for Loxone – Please help!

    curl -X PUT -d EM_OperatingMode=10 --header 'Auth-Token: XXXXX 770-f236-466a-be70-XXXXXXXXXXXX'http://192.xxx.0.xxx:80/api/v2/configurations

    I generally get 401’s or 301’s faults in the HTTP reader depending upon the way I have tried to lay out the command.

    Any guidance would be greatly appreciated.

    Thanks
  • Tico
    Lox Guru
    • 31.08.2016
    • 1035

    #2
    Setting up the Virtual Output can be a bit hit-and-miss. The following link has some good examples for the Node-Red structure for the PUT commands -

    If you don’t want to use Node-Red then you can implement the REST API commands for the battery using rest_command in configuration.yaml. If you look at section 7 HTTP Request Nodes for REST API calls. For example to put the battery into manual mode: msg.payload = "EM_OperatingMode=1" msg.headers = {} msg.headers['Auth-Token'] = 'YOUR SONNEN API TOKEN' msg.headers ["Content-Type"] = "application/x-www-form-urlencoded" msg.url = "http://YOUR BATTERY IP ADDRESS:80/api/v2/configurations" The...


    Try the following format for Loxone (only for Operating Mode ) -


    Klicke auf die Grafik für eine vergrößerte Ansicht

Name: Virtual Output 1.png
Ansichten: 445
Größe: 14,8 KB
ID: 422747

    Klicke auf die Grafik für eine vergrößerte Ansicht

Name: Virtual Output 2.png
Ansichten: 290
Größe: 39,0 KB
ID: 422748

    If the inital example doesn't work, try variations of 'HTTP body for ON' as -

    "EM_OperatingMode=10"

    or

    {EM_OperatingMode=10}

    or

    EM_OperatingMode=10

    Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

    Kommentar

    • Not as smart as my home
      Azubi
      • 11.02.2024
      • 6

      #3
      Hi Tico, thanks for the feed back. Not sure I am making any progress though, although I now get 403 Forbidden as a response, which I think translates as the server recognises the request but refuses to authorise?

      I have tried adding the marks ' to the beginning and end of the Auth-token as needed when sending via Terminal but that does not help and I just get a 401 responce.

      I notice that Loxone is adding in commands when sending - would that cause a problem?

      PUT /api/v2/configurations HTTP/1.1\r\nHost: 192.XXX.0.XXX\r\nUser-Agent: [en]\r\nContent-Length: 21\r\nContent-Type: application/x-www-form-urlencoded; charset=utf-8\r\nConnection: close\r\nAuth-Token: XXXXXX770-f236-XXXX-be70-XXXXX6a86f6e

      Thanks very much for your help.


      Kommentar

      • Tico
        Lox Guru
        • 31.08.2016
        • 1035

        #4
        The additional commands Loxone is sending shouldn't cause issues. Here is a link that seems to have a working Virtual Output -

        Hallo Zusammen, ich möchte gerne meine Sonnenbatterie mit der neuen API V2 (von Sonnen) mit Loxone ansteuern (Manuel Laden und Entladen) Ich habe einen dynamsichen Stromvertrag (Tibber) und möchte somit meine Sonnenbatterie als Nachspeicher nutzen. ich habe die virtuellen Eingänge (im Beitrag : https://www.loxforum


        Address -
        Code:
        http://192.XXX.0.XXX


        Command for ON
        Code:
        /api/v2/configurations?EM_OperatingMode=10
        HTTP header for On
        Code:
        Auth-Token: XXXXXX770-f236-XXXX-be70-XXXXX6a86f6e\r\nContent-Type: application/json
        HTTP body for ON
        Code:
        <v>
        HTTP Method for ON
        PUT



        Command for OFF
        Code:
        /api/v2/configurations?EM_OperatingMode=2
        HTTP header for OFF
        Code:
        Auth-Token: XXXXXX770-f236-XXXX-be70-XXXXX6a86f6e\r\nContent-Type: application/json
        HTTP body for OFF
        Code:
        <v>
        HTTP Method for OFF
        PUT​​​
        Zuletzt geändert von Tico; 13.02.2024, 14:43.
        Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

        Kommentar

        • Not as smart as my home
          Azubi
          • 11.02.2024
          • 6

          #5
          Bingo! Thanks Tico, thats done it.

          Thanks very much. I have been going round in circles with this and the various combos..

          Cheers

          Kommentar

          • Not as smart as my home
            Azubi
            • 11.02.2024
            • 6

            #6
            Hi All,

            Not sure if anyone else had a problem but Sonnet have done a software update and now the above does not work. I guess there needs to be a different format in Loxone now but Im a bit lost again... The above was all working perfectly until the update.

            Any help would be very much appreciated.

            Thanks very much,

            Kommentar

          • Not as smart as my home
            Azubi
            • 11.02.2024
            • 6

            #7
            Great, thanks Tico.

            I see the important thing is to use a colon and not the equals sign that worked previously....

            Thanks again.

            Kommentar

            Lädt...