dvdsk / HomeAutomation

System to automate lighting and audio interacting through a web interface and telegram bot
3 stars 1 forks source link

checkvalue is not used in co2 sensor readout #3

Closed dvdsk closed 7 years ago

dvdsk commented 8 years ago

On the data:

orgbyte 1: 86
orgbyte 2: 3
orgbyte 3: B
orgbyte 4: 3F
orgbyte 5: 0
orgbyte 6: 0
orgbyte 7: 0
orgbyte 8: 2D

the correct calculation would be

>>> 0x86+0x02+0xd9+0x3f
416
>>> 0xff-416
-161
>>> 0xff - 160
95
>>> hex(95 + 1)
'0x60'

or

>>> 0x86+0x02+0xd9+0x3f
416
>>> hex(416)
'0x1a0'
>>> 0xff - 0xa0 + 1
96
>>> hex(96)
'0x60'

things to watch out for are: (1) 0x86 != 86, (2) De overflow van 0xff - [som].

dvdsk commented 7 years ago

checkvalue now works