GithubHelp home page GithubHelp logo

Comments (4)

Supereg avatar Supereg commented on June 15, 2024 1

Any error messages which are produced by this plugin?
try a pattern like this "statusPattern": "\"value\":([0-9]{2})".
Note that I removed the slashes at the beginning and the end since those are not needed.
The plugin extracts the value contained in the first group (configurable). As you just want the number you just need to but the number matching in brackets so only the numbers get extracted.

from homebridge-http-temperature-sensor.

pierzcha avatar pierzcha commented on June 15, 2024

Any error messages which are produced by this plugin?
try a pattern like this "statusPattern": "\"value\":([0-9]{2})".
Note that I removed the slashes at the beginning and the end since those are not needed.
The plugin extracts the value contained in the first group (configurable). As you just want the number you just need to but the number matching in brackets so only the numbers get extracted.

Thanks for answer, when I try my regax I got:
[Temperature Sensor] getTemperature() error occurred while extracting temperature from body: Pattern didn't match (value: '{"tempSensor":{"sensors":[{"type":"temperature","id":0,"value":2118,"trend":2,"state":2,"elapsedTimeS":2209}]}}', pattern: '/\/((?<="value":)[0-9]{2})\//')

When I changed to your suggestion it worked :) Thank you very much

It would be possible to add one or two additional digits after the decimal point, e.g. 21,1 or 21.18 ??

from homebridge-http-temperature-sensor.

Supereg avatar Supereg commented on June 15, 2024

... Pattern didn't match ...
Yeah one problem were the leading and trailing slash. And I see now this mistake is also present in the README 😅

In theory yes but in praxis no. The plugin will happily accept those numbers if they are formatted correctly (so there is a decimal point in the input). And the will round it to 0.5 steps (as HomeKit expects it). But it cannot handle it in the format you are currently supplying it (without a decimal point)

from homebridge-http-temperature-sensor.

pierzcha avatar pierzcha commented on June 15, 2024

... Pattern didn't match ...
Yeah one problem were the leading and trailing slash. And I see now this mistake is also present in the README 😅

In theory yes but in praxis no. The plugin will happily accept those numbers if they are formatted correctly (so there is a decimal point in the input). And the will round it to 0.5 steps (as HomeKit expects it). But it cannot handle it in the format you are currently supplying it (without a decimal point)

I changed my index.js file and formatted the data there so that it would display correctly. Thanks for the help.

from homebridge-http-temperature-sensor.

Related Issues (18)

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.