senec 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,16 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/simplecov-ruby/simplecov/main/schemas/coverage-v1.0.schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/simplecov-ruby/simplecov/main/schemas/coverage-v1.3.schema.json",
3
3
  "meta": {
4
- "schema_version": "1.0",
5
- "simplecov_version": "1.1.1",
4
+ "schema_version": "1.3",
5
+ "simplecov_version": "1.3.0",
6
6
  "command_name": "RSpec",
7
+ "command_names": [
8
+ "RSpec"
9
+ ],
7
10
  "project_name": "Senec",
8
- "timestamp": "2026-09-03T17:12:12.173+02:00",
11
+ "timestamp": "2026-12-01T11:55:06.386+01:00",
9
12
  "root": "/Users/ledermann/Projects/solectrus/senec",
10
- "commit": "15f873f607ff3a55406b4b0ded204567970eb10f",
13
+ "commit": "e7a6b7b55a8587d77b49be36e0e5378e1e8c3498",
11
14
  "primary_coverage": "line",
12
15
  "line_coverage": true,
13
16
  "branch_coverage": false,
@@ -15,12 +18,12 @@
15
18
  },
16
19
  "total": {
17
20
  "lines": {
18
- "covered": 297,
21
+ "covered": 304,
19
22
  "missed": 2,
20
- "omitted": 361,
21
- "total": 299,
22
- "percent": 99.33110367892976,
23
- "strength": 13.494983277591974
23
+ "omitted": 376,
24
+ "total": 306,
25
+ "percent": 99.34640522875817,
26
+ "strength": 13.718954248366012
24
27
  }
25
28
  },
26
29
  "coverage": {
@@ -745,7 +748,7 @@
745
748
  1,
746
749
  1,
747
750
  1,
748
- 31,
751
+ 36,
749
752
  null,
750
753
  null,
751
754
  1,
@@ -757,13 +760,13 @@
757
760
  1,
758
761
  null,
759
762
  1,
760
- 30,
763
+ 35,
761
764
  null,
762
765
  null,
763
766
  null,
764
767
  null,
765
- 30,
766
- 30,
768
+ 35,
769
+ 35,
767
770
  7,
768
771
  null,
769
772
  null,
@@ -816,6 +819,16 @@
816
819
  " }",
817
820
  " }.freeze",
818
821
  "",
822
+ " # Basic request plus the grid meter. Opt-in, to keep the load on the",
823
+ " # SENEC device unchanged for everyone who does not need these values.",
824
+ " GRID_METER_REQUEST = BASIC_REQUEST.merge(",
825
+ " PM1OBJ1: { # Grid meter at the house connection",
826
+ " FREQ: '', # Grid frequency (Hz)",
827
+ " U_AC: '', # List: Voltage per phase (V)",
828
+ " I_AC: '' # List: Current per phase (A)",
829
+ " },",
830
+ " ).freeze",
831
+ "",
819
832
  " SAFETY_CHARGE = {",
820
833
  " ENERGY: {",
821
834
  " SAFE_CHARGE_FORCE: 'u8_01',",
@@ -878,6 +891,16 @@
878
891
  null,
879
892
  null,
880
893
  null,
894
+ null,
895
+ 1,
896
+ null,
897
+ null,
898
+ null,
899
+ null,
900
+ null,
901
+ null,
902
+ null,
903
+ null,
881
904
  1,
882
905
  null,
883
906
  null,
@@ -902,10 +925,10 @@
902
925
  null
903
926
  ],
904
927
  "lines_covered_percent": 100.0,
905
- "covered_lines": 5,
928
+ "covered_lines": 6,
906
929
  "missed_lines": 0,
907
- "omitted_lines": 54,
908
- "total_lines": 5
930
+ "omitted_lines": 63,
931
+ "total_lines": 6
909
932
  },
910
933
  "lib/senec/local/error.rb": {
911
934
  "source": [
@@ -987,6 +1010,18 @@
987
1010
  " get('ENERGY', 'GUI_GRID_POW')",
988
1011
  " end",
989
1012
  "",
1013
+ " def grid_voltage",
1014
+ " get('PM1OBJ1', 'U_AC')",
1015
+ " end",
1016
+ "",
1017
+ " def grid_current",
1018
+ " get('PM1OBJ1', 'I_AC', precision: 2)",
1019
+ " end",
1020
+ "",
1021
+ " def grid_frequency",
1022
+ " get('PM1OBJ1', 'FREQ', precision: 2)",
1023
+ " end",
1024
+ "",
990
1025
  " def ev_connected",
991
1026
  " get('WALLBOX', 'EV_CONNECTED')",
992
1027
  " end",
@@ -1024,17 +1059,17 @@
1024
1059
  " raw_response.env[:duration]",
1025
1060
  " end",
1026
1061
  "",
1027
- " def get(*keys)",
1062
+ " def get(*keys, precision: 1)",
1028
1063
  " return unless parsed_response",
1029
1064
  "",
1030
1065
  " value = parsed_response.dig(*keys)",
1031
1066
  "",
1032
1067
  " if value.is_a?(Array)",
1033
1068
  " value.map do |v|",
1034
- " Value.new(v).decoded",
1069
+ " Value.new(v).decoded(precision:)",
1035
1070
  " end",
1036
1071
  " elsif value",
1037
- " Value.new(value).decoded",
1072
+ " Value.new(value).decoded(precision:)",
1038
1073
  " else",
1039
1074
  " raise Error, \"Value missing for #{keys.join('.')}\"",
1040
1075
  " end",
@@ -1083,9 +1118,9 @@
1083
1118
  1,
1084
1119
  1,
1085
1120
  1,
1086
- 26,
1087
- 26,
1088
- 26,
1121
+ 31,
1122
+ 31,
1123
+ 31,
1089
1124
  null,
1090
1125
  null,
1091
1126
  1,
@@ -1096,7 +1131,7 @@
1096
1131
  null,
1097
1132
  null,
1098
1133
  1,
1099
- 4,
1134
+ 5,
1100
1135
  null,
1101
1136
  null,
1102
1137
  1,
@@ -1132,6 +1167,18 @@
1132
1167
  null,
1133
1168
  null,
1134
1169
  1,
1170
+ 2,
1171
+ null,
1172
+ null,
1173
+ 1,
1174
+ 1,
1175
+ null,
1176
+ null,
1177
+ 1,
1178
+ 1,
1179
+ null,
1180
+ null,
1181
+ 1,
1135
1182
  1,
1136
1183
  null,
1137
1184
  null,
@@ -1169,49 +1216,49 @@
1169
1216
  null,
1170
1217
  null,
1171
1218
  1,
1172
- 24,
1219
+ 29,
1173
1220
  null,
1174
- 21,
1175
- null,
1176
- 21,
1177
- 3,
1178
- 11,
1221
+ 26,
1179
1222
  null,
1180
- 18,
1223
+ 26,
1224
+ 5,
1181
1225
  17,
1182
1226
  null,
1183
- 1,
1227
+ 21,
1228
+ 19,
1229
+ null,
1230
+ 2,
1184
1231
  null,
1185
1232
  null,
1186
1233
  1,
1187
1234
  null,
1188
1235
  null,
1189
1236
  1,
1190
- 27,
1237
+ 32,
1191
1238
  null,
1192
1239
  null,
1193
1240
  1,
1194
1241
  null,
1195
1242
  1,
1196
- 47,
1243
+ 57,
1197
1244
  null,
1198
1245
  null,
1199
1246
  1,
1200
- 26,
1201
- 26,
1202
- 24,
1247
+ 31,
1248
+ 31,
1249
+ 29,
1203
1250
  null,
1204
- 23,
1251
+ 28,
1205
1252
  null,
1206
1253
  null,
1207
1254
  null,
1208
1255
  1,
1209
- 26,
1256
+ 31,
1210
1257
  null,
1211
1258
  null,
1212
1259
  1,
1213
1260
  null,
1214
- 26,
1261
+ 31,
1215
1262
  null,
1216
1263
  null,
1217
1264
  null,
@@ -1220,10 +1267,10 @@
1220
1267
  null
1221
1268
  ],
1222
1269
  "lines_covered_percent": 100.0,
1223
- "covered_lines": 74,
1270
+ "covered_lines": 80,
1224
1271
  "missed_lines": 0,
1225
- "omitted_lines": 68,
1226
- "total_lines": 74
1272
+ "omitted_lines": 74,
1273
+ "total_lines": 80
1227
1274
  },
