diff --git a/doc/devices_classes_branch.txt b/doc/devices_classes_branch.txt index c08af1f..5d527f0 100644 --- a/doc/devices_classes_branch.txt +++ b/doc/devices_classes_branch.txt @@ -219,17 +219,12 @@ monitor_mihome works with a synthetic join and toggles switches KVS implementation completed and all tests pass Registry tests all complete +receive sequence counter tested + -------------------------------------------------------------------------------- TODO NEXT ----- NOTIFY, UPDATE, or DATA SEQUENCE? - -Consider whether there is a need for a general update notify -mechanism - perhaps could have a message sequence counter that -you poll, and if it is higher than last time, you know the -device state has updated (independently of using the -when_updated callback) ---- TEST ON REAL HARDWARE diff --git a/src/energenie/Devices_test.py b/src/energenie/Devices_test.py index 456b0b8..5053eeb 100644 --- a/src/energenie/Devices_test.py +++ b/src/energenie/Devices_test.py @@ -2,14 +2,15 @@ # # Test harness for Devices module -import time import Devices import unittest from lifecycle import * +import OpenThings + class TestDevices(unittest.TestCase): - @test_1 + @test_0 def test_without_registry(self): """A simple on/off test with some devices from the device factory""" tv = Devices.DeviceFactory.get_device_from_name("GreenButton", device_id=(0xC8C8C, 1)) @@ -26,6 +27,17 @@ fan.turn_on() xbox.turn_on() + @test_1 + def test_rx_seq(self): + """Test that the rx sequence increments on each received message""" + fan = Devices.DeviceFactory.get_device_from_name("AdaptorPlus", device_id=0x68b) + + msg = OpenThings.Message(Devices.MIHO005_REPORT) + print(fan.get_receive_count()) + + fan.incoming_message(msg) + print(fan.get_receive_count()) + def init(): """Start the Energenie system running"""