Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug rules #14

Open
sebbacon opened this issue Oct 25, 2020 · 7 comments
Open

Debug rules #14

sebbacon opened this issue Oct 25, 2020 · 7 comments

Comments

@sebbacon
Copy link
Owner

sebbacon commented Oct 25, 2020

I have set up a "test switch" to trigger toggling the temperatures of every radiator in the house.

The rules are:

rule "Test switch on"
when
     Item test_switch changed to ON
then
     logInfo("test", "Test switch is ON!")
     ThermostatSetter.members.forEach(item, i | sendCommand(item, 21))
end
rule "Test switch off"
when
     Item test_switch changed to OFF
then
     ThermostatSetter.members.forEach(item, i | sendCommand(item, 14))
end

This does appear to work, but sometimes some of the thermostats don't respond; like this:

2020-10-25 11:46:45.769 [ERROR] [ternal.handler.HomematicThingHandler] - -100 No answer from device. (sending setValue()
MEQ1821372:1
SET_TEMPERATURE
21.0
)
java.io.IOException: -100 No answer from device. (sending setValue()
MEQ1821372:1
SET_TEMPERATURE
21.0
)

I have seen this for the following devices when setting switch to "on":

  • MEQ1821372:1 - kitchen
  • OEQ1039384:1 - guest bedroom
  • OEQ1041021:1 - beth bedroom

(and many others).

The nearest that doesn't seem to change in response to that is living room front, which is OEQ1040676 (0x1a77cd)

@sebbacon
Copy link
Owner Author

So what's striking is that sending the control string Zs0BB90040FDBE511A77CD004B does set the temp on living room front, and Zs0BB90040FDBE51150A88004B does it for the kitchen.

@sebbacon
Copy link
Owner Author

sebbacon commented Oct 25, 2020

Focussing on the kitchen. This fails (where the equivalent, setting for the living room back, still works):

# homegear -e 'rc $hg->setValue("MEQ1821372:1", "SET_TEMPERATURE", 13);'
PHP Fatal error:  Uncaught Homegear\HomegearException: No answer from device. in /var/lib/homegear/scripts/inline.php:7
Stack trace:
#0 /var/lib/homegear/scripts/inline.php(7): Homegear\Homegear->__call('setValue', Array)
#1 {main}

And I see this in the logs:

10/25/20 13:10:06.323 IPC Server: Info: Connection accepted. Client number: 7, file descriptor ID: 1206
10/25/20 13:10:06.325 IPC Server: Info: Client 7 successfully registered RPC method "cliOutput" (this method is registered by 1 client(s)).
10/25/20 13:10:06.326 IPC Server: Info: Client 7 successfully registered RPC method "cliOutput-7" (this method is registered by 1 client(s)).
10/25/20 13:10:06.328 Script Engine Server: Info: Starting script "/var/lib/homegear/scripts/inline.php" with id 5.
10/25/20 13:10:06.434 Module MAX: CUL "My-MAX-CUL": Info: Sending (My-MAX-CUL, WOR: yes): 0F950003FD07BD150A8800141904B0B0
10/25/20 13:10:09.474 Module MAX: CUL "My-MAX-CUL": Info: Sending (My-MAX-CUL, WOR: yes): 0F950003FD07BD150A8800141904B0B0
10/25/20 13:10:12.475 Module MAX: CUL "My-MAX-CUL": Info: Sending (My-MAX-CUL, WOR: yes): 0F950003FD07BD150A8800141904B0B0
10/25/20 13:10:16.408 Info: Script with id 5 finished with exit code 255
10/25/20 13:10:16.420 IPC Server: Info: Connection to IPC server's client number 7 closed.

Using minicom to send, e.g. Zs0BB90040FDBE51150A88004B, still works.

On restarting homehear, I have noticed

Could not connect to server 192.168.1.193 on port 9126. Poll failed with error code: 1. Removing server. Server has to send "init" again.

@sebbacon
Copy link
Owner Author

When it works (i.e. against living room back), the logs look like this:

10/25/20 13:12:53.578 IPC Server: Info: Connection accepted. Client number: 9, file descriptor ID: 1208
10/25/20 13:12:53.580 IPC Server: Info: Client 9 successfully registered RPC method "cliOutput" (this method is registered by 1 client(s)).
10/25/20 13:12:53.581 IPC Server: Info: Client 9 successfully registered RPC method "cliOutput-9" (this method is registered by 1 client(s)).
10/25/20 13:12:53.583 Script Engine Server: Info: Starting script "/var/lib/homegear/scripts/inline.php" with id 7.
10/25/20 13:12:53.689 Module MAX: CUL "My-MAX-CUL": Info: Sending (My-MAX-CUL, WOR: yes): 0B310540FDBE511A75E7015A
10/25/20 13:12:54.749 MAX packet received (My-MAX-CUL, RSSI: 0x3A): 0E3102021A75E7FDBE51000119001A
10/25/20 13:12:54.750 Module MAX: Info: Queue 101 is empty and there are no pending queues.
10/25/20 13:12:54.751 Module MAX: Info: CONTROL_MODE on channel 1 of peer 2 with serial number OEQ1039575 was set to 0x01.
10/25/20 13:12:54.752 Module MAX: Info: LOCKED on channel 1 of peer 2 with serial number OEQ1039575 was set to 0x00.
10/25/20 13:12:54.752 Module MAX: Info: SET_TEMPERATURE on channel 1 of peer 2 with serial number OEQ1039575 was set to 0x1A.
10/25/20 13:12:54.752 Module MAX: Info: VALVE_STATE on channel 1 of peer 2 with serial number OEQ1039575 was set to 0x00.
10/25/20 13:12:54.797 Info: Script with id 7 finished with exit code 0
10/25/20 13:12:54.808 IPC Server: Info: Connection to IPC server's client number 9 closed.

