Closed riaandeyzel closed 8 years ago
These issues are likely unrelated. The config posted looks good. Since Owntracks is posting to CloudMQTT okay, I suspect the issue is that HA isn't connecting to CloudMQTT. Check your port number and username/password. Is there anything in the logs about a successful connection to the mqtt server?
The DHT issue I suspect is a wiring or sensor problem. I'd confirm that your sensor is working with an Arduino or some other device. Have you tried putting a resistor between the signal and voltage pin? HA will only throw a graph/icon once it receives readable data from the sensor.
That port number looks high - so my guess is you're using SSL - which I think takes some setting up on HA.
Try the non SSL port first (at least for the HA connection) - if that works then you know where to look. If I understand cloudmqtt correctly it will be 19362
Thanks for the reply, I have tried it with all the ports, but still no luck. Port 19362 SSL Port 29362 Websockets Port (TLS only) 39362
Even went this far:
mqtt:
broker: m10.cloudmqtt.com
port: 19362
port: 29362
port: 39362
username: Username
password: Password
device_tracker:
platform: owntracks
max_gps_accuracy: 200
Not a blip, what am I missing? I did change it back to just port 19362. I managed to setup 3 zones on the map, and that is all that are displaying at the moment, no tracking.
Here is a piece of the log file, it shows the IP's connecting from my Office and from the Pi: (I changed the IP' Accordingly)
1458039531: mosquitto version 1.4.5 (build date Mon, 09 Nov 2015 15:00:46 +0000) starting 1458039531: Config loaded from /var/lib/mosquitto/19362/mosquitto.conf. 1458039531: Opening ipv4 listen socket on port 29362. 1458039531: Opening websockets listen socket on port 39362. 1458039531: Opening ipv4 listen socket on port 19362. 1458039532: New connection from 100.100.100.100 on port 19362. 1458039534: New connection from 100.100.100.100 on port 19362. 1458039659: New connection from 200.200.200.200 on port 19362.
Not sure what the mosquitto is doing in there!
Kind regards, Riaan Deyzel
Gotcha. Yeah, I'd stick with port 29362. You can only have one port in the config file. I'm willing to bet that that there is an authentication issue with CloudMQTT. Did you create a new user in cloud mqtt for home assistant? I created one called pi and gave it unique password. You also have to grant access under ACLs as described in the CloudMQTT instructions here -> https://home-assistant.io/components/mqtt/
The DHT11 sensor might be fried. If you hooked it up backwards, it can break pretty quickly. I've gone through a few myself. I'd try a new sensor, confirm wiring, and test on a different device.
Btw, seeing Mosquito in the logs is normal. CloudMQTT runs on Mosquitto.
Here is my entire code with the obvious usernames and passwords masked as well as the coordinates:
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 36.946651
longitude: 23.563300
# C for Celcius, F for Fahrenheit
temperature_unit: C
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Africa/Johannesburg
# View all events in a logbook
logbook:
# Checks for available updates
updater:
# Allows you to issue voice commands from the frontend
conversation:
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Discover some devices automatically
discovery:
# Track the sun
sun:
# Enables support for tracking state changes over time.
history:
http:
api_password: mypassword
# Example configuration.yaml entry
sensor:
platform: forecast
api_key: b38ecesrwwger6e125fg434545t34534
monitored_conditions:
- summary
- icon
- nearest_storm_distance
- nearest_storm_bearing
- precip_type
- precip_intensity
- precip_probability
- temperature
- apparent_temperature
- dew_point
- wind_speed
- wind_bearing
- cloud_cover
- humidity
- pressure
- visibility
- ozone
# Example configuration.yaml entry
zone:
name: Home
latitude: 36.580141
longitude: 28.451132
radius: 100
icon: mdi:home
zone 2:
name: Work
latitude: 36.946575
longitude: 25.573223
icon: mdi:briefcase
# This will override the default home zone
zone 3:
name: Bug Out
latitude: 36.983878
longitude: 25.481895
radius: 100
icon: mdi:biohazard
# Example configuration.yaml entry
sensor:
platform: dht
sensor: DHT11
pin: 11
pin: 17
name: Temperature/Humidity Sensor
monitored_conditions:
- temperature
- humidity
# Example configuration.yaml entry
media_player:
platform: kodi
host: http://10.0.0.13
port: 8080
name: kodi
user: kodi
password: kodi
switch:
platform: rpi_gpio
ports:
2: Braai LED
3: Relay 2
4: Relay 3
7: Relay 4
8: Relay 5
9: Relay 6
10: Relay 7
# 11: Relay 8
# 17: DHT11 Sensor
# 18: GPIO 18
# 22: GPIO 22
# 23: GPIO 23
# 24: GPIO 24
# 25: GPIO 25
# 26: GPIO 26
# 27: GPIO 27
invert_logic: false
# Example configuration.yaml entry
binary_sensor:
platform: rpi_gpio
ports:
# 17: DHT11
18: Soil Moisture Sensor
22: Light Sensor
23: Sensor 4
24: Sensor 5
25: Sensor 6
26: Sensor 7
27: Sensor 8
pull_mode: "UP"
bouncetime: 50
invert_logic: false
device_tracker:
platform: owntracks
max_gps_accuracy: 200
mqtt:
broker: m10.cloudmqtt.com
port: 19362
username: myusername
password: mypassword
notify:
platform: pushbullet
api_key: l2yfJweqrtqw24234562456ert
name: riaan
ifttt:
key: b43634er24gwergwerery54
automation:
- alias: 'Send notification when sun rises'
trigger:
platform: sun
event: sunrise
offset: '+00:00:00'
action:
service: notify.pushbullet
data:
message: 'The sun is up.'
- alias: 'Send notification when sun sets'
trigger:
platform: sun
event: sunset
offset: '+00:00:00'
action:
service: notify.pushbullet
data:
message: 'The sun is down.'
# Example configuration.yaml entry
arduino:
port: /dev/ttyACM0
# Example configuration.yaml entry
sensor:
platform: systemmonitor
resources:
- type: disk_use_percent
arg: /home
- type: memory_free
- type: processor_use
I tested my DHT11 Sensor by following these steps, and it shows the Temp and the Humidity, so not sure why it is giving problems, perhaps the code above? https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/software-install-updated
Cloudmqtt only supports 1 connection per user. Make sure you have unique usernames
On Tue, Mar 15, 2016, 06:52 riaandeyzel notifications@github.com wrote:
I tested my DHT11 Sensor by following these steps, and it shows the Temp and the Humidity, so not sure why it is giving problems, perhaps the code above?
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub:
https://github.com/balloob/home-assistant/issues/1549#issuecomment-196827433
Yeah, definitely check your CloudMQTT settings through the CloudMQTT console. I suspect the issue is there.
Also, why do you have two pins for your DHT11 sensor? Should only be one.
I have removed the one pin and will check all connections tonight thanks, possible bad connection.
Should I perhaps install mosquitto on my raspberry pi as well by running the following: sudo apt-get install mosquitto
or does it not need it for CloudMQTT?
The CloudMQTT log now displays:
1458053129: Error: Unable to load server key file "/etc/mosquitto/server.key". Check keyfile.
I checked, but do not have the mosquitto folder or server.key file on my pi.
Running Mosquitto on your Pi is not necessary for Home Assistant. It is more complicated to setup. All you should need to use OwnTracks is the following. Did you check your server settings in the CloudMQTT console? Specifically, that you created a new account specifically for Home Assistant and that you granted read/write permission to whatever topic required (use # if unsure).
mqtt:
broker: m10.cloudmqtt.com
port: 29362
username: myusername
password: mypassword
device_tracker:
platform: owntracks
Do I then enter the same details on my phone under Preferences, Connection, Identification on the Owntracks app, or another unique users details that I created?
You need to create a separate user for each device and assign the read/write permission to the topic you're interested in.
Typically, I give all the logins access to the root topic (#).
Should I enter the following username and password supplied by CloudMQTT in the configuration.yaml file or one of the users I created manually?
Instance info Server: m10.cloudmqtt.com User: getuthhf (not real) Password: tyuif71POxDN (not real) Port 19362 SSL Port 29362 Websockets Port (TLS only): 39362 Connection limit: 10
//OR//
Manage Users kara with password on her Samsung A5 phone in Owntracks pi with password under the CloudMQTT section in the configutation.yaml file riaan with password on my Samsung S5 in Owntracks
Sorry for all the questions, I am new to all this IOT stuff, but enjoy it a lot, and would like to learn more.
Use the accounts you create, not the global login. Hope it works out! On Mar 15, 2016 1:43 PM, "riaandeyzel" notifications@github.com wrote:
Should I enter the following username and password supplied by CloudMQTT in the configuration.yaml file or one of the users I created manually?
Instance info Server: m10.cloudmqtt.com User: getuthhf (not real) Password: tyuif71POxDN (not real) Port 19362 SSL Port 29362 Websockets Port (TLS only): 39362 Connection limit: 10
//OR//
Manage Users kara * with *password on her Samsung A5 phone in Owntracks pi with password under the CloudMQTT section in the configutation.yaml file riaan with password on my Samsung S5 in Owntracks
Sorry for all the questions, I am new to all this IOT things, but enjoy it a lot, and would like to learn more.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/balloob/home-assistant/issues/1549#issuecomment-196943567
Good day
I am not having any luck with DHT11 Sensor or Owntracks yet. When I run the following command it does return Temperature and Humidity values: pi@raspberrypi:~/Adafruit_Python_DHT/examples $ sudo ./AdafruitDHT.py 11 17 Temp=23.0* Humidity=43.0%
Sensor should display Temperature icon and Humidity icon, but nothing gets displayed. I do have a unique number for sensor: Here is my full code now after some tweaks
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 37.646651
longitude: 23.783300
# C for Celcius, F for Fahrenheit
temperature_unit: C
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time$
time_zone: Africa/Johannesburg
# View all events in a logbook
logbook:
# Checks for available updates
updater:
# Allows you to issue voice commands from the frontend
conversation:
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Discover some devices automatically
discovery:
# Track the sun
sun:
# Enables support for tracking state changes over time.
history:
# Home Assistant Login Password
http:
api_password: password
# Forceast.io Weather Monitor (Working)
sensor 1:
platform: forecast
api_key: b38ecc948fbe1d6ed9fdb5b00000000
units: auto
monitored_conditions:
- summary
- icon
# - nearest_storm_distance
# - nearest_storm_bearing
# - precip_type
- precip_intensity
- precip_probability
- temperature
- apparent_temperature
- dew_point
- wind_speed
- wind_bearing
- cloud_cover
- humidity
- pressure
- visibility
- ozone
# My Zones On Map (Working)
zone:
name: Home
latitude: 37.980141
longitude: 23.491132
radius: 100
icon: mdi:home
zone 2:
name: Work
latitude: 37.946575
longitude: 23.544223
icon: mdi:briefcase
# This will override the default home zone
zone 3:
name: Bug Out
latitude: 37.943865
longitude: 25.581895
radius: 100
icon: mdi:biohazard
# DHT11 Temperature/Humidity Sensor (Not Working)
sensor 2:
platform: dht
sensor: DHT11
pin: 17
name: DHT11
monitored_conditions:
- temperature
- humidity
# Codi Media Player Status (Working)
media_player:
platform: kodi
host: http://10.0.0.13
port: 8080
name: kodi
user: kodi
password: kodi
# Transmission Switch (Working)
switch 1:
platform: transmission
host: 10.0.0.3
port: 9091
name: Transmission
username: admin
password: admin
# Transmission Sensor (Working)
sensor 3:
platform: transmission
host: 10.0.0.3
port: 9091
name: Transmission
username: admin
password: admin
monitored_variables:
- 'current_status'
- 'download_speed'
- 'upload_speed'
# Raspberry Pi Switches To Control GPIO Pins (Working)
switch 2:
platform: rpi_gpio
ports:
2: Braai LED
3: Relay 2
4: Relay 3
7: Relay 4
8: Relay 5
9: Relay 6
10: Relay 7
# 11: Relay 8
# 17: DHT11 Sensor
# 18: GPIO 18
# 22: GPIO 22
# 23: GPIO 23
# 24: GPIO 24
# 25: GPIO 25
# 26: GPIO 26
# 27: GPIO 27
invert_logic: false
# Raspberry Pi Connected Sensors
# binary_sensor 1:
# platform: rpi_gpio
# ports:
# 17: DHT11
# 18: Soil Moisture Sensor
# 22: Light Sensor
# 23: Sensor 4
# 24: Sensor 5
# 25: Sensor 6
# 26: Sensor 7
# 27: Sensor 8
# pull_mode: "UP"
# bouncetime: 50
# invert_logic: false
# CloudMQTT Connection (Not Working)
mqtt:
broker: m10.cloudmqtt.com
port: 29362
username: pi
password: password
# Owntracks Connection (Not Working)
device_tracker:
platform: owntracks
# Pushbullet Connection (Not Sure if it is Working - no automatic notifications)
notify:
platform: pushbullet
api_key: l000JaWNpo0vmLxejQFDZgM200000000
name: riaan
# IFTTT Connection (Not Sure if it is Working - no automatic notifications)
ifttt:
key: b000Ws4mn4Rfb139000000
# Automation Scripts (Not Sure if it is Working - no automatic notifications)
automation:
- alias: 'Send notification when sun rises'
trigger:
platform: sun
event: sunrise
offset: '+00:00:00'
action:
service: notify.pushbullet
data:
message: 'The sun is up.'
- alias: 'Send notification when sun sets'
trigger:
platform: sun
event: sunset
offset: '+00:00:00'
action:
service: notify.pushbullet
data:
message: 'The sun is down.'
# Connecting to Arduino Uno (Working)
arduino:
port: /dev/ttyACM0
# Arduino Uno Sensors A0-A5 (Working)
sensor 4:
platform: arduino
pins:
3:
name: Arduino A3
type: analog
2:
name: Arduino A2
type: analog
1:
name: Arduino A1
type: analog
0:
name: Arduino A0
type: analog
# Arduino Uno Swithes (Working)
switch 3:
platform: arduino
pins:
11:
name: Arduino D11
type: digital
12:
name: Arduino D12
type: digital
13:
name: Arduino D13
type: digital
# Raspberry Pi B Resources Monitor (Working)
sensor 5:
platform: systemmonitor
resources:
- type: disk_use_percent
arg: /home
- type: memory_free
- type: processor_use
Hmm, not really sure why MQTT isn't working. It should be now. I would make sure Owntracks is reporting your location in the app. There should be at least one point under the locations tab in the app. I would try sending an MQTT message using the mqtt/publish service and seeing if you can see that in your websocket of CloudMQTT.
As for the DHT sensor, are you running home assistant as root? It requires access to the GPIO pins so it needs root access. I thought this changed in Raspbian Jessie, but idk. I'd run as root for a bit and see if that fixes things.
Good day
Thanks for the reply, I would like to try those two steps, but a noob with Linux.
But it does not show up under Websocket Received Message?
@riaandeyzel
$sudo hass
This way may not be recommended if started as a service on the other hand.Thanks for the reply. I have sent a message to my CloudMQTT from the Send Message Console, it then shows up on the right hand side, but it does not seem to do anything, or send anything to HA?
I ran $sudo hass before, but then HA created a different blank new directory under /home/root/.homeassistant , and I do not want to go down that route again.
My current setup is /home/pi/.homeassistant , and the User in my Systemd Daemon startup file is "User=pi"
Not sure about rights issues, because everything else seems to work, even switching on/off GPIO pins on my Raspbery Pi and Arduino?
Can I assign the User pi rights to run everything as root, without the use of typing sudo all the time?
@riaandeyzel Since your running it with systemd as a service you could edit your startup file to use the user root with User=root
To avoid it using the wrong directory when started manually you can use --config
or in context
$ sudo hass --config /home/pi/.homeassistant/
I'll try to find some time this weekend and pickup a DHT sensor and experiment a bit with that part if no one has solved it for you by then.
@Landrash Will Home Assistant start up correctly, or do I then have to copy and paste the current code in the configuration.yaml file from /home/pi/.homeassistant/configuration.yaml to /home/root/.homeassistant/configuration.yaml for it to work correctly? And what else do I need to change?
if you do $ sudo hass --config /home/pi/.homeassistant/
it should work properly without copying content or moving any files. It should run it as root and no other changes.
There shouldn't be any other changes that I can think of atm. Just be aware that I just answered the question of how to run it as root and I'm uncertain if it solves your problem with the DHT sensor.
Thanks, but will it still auto start? My raspberry Pi Auto starts as pi user, does that not matter? All I need to change is the systemd User=root and run $ sudo hass --config /home/pi/.homeassistant/ once and restart?
The change your doing to your autostart script is changing it to run as root when autostarting. Since debuging without the possibility to run it manually I suggested the second part for you.
I would start with disabling the autostart and manually starting it until you get everything done that you want.
To manually start hass as root assuming it has not been started automatically by your autostart script you would run sudo hass --config /home/pi/.homeassistant/
Got both issues working thanks, I had to run hass as root an not pi.
Not really a good solution and if so then it needs to be properly documented.
Home Assistant release (
hass --version
): 0.15.0Python release (
python3 --version
): 3.4.2Component/platform: Raspberry Pi B
Description of problem: 1.Problems displaying and showing log or graph of Temperature and Humidity via my DHT11 Sensor.
Expected:
Information and steps so far
I have setup an account on CloudMQTT and when I click the upload location on my Samsung S5 with Owntracks installed it does upload the location from Owntracks to CoudMQTT, and I can see the location accuracy and battery life reported on CloudMQTT under Websocket UI (I changed some info obviously): owntracks/gkogftrs/Samsung S5 {"_type":"location","lat":23.7466192,"lon":29.5932276,"tst":1000021000,"acc":15,"batt":92,"t":"u","tid":"S5"}
Not sure what to do from there. Here is my current code for these two items:
Thanks, Riaan Deyzel