Skip to content

sendToDomoticz.py errors #81

Description

@siklosi

Hi,
there are few errors in sendToDomoticz.py
first of all
val_bat = sys.argv[6]
sys.argv[6] is actualy timestamp and sys.argv[5] is voltage.
Also domoticz accepts percentage (0-100) for battery

I modified this file for my self like this:

def translate(value, leftMin, leftMax, rightMin, rightMax):
    leftSpan = leftMax - leftMin
    rightSpan = rightMax - rightMin
    valueScaled = float(value - leftMin) / float(leftSpan)
    return rightMin + (valueScaled * rightSpan)

val_bat = str(translate(float(sys.argv[5]),1.8,3.3,0,100))

I'm assuming that max is 3.3 (I just bought 9 of this sensors and some are reporting 3.23) and for low I set it at 1.8 but I really don't know what is lowest voltage on which this sensors work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions