metbosch / homebridge-http-temperature Goto Github PK
View Code? Open in Web Editor NEWHomeBridge HomeKit Plugin for HTTP temperature endpoints
Home Page: https://www.npmjs.com/package/homebridge-http-temperature
License: Apache License 2.0
HomeBridge HomeKit Plugin for HTTP temperature endpoints
Home Page: https://www.npmjs.com/package/homebridge-http-temperature
License: Apache License 2.0
Is there a way to get the Homberidge to poll the http sensor and push a value to HomeKit when there is a change?
Or better yet, have an open connection to the http sensor to constantly measure for a change?
I tried both http plugins (temp and humidity) from you but only with temp plugin I get values. Humidity always shows 0 whole the json file offers a value. Below my config code. Is there something wrong. Sorry I'm new to this
If you're using Celsius, none of this applies. If you're using Fahrenheit, the default min_temp is good for pretty much everyplace on earth except Antarctica. The default max_temp, though, doesn't cut it if you're within the 38th parallels. It's not a critical issue, but the max_temp default should probably be something like 120 or 130.
This there support for viewing historical temperature/humidity data in EVE app?
Hi, I have a problem to get data to homebridge. I still get messages HTTP bad response. I don't know where is a problem, could somene help me? I tried everything. Here is part of my code from arduino (which works without problem)
EthernetClient client = server.available();
if(client){
Serial.println("new client");
boolean currentLineIsBlank = true;
while(client.connected()){
if(client.available()){
char c = client.read();
Serial.write(c);
if(c == '\n' && currentLineIsBlank){
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: application/json");
client.println("Connection: close");
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println(F("{"));
client.print(F("\t\"temperature\": "));
client.println(temperature);
client.println(F("}"));
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
delay(1);
// close the connection:
client.stop();
"accessory": "HttpTemperature",
"name": "Outside Temperature",
"url": "http://192.168.1.170",
"http_method": "GET",
"field_name": "temperature"
I am able to get a bare temperature value out of my Autelis Poolcontrol by visiting an URL, however I cannot seem to get the HttpAccessory to use that data without errors. Any insight would be very helpful.
Here's my config
"accessory": "HttpTemperature", "name": "Pool Temperature", "url": "http://192.168.1.201/status/pooltemp", "field_name": "", "auth": { "user": "user", "pass": "pass" } }
That URL outputs 73 (although there is a trailing space at the end of the output...)
And here's the error
[Pool Temperature] Error processing received information: Unexpected token [Pool Temperature] Error processing received information: Invalid value received
To connect to my device, I need to send a header for auth. Is that supported?
When I installed the plugin and edited my config.json, all of my devices started showing up as not responding, and the icon for the bridge changed to a temperature sensor. I didn't make any changes to the config other than adding the additional accessory
{ "accessory": "HttpTemperature", "name": "Temperature", "url": "http://weatherundergroundapi.json "field_name": "current_observation\"][\"temp_f", "update_interval": "0" }
I actually ended up having to delete and remove the bridge from my home to get things working again (even after I had removed the plugin and restored the config.json, removed persist/accessory folders). Not sure it is strictly related to this plugin, but things had been working flawlessly until I tried to add this plugin and it was quite strange behavior (and the fact that the HomeBridge hub icon changed to a temp sensor says to me that there had to be something related to this plugin).
I really like the idea of getting outside temperature into homekit without having to buy an expensive sensor, but homebridge also runs my door locks so I need to make sure nothing affects that functionality!
Sometimes a sensor may not be reachable.
In this case, the plugin tries to get latest temp information from the sensor but it can't.
During this time, in home app the plugin continuously reports the latest value like everything works ok. If the sensor continues to be unavailable, there will be no way for the user to informed of the problem.
I suggest, the way plugin works changes, in a way that if no valid temperature is received for more than i.e. 15mins the plugin goes in "no response" or "unavailable" state in home app.
In this way the user will know s/he needs to do something...
Nice plugin, simple and effective. I appreciate the work that's gone into it.
This is a completely non-critical issue, but is there any way to change the logging behavior? The default is fairly verbose, and it does clutter the log file a bit.
First of all, thank you for this great plugin.
Today I discovered that only 0 or positive temperature values are supported.
To fix the issue and support negative temperatures too, replace the following code in
index.js (line 74-76)
this.temperatureService
.getCharacteristic(Characteristic.CurrentTemperature)
.on('get', this.getState.bind(this))
by
this.temperatureService
.getCharacteristic(Characteristic.CurrentTemperature)
.on('get', this.getState.bind(this))
.setProps({
minValue: -50,
maxValue: 100
});
and you're done.
Cheers, MichaelS75
I have an outside sensor and below 0 degrees the plugin is not working.
Im not really sure how to fix that..
Is it possible to modify this plugin to:
Work without JSON. Read an integer value from a page that returns nothing but that integer value.
Work with a password protected page. Similar to homebridge-http, this would require username and password parameters.
This is an excellent plugin. So I use it for multiple instances of calls to each of two servers using the json decode capability to fetch different data. One wants to space out the calls to each server to avoid overloading it. For example, the Davis WeatherLink tolerates one call each 10 seconds for the local net api. I make several calls to get temp at different locations and hum and rain and wind and ... (I read wind and rain into HomeKit as temperature as there is no other option for such data and that works.) I try to space out the calls with varying update_interval values, but that is not defined in this situation and not ideal since key data gets missed. Would there be a way for this plugin to apply an update_interval to a sequence of instances calling one server?
I could imagine some approach involving the platform capability of homebridge that would allow one call to allow multiple json decoded values to go to different HomeKit appliances at a single update_interval. I don't think I have the knowledge/ability to offer to code that.
Hi, I get a response in the form
{ "Header":{ "Version":5, "Device":"80", "Timestamp":1588082165 }, "Data":{ "Inputs":[ { "Number":4, "AD":"A", "Value":{ "Value":15.7, "Unit":"1" } } ]}, "Status":"OK", "Status code":0 }
from the http request from my device.
How can I get the Value 15.7?
I tried [0].[0].Value and some similar things.
Can you help me?
Hi I found this interesting but am wondering if you have a link to the hardware setup and possible the arduino code you're running there.
Also wondering is the temperature retrieved when Siri is asked for it? Is that how it works? Thanks.
Hello,
Like the issue thread #31, humidity always show 0.
In Homebridge UI I see this warning message :
This plugin generated a warning from the characteristic 'Current Relative Humidity': characteristic value expected valid finite number and received "Error: Invalid value received" (object). See https://homebridge.io/w/JtMGR for more info.
However my URL return 58 at this time.
Here is my JSON :
{
"accessory": "HttpHumidity",
"name": "Humidite cabinet",
"url": "http://10.0.1.103/core/api/jeeApi.php?apikey=4pyz8UFyJrbQUiGqQbj0u6ACJGtX6J2C&type=cmd&id=3624",
"field_name": "",
"_bridge": {
"username": "0E:83:DD:29:58:C9",
"port": 55198
}
}
Any idea ?
Thanks
Hi, please help to parse multi-level JSON
{
"system": {
"hostname": "ESP8266",
"uptime": 273,
"rssi": -44,
"freemem": 30608
},
"sensors": {
"bmet": 27.3,
"bmeh": 45.9,
"bmep": 748.49,
"dsw1": 21.2
}
}
What should i place in field_name to parse bmet
If I write "field_name": "bmet"
or "field_name": "sensors.bmet"
ERROR appears:
Error processing received information: Received value is not a number: "NaN"
Would it be possible to add config option to set frequency of fetching data.
I'm using national weather service and I don't want to spam their service (they change data every 5 minutes or so).
Hello,
i try to get temperature working with my arduino + homebridge.
Ive tried several possibilitys but cant figure out what sentence i have to send back to your temp-script.
Every time it trys to parse the temp its killing homebridge.
I tried:
String s = "HTTP/1.1 200 OK\r\n{\r\n "temperature": ";
s += temp;
s += "\r\n}";
client.print(s);
client.flush();
as well as:
String s = "{"temperature": ";
s += temp;
s += "}";
i first tried with a fixed variable -> long temp = 20.0;
Could you help?
When i reroute to an php-script with content:
{
"temperature": 20.0
}
the script works... :-(
Regards, Jan
My thermometer reports temperature data in Fahrenheit and temperature units on my iPhone are set to degrees Fahrenheit. Apparently homekit expects values in Celsius which results in for example, 68 degrees being displayed as 154.
It would be helpful to have a configuration option in the plugin for temperature units. If units are set to Fahrenheit, convert to Celsius before sending to homekit.
I have an eds enet2 1-wire server (up to 21 1-wire devices). It does not put out json.
But I can poll individual devices with:
http://192.168.178.75/gettag.csv?romid=160008025B548B10&tag=Temperature&title=0
the output is just the temperature value in celsius eg.:
15.3
Line 66 can not return just the body text, as this.fieldname is never empty. (default: " temperature")
Can you change line 26?
this.fieldName = config["field_name"] || "";
Hello,
I would like to use this plugin with a shelly 1PM with a temperature add-on.
I use this configuration :
{
"accessory": "HttpTemperature",
"name": "Temperature Exterieur",
"url": "http://X.X.X.X/rpc/Temperature.GetStatus?id=100&format=json",
"http_method": "GET",
"field_name": "tC",
"units": "C",
"debug": true,
"auth": {
"user": "admin",
"pass": "XXXXXXXX"
}
}
the shelly query returns the following result:
{"id": 100,"tC":17.8, "tF":64.1}
I have the following error : Error updating state: Unexpected end of JSON input
An idea of the problem ?
Thanks,
Emmanuel
Hi, thanks for this plugin, which does work, allowing me get the temperature from a Shelly 1 with Temp Add-on into Homebridge. However, I constantly see this warning:
[7/22/2022, 7:48:51 AM] [homebridge-http-temperature] This plugin slows down Homebridge. The read handler for the characteristic 'Current Temperature' was slow to respond!
Is there any way to avoid this?
my endpoint returns the temperature in celcius with 2 decimal points of precision (e.g. 28.25). However the temperature displayed on the Home app is rounded to the nearest degree F. In the Eve app, the temperature is shown with one decimal place. Am I doing something wrong? Is there a way to have the Home app display at least one decimal place?
config.json:
{
"accessory": "HttpTemperature",
"name": "Pool Temperature",
"update_interval": "0",
"field_name": "",
"url": "http://10.0.1.18/temp.php?sensor=Pool&scale=C"
},
I expose my temperature sensor data via Prometheus (https://github.com/leahneukirchen/lywsd03mmc-exporter) and wanted a way to pull that into Homebridge using your plugin
Here is a curl command to get the temperature from Prometheus API
curl -g 'http://x.x.x.x:9090/api/v1/query?query=last_over_time(thermometer_temperature_celsius{room="Office"}[1h])' |jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 271 100 271 0 0 264k 0 --:--:-- --:--:-- --:--:-- 264k
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"__name__": "thermometer_temperature_celsius",
"instance": "x.x.x.x:9265",
"job": "temperature-sensors",
"mac": "A4C1383D02A0",
"room": "Office",
"sensor": "LYWSD03MMC"
},
"value": [
1635139324.556,
"21.8"
]
}
]
}
}
Here is what worked for me in case anyone else needs it...
{
"accessory": "HttpTemperature",
"name": "Office",
"url": "http://x.x.x.x:9090/api/v1/query?query=last_over_time(thermometer_temperature_celsius{room='Office'}[1h])",
"http_method": "GET",
"field_name": "data.result[0].value[1]"
},
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.