Weber iGrill 2 integration with Lovelace UI

Yeah, it actually appears like two devices connect from my iGrill Pi and then one disconnects and the other stays connected. I think you’re on to something though. It’s gotta be something related to the mqtt configuration somehow. Here’s what the Mosquitto log looks like when one stays connected and the other disconnects:

1563130438: New connection from 192.168.1.146 on port 1883.
[INFO] found pi on local database
1563130438: New client connected from 192.168.1.146 as auto-7B360604-285F-AFC2-B0AE-AF62D452B333 (p2, c1, k60, u'pi').
1563130442: New connection from 192.168.1.146 on port 1883.
1563130442: New client connected from 192.168.1.146 as auto-2B208C06-B85A-517B-8209-57A42A983F4F (p2, c1, k60, u'pi').
1563130528: Client auto-7B360604-285F-AFC2-B0AE-AF62D452B333 has exceeded timeout, disconnecting.

The second one that connects stays connected.

I’m running Mosquitto Broker as a Hass.io add on and here’s my configuration:

{
  "logins": [
    {
      "username": "pi",
      "password": "xxxxxxxx"
    }
  ],
  "anonymous": true,
  "customize": {
    "active": true,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

My mqtt.yaml within the iGrill configuration looks like this:

#MQTT All values default to paho.mqtt.client defaults
mqtt:
  host:       '192.168.1.40'                   # Optional default 'localhost'
  port:       1883                                 # Optional default '1883'
  keepalive:  60                                   # Optional default '60'
  auth:                                            # Optional If included, username_pw_set() is called with user/password
    username: 'pi'                               # Required (when auth is present)
    password: 'xxxxxxx'                               # Optional
#  tls:                                             # Optional If included, tls_set() is called with the following:  (default is paho.mqtt.client.tls_set() defaults)
#    ca_certs:                                      # Optional
#    certfile:                                      # Optional
#    keyfile:                                       # Optional
#    cert_reqs:                                     # Optional
#    tls_version:                                   # Optional
#    ciphers:                                       # Optional

I used to run a smartthings-mqtt-broker so I know how finicky MQTT can be, but I feel like I have everything configured correctly. Do you know if I should see the devices communicating within the mosquitto logs? I can’t remember if they flowed through the logs or not. In otherwords, should I see Probe 1 Temp, Probe 2 Temp, etc values if its working correctly?

Are you able to add an additional login for the igrill thru the hassio plugin. I run mine outside of that, but I did create a user in MQTT just for the igrill because it seemed like HA and the igrill were stepping on each other

I did try adding a separate username. I also thought that perhaps my NUC’s firewall could be blocking the MQTT messages so I disabled it, but still no luck. It’s so bizarre too because monitor.py authenticates right away

and bluetooth connects with no problems:

I really want to make it work, but I’m chalking it up to an MQTT communication issue that I just can’t resolve. I tired installing the broker outside of Hass.io as well, but just ran into the same problem. Thank you for your responses anyway.

I ended up trying out Cloud MQTT just to see if it was my broker configuration that was causing the problem. I’m able to connect both ./Monitor.py and Home Assistant to the broker and have specified the correct topics within Cloud MQTT. I can now see the devices in Home Assistant, but there is no value passing through to Home Assistant.

Should I see values passing through the broker’s logs? In the logs, all I see is the connection status and no probe temperature values. If that’s the case, then I suspect something is wrong with my igrill configuration on my Pi.

If you turn up the logging on HA MQTT to debug you should see the messages coming in, make sure you have at least one probe plugged in

The above will show up by just setting up the sensors in your config. Here is what my mossquitto log (broker) looks like with the igrill connecting and publishing the temp for probe 1:

1563325017: New connection from 192.168.1.139 on port 1883.
1563325017: New client connected from 192.168.1.139 as 5411AF16-9169-8ED8-EEA2-CA8040FA559F (p2, c1, k60, u'hass').
1563325017: No will message specified.
1563325017: Sending CONNACK to 5411AF16-9169-8ED8-EEA2-CA8040FA559F (0, 0)
1563325017: Received PUBLISH from 5411AF16-9169-8ED8-EEA2-CA8040FA559F (d0, q0, r0, m0, 'bbq/grill/probe1', ... (4 bytes))
1563325017: Sending PUBLISH to auto-CFB93364-1180-4790-C02A-FF3AA6624731 (d0, q0, r0, m0, 'bbq/grill/probe1', ... (4 bytes))

so the igrill connects as client 5411AF16-9169-8ED8-EEA2-CA8040FA559F, it then publishes the temp for probe 1 to the broker:

1563325017: Received PUBLISH from 5411AF16-9169-8ED8-EEA2-CA8040FA559F (d0, q0, r0, m0, 'bbq/grill/probe1', ... (4 bytes))

The broker then in turns publishes a message to the Homeassistant mqtt client:

1563325017: Sending PUBLISH to auto-CFB93364-1180-4790-C02A-FF3AA6624731 (d0, q0, r0, m0, 'bbq/grill/probe1', ... (4 bytes))

Then looking at the logs in homeassistant, with debug on for MQTT you should see confirmation the value was passed:

2019-07-16 20:08:26 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on bbq/grill/probe1: b'75.0'

and finally you should see it on the sensor itself:

Add the following to the configuration.yaml for debug:

logger:
  default: error 
  logs:
    homeassistant.components.mqtt: debug

Here is my igrill mqtt config:

#MQTT All values default to paho.mqtt.client defaults
mqtt:
  host:       '192.168.1.119'                   # Optional default 'localhost'
  port:       1883                                 # Optional default '1883'
  base_topic: 'bbq'                                # Optional default 'bbq'
  keepalive:  60                                   # Optional default '60'
  auth:                                            # Optional If included, username_pw_set() is called with user/password
    username: 'hass'                               # Required (when auth is present)
    password: 'xxxxxxxx'                        # Optional
#  tls:                                             # Optional If included, tls_set() is called with the following:  (default is paho.mqtt.client.tls_set() defaults)
#    ca_certs:                                      # Optional
#    certfile:                                      # Optional
#    keyfile:                                       # Optional
#    cert_reqs:                                     # Optional
#    tls_version:                                   # Optional
#    ciphers:                                       # Optional

One other thing you can try since it seems like you are narrowing in on the igrill writing. modify the monitor.py file under def main():

Make the following 2 lines look like this:

parser.add_argument('-l', '--log-level', action='store', dest='log_level', default='DEBUG',
                        help='Set log level, default: \'info\'')
parser.add_argument('-d', '--log-destination', action='store', dest='log_destination', default='/home/pi/igrill/igrill.log',
                        help='Set log destination (file), default: \'\' (stdout)')

restart the igrill service and you should get a log file in /home/pi/igrill/ (or put it in a different directory that makes sense for you, that will give a lot of detail as to what is or is not going on)

goodluck!

Really, thank you for your responses and suggestions. I’ve setup logging on both the igrill and Home Assistant. I’m not receiving errors on either one.

Here’s my HA log (no errors were thrown):

2019-07-16 20:56:44 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to bbq/grill/probe1
2019-07-16 20:56:44 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to bbq/grill/probe2

The logs from my igrill look like this:

2019-07-16 21:31:21,205 grill INFO: Authenticated
2019-07-16 21:31:22,182 grill DEBUG: Published temp: {1: 71.0, 2: 71.0, 3: False, 4: False} and battery: 56.0 to topic bbq/grill
2019-07-16 21:31:22,182 grill DEBUG: Sleeping for 20 seconds
2019-07-16 21:31:43,145 grill DEBUG: Published temp: {1: 71.0, 2: 71.0, 3: False, 4: False} and battery: 56.0 to topic bbq/grill
2019-07-16 21:31:43,145 grill DEBUG: Sleeping for 20 seconds
2019-07-16 21:32:04,010 grill DEBUG: Published temp: {1: 71.0, 2: 70.0, 3: False, 4: False} and battery: 56.0 to topic bbq/grill
2019-07-16 21:32:04,011 grill DEBUG: Sleeping for 20 seconds
2019-07-16 21:32:24,973 grill DEBUG: Published temp: {1: 70.0, 2: 70.0, 3: False, 4: False} and battery: 56.0 to topic bbq/grill

So igrill is publishing the values, my MQTT broker connections look good and Home Assistant isn’t throwing any errors. So I can only think of two possible issues.

  1. My configuration for the sensors is incorrect; or
  2. I’m running Python 3 and I didn’t realize it.

If it’s #1, here’s my device.yaml configuration for igrill:
devices:

  - name:       'grill'                  # Unique name of the device
    type:       'igrill_v2'              # Supported devices: igrill_mini, igrill_v2, igrill_v3
    address:    'xxxxxxx'      # The MAC of the device
    topic:      'bbq'    # The topic to publish on. will have name and probe number appended: <topic>/<name>/probe{1..4}
    interval:   20                       # Polling interval

and here’s my sensor.yaml configuration in Home Assistant:

- platform: mqtt
  state_topic: "bbq/grill/probe1"
  name: "Probe 1"
  qos: 0
  unit_of_measurement: "°F"
- platform: mqtt
  state_topic: "bbq/grill/probe2"
  name: "Probe 2"
  qos: 0
  unit_of_measurement: "°F"

I originally had my device.yaml “topic” as “bbq/grill”, but then I noticed that igrill was publishing the values under “bbq/grill/grill”, so I changed my device.yaml topic to just “bbq”.

If it’s #2 (if I’m running on Python 3), then I feel stupid, but honestly I don’t know how to tell if I am or not. If I run “Python -V” in shell I get “Python 2.7.16”, however, when I open the Monitor.py file on my Pi, the Thonny editor shows Python 3.7.3 in the shell. How can I tell if the app is running in Python 2 or 3? And how can I run it in Python 2? Is it just a matter of removing Python 3? This Pi is dedicated to iGrill, so I don’t care if removing Python 3 disables any other applications.

Again, I really appreciate the help. I usually give up on projects that I have this much trouble with, but I really want the ability to monitor my smoker remotely and this is one that I’m not yet willing to give up on!

I don’t think you are running python 3. Mine blew up when I tried it. Thonny loads up its own python interpreter and I think it only supports python 3 currently. Everything you show now looks good to me, the piece we aren’t seeing is the MQTT broker itself. You said you installed out side of HA, if so you should have logs at /var/log/mosquito. Both your clients are connected to the same broker? I may have to spin up a instance of hassio to dig further. No need for all the thanks, I love messing around with this stuff. I also know how important it is to be able to monitor my smoker :smile:. I think you are getting close.

I finally got it working! I ended up reverting back to the Mosquitto broker and determined that my MQTT problems were the result of three things - 1) the wrong topic in the iGrill device.yaml , 2) having a redundant username/password as a Hass.io user, and 3) not using separate username/passwords for HA and iGrill. What wasn’t clear to me (I haven’t used the Mosquito add-on for a while) is that you can set up a username/password for the broker either directly in the Mosquito add-on or just as a user in Home Assistant. Turns out you can’t have the same username in both the add-on and as a Home Assistant user. Also, the topic part was really confusing for me. If you put “bbq/grill” in your device.yaml, the topic published to MQTT will actually be “bbq/grill/grill”, so if you just put “bbq” as the topic, then it will be published as “bbq/grill”. Thank you @stogs for all of your help. When I have some time, I plan to write up a tutorial for plebs like myself on how to get this project working.

This is long after you posted this, but I just experienced thiss too and solved it and wanted to share my solution. The problem is, you need to install all the python modules as root. So all I did was

sudo pip install -r requirements.txt

And that got the service running merrily.

1 Like

Did you ever write up that tutorial? I’m interested running hassio myself and would love to get this working.

I vote too for howto/tutorial guide!!!

Big thanks to all those blazing this trail!! I’ve been at it for several hours and I think I’m very close. Worked through many errors, and am hitting a wall despite pouring through this thread. As suggested by Scott in an earlier post, I have the igrill log file running and looks like I’m having trouble connecting with the iGrill2:
2019-11-27 01:19:05,749 grill DEBUG: Device thread grill (re)started, trying to connect to iGrill with address: D4:81:CA:20:15:28
2019-11-27 01:19:05,749 grill DEBUG: Created new device with name grill
2019-11-27 01:19:05,750 grill DEBUG: Trying to connect to the device with address D4:81:CA:20:15:28
2019-11-27 01:19:05,750 grill DEBUG: Calling btle.Peripheral.init with lock: 1993659712
2019-11-27 01:19:05,764 grill DEBUG: Failed to connect to peripheral D4:81:CA:20:15:28, addr type: public
2019-11-27 01:19:05,765 grill DEBUG: Sleeping for 20 seconds before retrying
Any insight or suggestions would be greatly appreciated!!!