1228
1275
  "lib/senec/local/state.rb": {
1229
1276
  "source": [
@@ -1380,10 +1427,10 @@
1380
1427
  "",
1381
1428
  " attr_reader :prefix, :value, :raw",
1382
1429
  "",
1383
- " def decoded",
1430
+ " def decoded(precision: 1)",
1384
1431
  " case prefix",
1385
1432
  " when 'fl'",
1386
- " decoded_float(value)",
1433
+ " decoded_float(value, precision)",
1387
1434
  " when 'i3', 'u1', 'u3', 'u6', 'u8'",
1388
1435
  " decoded_int(value)",
1389
1436
  " when 'st'",
@@ -1403,8 +1450,8 @@
1403
1450
  " PREFIXES = %w[fl i3 u1 u3 u6 u8 st].freeze",
1404
1451
  " private_constant :PREFIXES",
1405
1452
  "",
1406
- " def decoded_float(hex)",
1407
- " [\"0x#{hex}\".to_i(16)].pack('L').unpack1('F').round(1)",
1453
+ " def decoded_float(hex, precision)",
1454
+ " [\"0x#{hex}\".to_i(16)].pack('L').unpack1('F').round(precision)",
1408
1455
  " end",
1409
1456
  "",
1410
1457
  " def decoded_int(hex)",
@@ -1419,16 +1466,16 @@
1419
1466
  1,
1420
1467
  1,
1421
1468
  1,
1422
- 44,
1423
- 44,
1469
+ 53,
1470
+ 53,
1424
1471
  null,
1425
1472
  null,
1426
1473
  1,
1427
1474
  null,
1428
1475
  1,
1429
- 44,
1476
+ 53,
1430
1477
  null,
1431
- 19,
1478
+ 28,
1432
1479
  null,
1433
1480
  19,
1434
1481
  null,
@@ -1449,7 +1496,7 @@
1449
1496
  1,
1450
1497
  null,
1451
1498
  1,
1452
- 19,
1499
+ 28,
1453
1500
  null,
1454
1501
  null,
1455
1502
  1,
@@ -1467,5 +1514,311 @@
1467
1514
  }
1468
1515
  },
1469
1516
  "groups": {},
