alengwenus / esphome_components

External components for ESPHome
GNU General Public License v3.0
29 stars 9 forks source link

fix missing 24-bit interpretation (signed integer) #11

Closed rakragh closed 6 months ago

rakragh commented 1 year ago

Would be good to consider in ESPhome. Let me know if you have questions.

alengwenus commented 1 year ago

Hi @rakragh , sorry for not reviewing earlier. I wonder which smart meter uses 24bit integers. To my knowledge a 24bit representation is not defined in the SML specification.

Could you provide me with an example, why and where you need this representation?

ichbinsnur commented 11 months ago

Hello. I recently tried to connect my EFR SGM-C8-A620S meter and ran into the same issue with the exported energy counter.

The value for imported energy is given as 4byte hex, but the export (confusingly) only as 3 byte. That leads to a conversion error giving a ridicolous high value.

Here are the corresponding Log entries from the Sensor node:

[18:49:01][D][sensor:093]: 'Total energy consumed': Sending state 1925.06372 kWh with 3 decimals of accuracy [18:49:01][D][text_sensor:064]: 'Total_energy_exported_hex': Sending state '0xdf383a' [18:49:01][D][sensor:093]: 'Total energy exported bin': Sending state 1844674360770560.00000 kWh with 3 decimals of accuracy [18:49:01][D][sensor:093]: 'Current Power': Sending state 43.00000 W with 0 decimals of accuracy [18:49:01][D][sensor:093]: 'Current Voltage': Sending state 226.80000 V with 1 decimals of accuracy [18:49:01][D][sensor:093]: 'Current Current': Sending state 0.58000 A with 2 decimals of accuracy [18:49:01][D][sensor:093]: 'Current Frequency': Sending state 49.90000 Hz with 3 decimals of accuracy [18:49:01][D][sml:066]: OBIS info: [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:96.50.1 [0x454652] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:96.1.0 [0x0a014546522203e18065] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:1.8.0 [0x0125bdce] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:2.8.0 [0xdf383a] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:16.7.0 [0x2b] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:36.7.0 [0xf1] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:56.7.0 [0xff74] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:76.7.0 [0x00c7] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:32.7.0 [0x08dc] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:52.7.0 [0x08e0] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:72.7.0 [0x08e5] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:31.7.0 [0x3a] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:51.7.0 [0x6c] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:71.7.0 [0x70] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:81.7.1 [0x7a] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:81.7.2 [0x00f0] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:81.7.4 [0x76] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:81.7.15 [0x00e1] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:81.7.26 [0x04] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:14.7.0 [0x01f3] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:0.2.0 [0x30312e3033] [18:49:01][D][sml:072]: (0a014546522203e18065) 1-0:97.97.0 [0x0000]

For comparision :

'Total energy consumed': Sending state 1925.06372 kWh with 3 decimals of accuracy [D][sml:072]: (0a014546522203e18065) 1-0:1.8.0 [0x0125bdce]

'Total energy exported bin': Sending state 1844674360770560.00000 kWh with 3 decimals of accuracy 'Total_energy_exported_hex': Sending state '0xdf383a' [D][sml:072]: (0a014546522203e18065) 1-0:2.8.0 [0xdf383a]

df383a correctly evatuates to -> 14628922 which gives the correct 1462.8922 kWh

It would be great if this could be implemented soon.

Anyway, i am also quite open for suggestions to wor around this.