Coder Social home page Coder Social logo

Comments (7)

FastFrank avatar FastFrank commented on August 22, 2024

Maybe

valve_temp = (ord(es[es_pos + 0x0C]) + (ord(es[es_pos + 0x08]) & 128 ) * 2 ) / 10.0

works better...

from thermeq3.

autopower avatar autopower commented on August 22, 2024

Hello,
which version? 1xx or 2xx?

from thermeq3.

FastFrank avatar FastFrank commented on August 22, 2024

A version 1xx variant.

from thermeq3.

autopower avatar autopower commented on August 22, 2024

Please check code in 2xx version.
e.g.

lsb = ord(es[es_pos + 0x08]) & 0b01111111
msb = ((ord(es[es_pos + 0x08]) & 0b10000000) >> 7) * 256
# get set temp
valve_temp = float(lsb) / 2
# get measured temp
lsb = ord(es[es_pos + 0x0C])
valve_curr_temp = float(msb + lsb) / 10
# extract room name from this WallMountedThermostat
wall_room_id = str(self.devices[valve_adr][3])
# and update its value to current temperature as read from WallMountedthermostat
self.rooms[wall_room_id][3] = valve_curr_temp

from thermeq3.

FastFrank avatar FastFrank commented on August 22, 2024

Sorry,
I noticed the code divides with integer values: 2 and 10
So the result is an integer too.

Python 2.7.3 (default, Aug 8 2013, 22:36:42)
[GCC 4.6.4 20121210 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

11 / 2
5
11 / 2.0
5.5

Do you get only whole numbers for valve_temp and valve_curr_temp?

from thermeq3.

stephenmhall avatar stephenmhall commented on August 22, 2024

Hi guys I have a RPi / Python MAX Boiler controller and had the same problem. Stems from the fact that the temp is split over bytes at both ends of the message, so when it goes over 25.6 it flips the lower byte to 1 and goes back to 00 on the higher bits I solved it by building a binary text string and converting it back.

`
Get Binary at offset 8
valve_binary = "{0:08b}".format(int(self.hexify(es[es_pos + 0x08]), 16))

Use msb of offset 8 for msb of actual temperature
if valve_binary[0:1] == "1":
temp_headder = "01"
else:
temp_headder = "00"

Just use last 6 bits for set temp
valve_binary = valve_binary[-6:]
valve_temp = float(int(valve_binary, 2)) / 2 # set temp

curr_binary = "{0}{1:08b}".format(temp_headder,int(self.hexify(es[es_pos + 0x0C]), 16))
valve_curtemp = float(int(curr_binary, 2)) / 10 # measured temp

Hope that is of some use.
`

from thermeq3.

autopower avatar autopower commented on August 22, 2024

ad divide with int value of 2: there is a float(x) / 2 so the result will be float
ad msn/lsb: https://github.com/Bouni/max-cube-protocol
I'll check the code for wall mounted and HT. MSB is on bit 7 and bit 0 (HT). Fixed in V223.

from thermeq3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.