1470
- "errors": {}
1517
+ "errors": {},
1518
+ "history": [
1519
+ {
1520
+ "created_at": "2026-09-16T05:40:57Z",
1521
+ "branch": "main",
1522
+ "commit": "3ac14efc3b8421c488fedcc4e65903bf971ece89",
1523
+ "totals": {
1524
+ "line": 99.33
1525
+ },
1526
+ "groups": {},
1527
+ "files": {
1528
+ "lib/senec.rb": {
1529
+ "line": 100.0
1530
+ },
1531
+ "lib/senec/cloud/connection.rb": {
1532
+ "line": 98.55
1533
+ },
1534
+ "lib/senec/cloud/error.rb": {
1535
+ "line": 100.0
1536
+ },
1537
+ "lib/senec/local/connection.rb": {
1538
+ "line": 100.0
1539
+ },
1540
+ "lib/senec/local/constants.rb": {
1541
+ "line": 100.0
1542
+ },
1543
+ "lib/senec/local/error.rb": {
1544
+ "line": 100.0
1545
+ },
1546
+ "lib/senec/local/request.rb": {
1547
+ "line": 100.0
1548
+ },
1549
+ "lib/senec/local/state.rb": {
1550
+ "line": 100.0
1551
+ },
1552
+ "lib/senec/local/value.rb": {
1553
+ "line": 100.0
1554
+ }
1555
+ }
1556
+ },
1557
+ {
1558
+ "created_at": "2026-12-01T10:13:47Z",
1559
+ "branch": "main",
1560
+ "commit": "3ac14efc3b8421c488fedcc4e65903bf971ece89",
1561
+ "totals": {
1562
+ "line": 98.36
1563
+ },
1564
+ "groups": {},
1565
+ "files": {
1566
+ "lib/senec.rb": {
1567
+ "line": 100.0
1568
+ },
1569
+ "lib/senec/cloud/connection.rb": {
1570
+ "line": 98.55
1571
+ },
1572
+ "lib/senec/cloud/error.rb": {
1573
+ "line": 100.0
1574
+ },
1575
+ "lib/senec/local/connection.rb": {
1576
+ "line": 100.0
1577
+ },
1578
+ "lib/senec/local/constants.rb": {
1579
+ "line": 100.0
1580
+ },
1581
+ "lib/senec/local/error.rb": {
1582
+ "line": 100.0
1583
+ },
1584
+ "lib/senec/local/request.rb": {
1585
+ "line": 96.25
1586
+ },
1587
+ "lib/senec/local/state.rb": {
1588
+ "line": 100.0
1589
+ },
1590
+ "lib/senec/local/value.rb": {
1591
+ "line": 100.0
1592
+ }
1593
+ }
1594
+ },
1595
+ {
1596
+ "created_at": "2026-12-01T10:14:04Z",
1597
+ "branch": "main",
1598
+ "commit": "3ac14efc3b8421c488fedcc4e65903bf971ece89",
1599
+ "totals": {
1600
+ "line": 99.34
1601
+ },
1602
+ "groups": {},
1603
+ "files": {
1604
+ "lib/senec.rb": {
1605
+ "line": 100.0
1606
+ },
1607
+ "lib/senec/cloud/connection.rb": {
1608
+ "line": 98.55
1609
+ },
1610
+ "lib/senec/cloud/error.rb": {
1611
+ "line": 100.0
1612
+ },
1613
+ "lib/senec/local/connection.rb": {
1614
+ "line": 100.0
1615
+ },
1616
+ "lib/senec/local/constants.rb": {
1617
+ "line": 100.0
1618
+ },
1619
+ "lib/senec/local/error.rb": {
1620
+ "line": 100.0
1621
+ },
1622
+ "lib/senec/local/request.rb": {
1623
+ "line": 100.0
1624
+ },
1625
+ "lib/senec/local/state.rb": {
1626
+ "line": 100.0
1627
+ },
1628
+ "lib/senec/local/value.rb": {
1629
+ "line": 100.0
1630
+ }
1631
+ }
1632
+ },
1633
+ {
1634
+ "created_at": "2026-12-01T10:14:13Z",
1635
+ "branch": "main",
1636
+ "commit": "3ac14efc3b8421c488fedcc4e65903bf971ece89",
1637
+ "totals": {
1638
+ "line": 99.34
1639
+ },
1640
+ "groups": {},
1641
+ "files": {
1642
+ "lib/senec.rb": {
1643
+ "line": 100.0
1644
+ },
1645
+ "lib/senec/cloud/connection.rb": {
1646
+ "line": 98.55
1647
+ },
1648
+ "lib/senec/cloud/error.rb": {
1649
+ "line": 100.0
1650
+ },
1651
+ "lib/senec/local/connection.rb": {
1652
+ "line": 100.0
1653
+ },
1654
+ "lib/senec/local/constants.rb": {
1655
+ "line": 100.0
1656
+ },
1657
+ "lib/senec/local/error.rb": {
1658
+ "line": 100.0
1659
+ },
1660
+ "lib/senec/local/request.rb": {
1661
+ "line": 100.0
1662
+ },
1663
+ "lib/senec/local/state.rb": {
1664
+ "line": 100.0
1665
+ },
1666
+ "lib/senec/local/value.rb": {
1667
+ "line": 100.0
1668
+ }
1669
+ }
1670
+ },
1671
+ {
1672
+ "created_at": "2026-12-01T10:14:14Z",
1673
+ "branch": "main",
1674
+ "commit": "3ac14efc3b8421c488fedcc4e65903bf971ece89",
1675
+ "totals": {
1676
+ "line": 69.5
1677
+ },
1678
+ "groups": {},
1679
+ "files": {
1680
+ "lib/senec.rb": {
1681
+ "line": 100.0
1682
+ },
1683
+ "lib/senec/cloud/connection.rb": {
1684
+ "line": 32.6
1685
+ },
1686
+ "lib/senec/cloud/error.rb": {
1687
+ "line": 100.0
1688
+ },
1689
+ "lib/senec/local/connection.rb": {
1690
+ "line": 100.0
1691
+ },
1692
+ "lib/senec/local/constants.rb": {
1693
+ "line": 100.0
1694
+ },
1695
+ "lib/senec/local/error.rb": {
1696
+ "line": 100.0
1697
+ },
1698
+ "lib/senec/local/request.rb": {
1699
+ "line": 100.0
1700
+ },
1701
+ "lib/senec/local/state.rb": {
1702
+ "line": 100.0
1703
+ },
1704
+ "lib/senec/local/value.rb": {
1705
+ "line": 100.0
1706
+ }
1707
+ }
1708
+ },
1709
+ {
1710
+ "created_at": "2026-12-01T10:24:23Z",
1711
+ "branch": "main",
1712
+ "commit": "9c041c8c542d65f6ffb03d89b3e534d225100fcf",
1713
+ "totals": {
1714
+ "line": 99.34
1715
+ },
1716
+ "groups": {},
1717
+ "files": {
1718
+ "lib/senec.rb": {
1719
+ "line": 100.0
1720
+ },
1721
+ "lib/senec/cloud/connection.rb": {
1722
+ "line": 98.55
1723
+ },
1724
+ "lib/senec/cloud/error.rb": {
1725
+ "line": 100.0
1726
+ },
1727
+ "lib/senec/local/connection.rb": {
1728
+ "line": 100.0
1729
+ },
1730
+ "lib/senec/local/constants.rb": {
1731
+ "line": 100.0
1732
+ },
1733
+ "lib/senec/local/error.rb": {
1734
+ "line": 100.0
1735
+ },
1736
+ "lib/senec/local/request.rb": {
1737
+ "line": 100.0
1738
+ },
1739
+ "lib/senec/local/state.rb": {
1740
+ "line": 100.0
1741
+ },
1742
+ "lib/senec/local/value.rb": {
1743
+ "line": 100.0
1744
+ }
1745
+ }
1746
+ },
1747
+ {
1748
+ "created_at": "2026-12-01T10:52:37Z",
1749
+ "branch": "main",
1750
+ "commit": "9c041c8c542d65f6ffb03d89b3e534d225100fcf",
1751
+ "totals": {
1752
+ "line": 99.34
1753
+ },
1754
+ "groups": {},
1755
+ "files": {
1756
+ "lib/senec.rb": {
1757
+ "line": 100.0
1758
+ },
1759
+ "lib/senec/cloud/connection.rb": {
1760
+ "line": 98.55
1761
+ },
1762
+ "lib/senec/cloud/error.rb": {
1763
+ "line": 100.0
1764
+ },
1765
+ "lib/senec/local/connection.rb": {
1766
+ "line": 100.0
1767
+ },
1768
+ "lib/senec/local/constants.rb": {
1769
+ "line": 100.0
1770
+ },
1771
+ "lib/senec/local/error.rb": {
1772
+ "line": 100.0
1773
+ },
1774
+ "lib/senec/local/request.rb": {
1775
+ "line": 100.0
1776
+ },
1777
+ "lib/senec/local/state.rb": {
1778
+ "line": 100.0
1779
+ },
1780
+ "lib/senec/local/value.rb": {
1781
+ "line": 100.0
1782
+ }
1783
+ }
1784
+ },
1785
+ {
1786
+ "created_at": "2026-12-01T10:55:06Z",
1787
+ "branch": "main",
1788
+ "commit": "e7a6b7b55a8587d77b49be36e0e5378e1e8c3498",
1789
+ "totals": {
1790
+ "line": 99.34
1791
+ },
1792
+ "groups": {},
1793
+ "files": {
1794
+ "lib/senec.rb": {
1795
+ "line": 100.0
1796
+ },
1797
+ "lib/senec/cloud/connection.rb": {
1798
+ "line": 98.55
1799
+ },
1800
+ "lib/senec/cloud/error.rb": {
1801
+ "line": 100.0
1802
+ },
1803
+ "lib/senec/local/connection.rb": {
1804
+ "line": 100.0
1805
+ },
1806
+ "lib/senec/local/constants.rb": {
1807
+ "line": 100.0
1808
+ },
1809
+ "lib/senec/local/error.rb": {
1810
+ "line": 100.0
1811
+ },
1812
+ "lib/senec/local/request.rb": {
1813
+ "line": 100.0
1814
+ },
1815
+ "lib/senec/local/state.rb": {
1816
+ "line": 100.0
1817
+ },
1818
+ "lib/senec/local/value.rb": {
1819
+ "line": 100.0
1820
+ }
1821
+ }
1822
+ }
1823
+ ]
1471
1824
  }