@sebbacon
Copy link
Owner Author

sebbacon commented Oct 25, 2020

We can see that the successful instruction was 0B310540FDBE511A75E7015A and the unsuccessful analog was 0F950003FD07BD150A8800141904B0B0.

Messages can be unpacked thus:

ll - length
nn - msg counter
cc - control byte
tt - msg type
ss - sender address (3byte)
dd - destination address (3byte - 000000 for broadcast)
pp - payload...

Message types are defined here.

In the successful one we see 0B_31_05_40_FDBE51_1A75E7_015A, and the unsuccessful one, 0F_95_00_03_FD07BD_150A88_00141904B0B0.

Therefore we can conclude that the relationship between the identifier MEQ1821372:1 and the addresses stored for this is wrong in the homegear database, for some reason.

Two things of note about the unsuccessful one: (1) the sender address is wrong; (2) it's sending a TimeInformationMessage for some reason.

@sebbacon
Copy link
Owner Author

So looking at the homegear data structures, here's the Kitchen:

   [10] => Array
        (
            [ADDRESS] => MEQ1821372
            [CHANNELS] => Array
                (
                    [0] => 0
                    [1] => 1
                    [2] => 3
                    [3] => 4
                )

            [CHILDREN] => Array
                (
                    [0] => MEQ1821372:0
                    [1] => MEQ1821372:1
                    [2] => MEQ1821372:3
                    [3] => MEQ1821372:4
                )

            [FAMILY] => 4
            [FIRMWARE] => 1.0
            [FLAGS] => 1
            [ID] => 3
            [INTERFACE] => VBC7339957
            [NAME] => "kitchen"
            [PAIRING_METHOD] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                )

            [PARENT] => 
            [PHYSICAL_ADDRESS] => 1378952
            [RF_ADDRESS] => 1378952
            [ROAMING] => 0
            [RX_MODE] => 2
            [TYPE] => BC-RT-TRX-CyG-3
            [TYPE_ID] => 416
            [VERSION] => 1
      )

    [11] => Array
        (
            [ADDRESS] => MEQ1821372:0
            [AES_ACTIVE] => 0
            [CHANNEL] => 0
            [DIRECTION] => 0
            [FAMILY] => 4
            [FLAGS] => 3
            [ID] => 3
            [INDEX] => 0
            [LINK_SOURCE_ROLES] => 
            [LINK_TARGET_ROLES] => 
            [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                    [1] => VALUES
                )

            [PARENT] => MEQ1821372
            [PARENT_TYPE] => BC-RT-TRX-CyG-3
            [TYPE] => MAINTENANCE
            [VERSION] => 1
        )

    [12] => Array
        (
            [ADDRESS] => MEQ1821372:1
            [AES_ACTIVE] => 0
            [CHANNEL] => 1
            [DIRECTION] => 3
            [FAMILY] => 4
            [FLAGS] => 1
            [ID] => 3
            [INDEX] => 1
            [LINK_SOURCE_ROLES] => THERMALCONTROL_VD
            [LINK_TARGET_ROLES] => THERMALCONTROL_VD
            [NAME] => 
            [PARAMSETS] => Array
               (
                    [0] => MASTER
                    [1] => VALUES
                )

            [PARENT] => MEQ1821372
            [PARENT_TYPE] => BC-RT-TRX-CyG-3
            [TYPE] => CLIMATECONTROL_TRANSCEIVER
            [VERSION] => 1
        )

    [13] => Array
        (
            [ADDRESS] => MEQ1821372:3
            [AES_ACTIVE] => 0
            [CHANNEL] => 3
            [DIRECTION] => 2
            [FAMILY] => 4
            [FLAGS] => 1
            [ID] => 3
            [INDEX] => 3
            [LINK_SOURCE_ROLES] => 
            [LINK_TARGET_ROLES] => THERMALCONTROL_TC
            [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                )

            [PARENT] => MEQ1821372
            [PARENT_TYPE] => BC-RT-TRX-CyG-3
            [TYPE] => CLIMATECONTROL_RECEIVER
            [VERSION] => 1
        )

    [14] => Array
        (
            [ADDRESS] => MEQ1821372:4
            [AES_ACTIVE] => 0
            [CHANNEL] => 4
            [DIRECTION] => 2
            [FAMILY] => 4
         [FLAGS] => 1
            [ID] => 3
            [INDEX] => 4
            [LINK_SOURCE_ROLES] => 
            [LINK_TARGET_ROLES] => WINDOW_SWITCH_RECEIVER
            [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                )

            [PARENT] => MEQ1821372
            [PARENT_TYPE] => BC-RT-TRX-CyG-3
            [TYPE] => WINDOW_SWITCH_RECEIVER
            [VERSION] => 1
        )