I am able to get the raspberry pi to pair with the device no problem.

WOW. I cycled power on the iGrill and everything started working!!

1 Like

I would like to do this and have access to my Igrill2 temperatures probes, but I am really not exactly sure where to start. Hopefully someone can give me some guidance. I am really new to home automation. What I have implemented so far is an automated garage door switch using a ESP8266 with ESP home and a Raspberry pi 3 running HASS.IO 0.102.3. I could have this Raspberry pi in range of my iGrill2. but I am not apposed to having a seprate Pi just for my igrill probes. my confusion lies with how the pi connects up with the igrill, which is Bluetooth. I am assuming that is how it is done and then MQTT to send the temp to hass.io? I am really confused, any assistance would be much appreciated.
Thanks in advance for any help

Using the code referenced in the original post, a python script runs outside of homeassistant and establishes the connection to the igrill via bluetooth. This process uses that bluetooth connection to get the probe readings from the igrill and then uses MQTT to communicate to HA.

Thank you Scott. So I downloaded all of the code from Github and attempted to get it installed on my Pi that is running Hass.io. I am not sure what the issues are, but I was not even able to start installing one of the first required modules(bluepy). I ran the command “apk add bluepy” and it ran into errors(blow). Maybe this is just my inexperience with hass.io I dont know. So maybe I would be better off connecting to the bluetooth igrill2 from a separate Raspberry pi, with its sole purpose for the igrill temperature probes. That said, what operating sytstem on the Pi would be the easiest solution to implement my igrill. I intend to connect to the Pi using ssh so I wont need a terminal/monitor user interface. I am sorry if these questions seem so basic, but while I have redhat linux experience, I have little experience with other versions of Linux such as rasblian, etc. I plan on getting a Rasberry Pi 3 Model B. Does that come loaded with Raspian?

core-ssh:/etc# apk add bluepy
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/armv7/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/armv7/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
bluepy (missing):
required by: world[bluepy]