def to_knx(self, value: int) -> DPTArray:
     """Convert value to payload."""
     return DPTArray(DPTSceneNumber.to_knx(value))
Example #2
0
 def test_value_50(self):
     """Test parsing and streaming of DPTSceneNumber 50."""
     assert DPTSceneNumber.to_knx(50) == (0x31, )
     assert DPTSceneNumber.from_knx((0x31, )) == 50
Example #3
0
 def test_to_knx_wrong_parameter(self):
     """Test parsing of DPTSceneNumber with wrong value (string)."""
     with pytest.raises(ConversionError):
         DPTSceneNumber.to_knx("fnord")
Example #4
0
 def test_to_knx_max_exceeded(self):
     """Test parsing of DPTSceneNumber with wrong value (overflow)."""
     with pytest.raises(ConversionError):
         DPTSceneNumber.to_knx(DPTSceneNumber.value_max + 1)
Example #5
0
 def test_value_min(self):
     """Test parsing and streaming of DPTSceneNumber 0."""
     assert DPTSceneNumber.to_knx(1) == (0x00, )
     assert DPTSceneNumber.from_knx((0x00, )) == 1
Example #6
0
 def test_value_max(self):
     """Test parsing and streaming of DPTSceneNumber 64."""
     assert DPTSceneNumber.to_knx(64) == (0x3F, )
     assert DPTSceneNumber.from_knx((0x3F, )) == 64