And here's the living room back:

   [5] => Array
        (
            [ADDRESS] => OEQ1039575
            [CHANNELS] => Array
                (
                    [0] => 0
                    [1] => 1
                    [2] => 3
                    [3] => 4
                )

            [CHILDREN] => Array
                (
                    [0] => OEQ1039575:0
                    [1] => OEQ1039575:1
                    [2] => OEQ1039575:3
                    [3] => OEQ1039575:4
                )

            [FAMILY] => 4
            [FIRMWARE] => 1.1
            [FLAGS] => 1
            [ID] => 2
            [INTERFACE] => VBC7339957
            [NAME] => "living room back"
            [PAIRING_METHOD] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                )

            [PARENT] => 
            [PHYSICAL_ADDRESS] => 1734119
            [RF_ADDRESS] => 1734119
            [ROAMING] => 0
            [RX_MODE] => 2
            [TYPE] => BC-RT-TRX-CyN
            [TYPE_ID] => 417
            [VERSION] => 1
     )

    [6] => Array
        (
            [ADDRESS] => OEQ1039575:0
            [AES_ACTIVE] => 0
            [CHANNEL] => 0
            [DIRECTION] => 0
            [FAMILY] => 4
            [FLAGS] => 3
            [ID] => 2
            [INDEX] => 0
            [LINK_SOURCE_ROLES] => 
            [LINK_TARGET_ROLES] => 
            [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                    [1] => VALUES
                )

            [PARENT] => OEQ1039575
            [PARENT_TYPE] => BC-RT-TRX-CyN
            [TYPE] => MAINTENANCE
            [VERSION] => 1
        )

    [7] => Array
        (
            [ADDRESS] => OEQ1039575:1
            [AES_ACTIVE] => 0
            [CHANNEL] => 1
            [DIRECTION] => 3
            [FAMILY] => 4
            [FLAGS] => 1
            [ID] => 2
            [INDEX] => 1
            [LINK_SOURCE_ROLES] => THERMALCONTROL_VD
            [LINK_TARGET_ROLES] => THERMALCONTROL_VD
           [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                    [1] => VALUES
                )

            [PARENT] => OEQ1039575
            [PARENT_TYPE] => BC-RT-TRX-CyN
            [TYPE] => CLIMATECONTROL_TRANSCEIVER
            [VERSION] => 1
        )

    [8] => Array
        (
            [ADDRESS] => OEQ1039575:3
            [AES_ACTIVE] => 0
            [CHANNEL] => 3
            [DIRECTION] => 2
            [FAMILY] => 4
            [FLAGS] => 1
            [ID] => 2
            [INDEX] => 3
            [LINK_SOURCE_ROLES] => 
            [LINK_TARGET_ROLES] => THERMALCONTROL_TC
            [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                )

            [PARENT] => OEQ1039575
            [PARENT_TYPE] => BC-RT-TRX-CyN
            [TYPE] => CLIMATECONTROL_RECEIVER
            [VERSION] => 1
        )
    [9] => Array
        (
            [ADDRESS] => OEQ1039575:4
            [AES_ACTIVE] => 0
            [CHANNEL] => 4
            [DIRECTION] => 2
            [FAMILY] => 4
            [FLAGS] => 1
            [ID] => 2
            [INDEX] => 4
            [LINK_SOURCE_ROLES] => 
            [LINK_TARGET_ROLES] => WINDOW_SWITCH_RECEIVER
            [NAME] => 
            [PARAMSETS] => Array
                (
                    [0] => MASTER
                )

            [PARENT] => OEQ1039575
            [PARENT_TYPE] => BC-RT-TRX-CyN
            [TYPE] => WINDOW_SWITCH_RECEIVER
            [VERSION] => 1
        )

@sebbacon
Copy link
Owner Author

I've deleted all the sqlite files (rm /var/lib/homegear/db*).

I can apparently then repeer with the TRVs, although I have to restart homegear after peering a device, or the next device won't peer. So far I've been able to set values successfully on all three TRVs on the ground floor with variations of

homegear -e 'rc $hg->setValue("MEQ1821372:1", "SET_TEMPERATURE", 21);'

@sebbacon
Copy link
Owner Author

Now got to the stage where all the valves and the wall thermometer are working.

Can edit in VS Code over SMB share.

Tail the logs at /var/log/openhab2/openhab.log

Problem is that I'm not getting the valve states being reported back in the current rule set.

I can send instructions to all the TRVs by monitoring for changes on the wall thermometer (though really I should pair it, so the TRVs use the wall therm as their sensor... I think this is how they work?)

I think the valve states only report when something else changes. I'm just surprised that the something else isn't a change of the "set temperature"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant