Closed Azza1979 closed 7 years ago
The nodeMCU has a micro USB port that you can plug into your Mac. I used the Arduino IDE to upload the code onto it. You'll need to install some stuff to be able to upload to it but a simple google search will help. If you have a barebones esp8266 you'll need a Serial to USB adapter (Google CP2102). Good luck!
Ok so I'm sort of there, but now I have done the code onto the Nodemcu and go to this address http://enter_ip_address/temperature (but with my IP address) it comes up with this {"temperature":263}.
I have installed npm install -g homebridge-http-temperature and updated my json but now when I run homebridge I get this
[4/20/2017, 8:53:42 AM] [Mum & Dad Temperature] Requesting temperature on "http://192.168.1.69/temperature?format=json", method GET [4/20/2017, 8:53:42 AM] [Mum & Dad Temperature] Error processing received information: undefined
Any suggestions
The only thing I can think of is that either HomeKit or the plugin is rejecting the high temperature. If I remove my sensor the temperature
value either drops to -83479825 or 2147483647 and HomeKit displays "No Response". Maybe try removing the ?format=json
after the URL but apart from that I have no clue. Could you paste your config.json (remove passwords, etc if there are any)?
pi@raspberrypi:~ $ homebridge WARNING The program 'node' uses the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node WARNING The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. WARNING Please fix your application to use the native API of Avahi! WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister [4/20/2017, 10:03:08 AM] Loaded plugin: homebridge-http-temperature [4/20/2017, 10:03:08 AM] Registering accessory 'homebridge-http-temperature.HttpTemperature' [4/20/2017, 10:03:08 AM] --- [4/20/2017, 10:03:08 AM] Loaded plugin: homebridge-rasppi-gpio-garagedoor [4/20/2017, 10:03:08 AM] Registering accessory 'homebridge-rasppi-gpio-garagedoor.RaspPiGPIOGarageDoor' [4/20/2017, 10:03:08 AM] --- [4/20/2017, 10:03:08 AM] Loaded config.json with 2 accessories and 0 platforms. [4/20/2017, 10:03:08 AM] --- [4/20/2017, 10:03:08 AM] Loading 2 accessories... [4/20/2017, 10:03:08 AM] [Back Garage Door] Initializing RaspPiGPIOGarageDoor accessory... [4/20/2017, 10:03:08 AM] [Back Garage Door] RaspPiGPIOGarageDoorAccessory version 1.0.10 [4/20/2017, 10:03:08 AM] [Back Garage Door] WARN! WARN! WARN! may not be able to control GPIO pins because not running as root! [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Switch Pin: 5 [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Switch Val: ACTIVE_HIGH [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Switch Active Time in ms: 1000 [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Closed Sensor: Configured [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Closed Sensor Pin: 21 [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Closed Sensor Val: ACTIVE_HIGH [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Open Sensor: Not Configured [4/20/2017, 10:03:08 AM] [Back Garage Door] Sensor Poll in ms: 4000 [4/20/2017, 10:03:08 AM] [Back Garage Door] Door Opens in seconds: 14 [4/20/2017, 10:03:08 AM] [Back Garage Door] We have a door sensor, monitoring door state enabled. [4/20/2017, 10:03:08 AM] [Back Garage Door] Initial Door State: OPEN [4/20/2017, 10:03:08 AM] [Back Garage Door] Setting state to 0 [4/20/2017, 10:03:08 AM] [Mum & Dad Temperature] Initializing HttpTemperature accessory... Scan this code with your HomeKit App on your iOS device to pair with Homebridge:
┌────────────┐
│ 031-45-154 │
└────────────┘
[4/20/2017, 10:03:08 AM] Homebridge is running on port 51826. [4/20/2017, 10:03:24 AM] [Mum & Dad Temperature] Requesting temperature on "http://192.168.1.69/temperature", method GET [4/20/2017, 10:03:25 AM] [Mum & Dad Temperature] Error processing received information: undefined ç^X^C[4/20/2017, 10:03:40 AM] Got SIGINT, shutting down Homebridge... pi@raspberrypi:~ $ cd /home/pi/.homebridge pi@raspberrypi:~/.homebridge $ sudo nano config.json
GNU nano 2.2.6 File: config.json
"accessory": "RaspPiGPIOGarageDoor",
"name": "Back Garage Door",
"doorSwitchPin": 5,
"doorSwitchPressTimeInMs": 1000,
"doorSwitchValue": 1,
"closedDoorSensorPin": 21,
"closedDoorSensorValue": 1,
"doorPollInMs": 4000,
"doorOpensInSeconds": 14
},
{
"accessory": "HttpTemperature",
"name": "Mum & Dad Temperature",
"url": "http://192.168.1.69/temperature?format=json",
"http_method": "GET"
}
]
}
Does it mater that I'm using a DHT22 sensor ?
Ok so I just took the data wire off and now it works properly reading -50. So Im thinking it has to do with the dht22
Ah, check the code in the DHT22 branch then - I got one myself yesterday and added the code for it. You'll need to install the Adafruit Sensor Library if you haven't already to get it working (I'm lazy 😅).
Bit of fun information, the temp sensor i was using before was analog so I had to do a bit of witchcraft to get it working (not really, but it was a fun thing to mess around with). The DHTxx is digital so connecting the data pin to an analog pin probably doesn't work the way it should 😛
As the DHT22 supports humidity, you can swap to the homebridge-httptemperaturehumidity
plugin to get a humidity accessory as well. The sensor I was using before didn't support humidity, so I had no need to use it.
I got it all going thanks for the help mate really appreciate it.
Hi
Could you please tell me how I get the code onto the nodemcu. I have homebridge up and running on raspberry pi but just have little knowledge of the esp8266. Any help would be great Thanks Aaron