RS485 Sensor commands

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • Martins Kadakovskis
    Dumb Home'r
    • 26.11.2019
    • 21

    RS485 Sensor commands

    Good Morning!

    In Our project we are using Loxone Miniserver –> RS485 Extension –> Orno OR-WE 514 Electricity counter (third party)

    I connected to the counter directly from the computer to give it the address.

    The question is how to define the command in Loxone config to get out the information. Like KWh.
    I copied the command from Orno Manufacturer software and pasted it In RS485 sensor command.
    I have connected counters to the RS485 extension and the other end was connected to the PC via RS485 to usb adapter.
    When I send command on manufacturer software Loxone Software in RS485 monitor I can see those commands.
    So I Learned in the commands But it does not show the data I need.
    The sensor showing 0.0

    How do I set the sensor input to send this command to the Electricity counter ?
    And where in the RS485 sensor option do I insert how often it should send the commands.

    Have I correctly inserted the command, am I allowed to use slash and space when typing the commands ?

    Added 4 pictures.
    Loxone config sensor command copied from PC software.
    Loxone config sensor command learned in from RS485 monitor
    OR-WE manual
    ORNO PC software
    OR-WE registers



    A lot of questions.. first time doing this.

    Thank you!
    Angehängte Dateien
  • Tico
    MS Profi
    • 31.08.2016
    • 975

    #2
    If I refer to the following red underline in the picture, I can make out a few details -

    Klicke auf die Grafik für eine vergrößerte Ansicht  Name: Modbus.png Ansichten: 0 Größe: 50,6 KB ID: 329703

    In the Loxone Config, you should create an Actuator (not a sensor), then send the following command (Command for ON) -

    \x7C\x03\x01\x31\x00\x01\xDE\x14

    You can trigger the sending of the command by a Pulse Generator block or manually with a Virtual Input push button.

    You should receive a response that returns the Voltage. In this case the green text, 7C 03 02 5D 4A 6D 29. Where -

    7C = Decimal 124 (the meter ID)
    03 = Function code 03 (read register)
    02 = Probably defines 2 bytes length for this value polled
    5D 4A = Decimal 23882 (238.82 Volts)
    6D = Possibly part of CRC check?
    29 = Possibly part of CRC check?

    When you manually trigger the Actuator with Lox Config, monitor the RS232/485 tab and see what is returned. Look for the two values directly after 7C 03 02. Use a hex to decimal converter to check if the value is reasonable for Volts.

    https://www.binaryhexconverter.com/h...imal-converter

    If you have success so far, the next step will be to automatically recognise the relevant part of the returned value for volts.
    Zuletzt geändert von Tico; 20.12.2021, 09:50.
    Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

    Kommentar

    • Labmaster
      Lox Guru
      • 20.01.2017
      • 2386

      #3
      It seems the Orno OR-WE 514 has Modbus protocol not only RS485 (that only defines the electrical interface but no transfere protocol)
      You should have bougth the modbus and not the RS485 extension.
      If you try to use the RS485 extension for modbus RTU then the protcol handling has to be done in software (as Tico already noted), i would recomend PicoC.
      For sure it doable but you should have C knowledge.


      Kommentar

      • Martins Kadakovskis
        Dumb Home'r
        • 26.11.2019
        • 21

        #4
        Hello!
        Thank you for quick reply!

        Tomorrow gonna get my hands on Demo Case ad test this.
        So If I receive Hex values for Volts am I able to use it in Loxone config ?
        The main goal is to connect 80 Electricity counters and receive information of spent KWh in each flat monthly.

        Thank you!

        Kommentar


        • Tico
          Tico kommentierte
          Kommentar bearbeiten
          Getting the Command Recognition correct can sometimes be a challenge in the Config. Notwithstanding, it should be possible.
          You will create a Sensor that will read the value triggered by the Actuator.

          My initial idea for the Command Recognition in the Sensor is as follows -

          \x7C\x03\x02\2\1

          This format looks for the string \x7C\x03\x02, then takes the next byte (\2) as the more significant portion of the value, followed by the next byte (\1) as the least significant portion of the value.

          Another option to try would be -

          \x7C\x03\x02\1\2

          This flips the bytes.

          If either of those options don't work, try the 'Learn' function in the Config and see what Loxone thinks... This Command Recognition won't work but will give a basis to construct another variation. The Learn function will include the value as well and because the value is changing, it won't be recognised thereafter. Other helpful information going forward is the time-frame from triggering the Actuator to seeing a response on the Sensor. This will inform how quickly you can set up the polling. It might be a sub-second timeframe to a couple of seconds. I assume each of the 80 meters has a different Meter ID?
          Zuletzt geändert von Tico; 21.12.2021, 00:11.
      • Martins Kadakovskis
        Dumb Home'r
        • 26.11.2019
        • 21

        #5
        Big Thank you, getting somewhere!

        The only thing is problem with sending commands.
        When I send command from Manufacturer software I can see it on Monitor and learn it in as ans sensors and the voltage shows at the sensor.

        Hard to figure out why it does not send the command from the Actuator. /It sends but It does not communicate with sensor Voltage change.

        Kommentar

        • Martins Kadakovskis
          Dumb Home'r
          • 26.11.2019
          • 21

          #6
          Yes each device has it`s own ID

          Kommentar

          • Martins Kadakovskis
            Dumb Home'r
            • 26.11.2019
            • 21

            #7
            Thank you!
            Everything works!
            Just need to configure it for the KWh!

            Had wrong configuration In RS485 extension needed to choose MODBUS CRC

            Kommentar

            • Tico
              MS Profi
              • 31.08.2016
              • 975

              #8
              Good to hear. I'd use the PC software to check what the Write command is when Active Energy is chosen. If you haven't already got it working, send a screenshot like in Post #2. It will be something similar to -

              7C 03 A0 00 00 01 ?? ??

              The last four hex characters will need confirmation. Also, try an extra OR-WE 514 added to the bus. You will need to terminate the last device in the bus with a 120Ohm resistor.

              Extension to integrate devices with RS485 interface
              Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

              Kommentar

              • Martins Kadakovskis
                Dumb Home'r
                • 26.11.2019
                • 21

                #9
                Hi!

                Got problems reading Hex reply.

                in the picture and config they are not the same counters right now.

                in config I know the kWh was 498,.. kWh
                which is the value after 00,00
                in Adress 06 03 14 00 00 C2 AB 00 00

                i got to the point where it reads the C2 value (192) but that’s not what I need.

                wondering how to define to read whole part 00 00 C2 AB as a decimal number .

                Thank you in advance
                Angehängte Dateien

                Kommentar

                • Tico
                  MS Profi
                  • 31.08.2016
                  • 975

                  #10
                  Your command recognition will be -

                  x06\x03\x14\4\3\2\1

                  Where -

                  x06 = Meter ID 6
                  x03 = Function code 03 (read register)
                  x14 = defines 20 bytes length for this value polled (14hex = 20 decimal)
                  \4\3\2\1 = the next four bytes will be ingested and arranged from most significant (4) to least significant (1)

                  That will return a decimal value of 49835. You will need a formula block to divide this value by 100.
                  Result = 498.35 kWh for the Total value of the Meter.

                  Note that the meter has values for T1, T2, T3, T4. I assume these are for 4 different Tariff periods. The value 00 00 C2 AB is repeated again immediately after the first instance. This accords with the T1 value.

                  In the PC screenshot example, the same method is used for the command recognition -

                  Klicke auf die Grafik für eine vergrößerte Ansicht  Name: PC Meter.png Ansichten: 0 Größe: 1,80 MB ID: 330218

                  Command Recognition = \x4D\x03\x14\4\3\2\1

                  Where -

                  x4D = Meter ID 77
                  x03 = Function code 03 (read register)
                  x14 = defines 20 bytes length for this value polled (14hex = 20 decimal)
                  \4\3\2\1 = the next four bytes arranged from most significant (4) to least significant (1)

                  That will return a value of Decimal 121619. Divided by 100 = 1216.19 kWh for Total value. The values returned are repeated again (00 01 DB 13), according with the T1 value in the screenshot. The last two values (69 9F) will be the CRC check. The values between represent T2, T3 and T4.

                  Have a Happy Christmas!
                  Zuletzt geändert von Tico; 24.12.2021, 08:55.
                  Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

                  Kommentar

                  • Tico
                    MS Profi
                    • 31.08.2016
                    • 975

                    #11
                    And one extra point.. You can do the division by 100 within the sensor. Just set the following -

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

Name: Correction.png
Ansichten: 1438
Größe: 16,6 KB
ID: 330238
                    Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

                    Kommentar

                    • Martins Kadakovskis
                      Dumb Home'r
                      • 26.11.2019
                      • 21

                      #12
                      Thank You, You made my Christmas very cheerful!
                      Must send you a postcard!

                      Wondering is it possible from all those Sensors gather information and send in one email once a month.
                      One e-mail with separate counter data?

                      Manage to send one counter - one email. Just need to study more loxone config.

                      Cheers!

                      Kommentar

                      • Tico
                        MS Profi
                        • 31.08.2016
                        • 975

                        #13
                        Unfortunately Loxone doesn’t provide an easy way to consolidate information for emailing. Notwithstanding, there might be an ugly workaround.

                        I don’t have access to the Config for a week, so I’ll have to resort to a description instead.

                        Get a Status Block (in the General category in the blocks).

                        Place the meter reading for Flat 1 onto the AI1 input. Double-click the Status block. At the top of the Text column, enter
                        Flat 1 - <v1.2> kWh\r\n

                        From the TQ output, connect to AI1 of another Status block. Place the meter reading for Flat 2 onto the AI2 input. At the top of the Text column, enter
                        <v1>Flat 2 - <v2.2> kWh\r\n

                        From the TQ output, connect to AI1 of another Status block. Place the meter reading for Flat 3 onto the AI2 input. At the top of the Text column, enter
                        <v1>Flat 3 - <v2.2> kWh\r\n

                        etc, etc...

                        The series of Status Blocks cascades text from one block to the next and adds each Flat data to the preceding text.

                        I haven’t tested this, but hopefully the \r\n causes the text to be outputted as a column (\r = carriage-return, \n = line feed). If it doesn’t work, delete the \r\n. The text and values will then be in a continuous blob.

                        Of more importance is how you plan to trigger the 80 actuators. My feeling is that triggering them simultaneously will cause a flood of data to arrive at the Miniserver, with possible data loss. I would use a single trigger (at whatever frequency you desire the data), then hang a Delayed Pulse between the trigger and each actuator. The Delayed Pulse block can be found in Times.

                        1st actuator = no delay
                        2nd actuator = 2 second delayed pulse
                        3rd actuator = 4 second delayed pulse
                        4th actuator = 6 second delayed pulse

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

                        Kommentar

                        • Martins Kadakovskis
                          Dumb Home'r
                          • 26.11.2019
                          • 21

                          #14
                          Hello, Tico!

                          Big Thank you for your enthusiasm.
                          This e-mail thing gonna test and let you know.
                          Actually with no Delay the system did not work so I have already put in delay, just 0.5 sec. seems enough.





                          Kommentar

                          • Martins Kadakovskis
                            Dumb Home'r
                            • 26.11.2019
                            • 21

                            #15
                            Good Day Tico!

                            Your concept worked!

                            I added all sensors, but it seems the system cannot send all mails, because in the email I get separate emails with lets say 1-13 sensor, than 26-51 etc.

                            May be It`s too much of a data flowing through Status block ?

                            In the ed I have added Mailer.

                            The second thing is how to trigger Email ?
                            Right now I mystically get like 10 at night.
                            Should I add push button with timer in the end?

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

Name: Status-Mailer.png
Ansichten: 1741
Größe: 118,7 KB
ID: 334237
                            Thank you!

                            Kommentar

                            Lädt...