Weber iGrill 2 integration with Lovelace UI

Hi @stogs,

had a little more time and tried to tackle the issue again - no success.

I have changed the device.yaml file to:

devices:
  - name:       'grill'      
    type:       'igrill_v2'  
    address:    'RE:AL:MA:C' 

I changed the mqtt.yaml to:

mqtt:
  host:       '192.168.7.14'    
  port:       1883              

I also modified the monitor_igrillv2.py like this and made the file executable:

#!/usr/bin/env python3

import json
import time
import paho.mqtt.client as mqtt

from igrill import IGrillV2Peripheral

ADDRESS = 'RE:AL:MA:CD'
mqtt_server = "mqtt"

Also tried to use the IP address of my mqtt-server in the file above instead (mqtt_server = “192.168.7.14”), but the error message remains the same:

Traceback (most recent call last):
  File "./monitor_igrill_v2.py", line 7, in <module>
    from igrill import IGrillV2Peripheral
  File "/home/pi/igrill/igrill.py", line 9, in <module>
    import utils
  File "/home/pi/igrill/utils.py", line 1, in <module>
    from igrill import IGrillMiniPeripheral, IGrillV2Peripheral, IGrillV3Peripheral, DeviceThread
ImportError: cannot import name 'IGrillMiniPeripheral'

Did the same with the v3 file (monitor_igrillv3.py) - exactly the same issues.

Maybe I’m just not going through all the necessary steps, any more hints?

1 Like

I use python 2 not 3. Ran into a bunch of issues trying to run it with python 3

Do you have a project you are working with for this was just looking to do this with my Maverick

Do you mean for lovelace or getting the Maverick sensor values in homeassistant? I kind of stopped with Lovelace, as it is in development, and I do not see the added value over the current setup (yet). It takes lot of programming, but no extra functionalitie.

I do have the Maverick working and can read the sensor with home assistant! If you are interested I can share my setup for that. I use appdeamon from the community hassio add-ons and RTL_433 to MQTT Bridge add-on of @hijinx

Would love if you could share your Maverick setup

I finally got this to work with my iGrill2 and my Pi sunning on stretch as well.

During my efforts of installing this for Python3 and then remove and re-install it for Python2 I must have made a mistake. Now uns fine on Python2.

One question, though:
If I just turn of the iGrill thermometer, the values just freeze in my HomeAssistant UI - is there a way to indicate to the system that the daemon stopped delivering data so that I can, e.g. hide the group in my HA UI and just make is visible again as soon as the mqtt-messages come back in again?

Okay, got this sorted by adding

  force_update: 'true'
  expire_after: '10'

to the MQTT sensor definition.

Came across another problem, though, and wondered if anybody has seen the same thing and maybe even found a solution:

Every time I turn my iGrill2 off and then later back on I need to enter sudo systemctl restart igrill.service - otherwise it doesn’t broadcast the messages, or at least I cannot see HA see retrieving them.
This is a pain in the neck because I had to install igrill on a separate Pi due to the fact that HA requires Python3 while igrill needs Python2.
And I haven’t found a way yet to trigger the restart remotely through an ssh connection or something similar.

Anybody got any hints?

Sure its not realy clean, and partly in Dutch (I’m not a programmer) But I think you’ll get it. Also using pushbullet to send messages.

input_select:
  bbq_sensor_1:
    name: Sensor 1
    options:
    - none
    - Kern
    - BBQ
    initial: none
    icon: mdi:pin
  bbq_sensor_2:
    name: Sensor 2
    options:
    - none
    - Kern
    - BBQ
    initial: none
    icon: mdi:pin

input_number:
  sensor_min_1:
    name: min
    unit_of_measurement: "°C"
    initial: 50
    min: 0
    max: 350
    step: 1
  sensor_max_1:
    name: max
    unit_of_measurement: "°C"
    initial: 350
    min: 0
    max: 350
    step: 1
  sensor_kern_1:
    name: kern
    mode: box
    unit_of_measurement: "°C"
    initial: 50
    min: 30
    max: 100
    step: 1
  sensor_min_2:
    name: min
    unit_of_measurement: "°C"
    initial: 50
    min: 0
    max: 350
    step: 1
  sensor_max_2:
    name: max
    unit_of_measurement: "°C"
    initial: 350
    min: 0
    max: 350
    step: 1
  sensor_kern_2:
    name: kern
    mode: box
    unit_of_measurement: "°C"
    initial: 50
    min: 30
    max: 100
    step: 1

group:
  probe_1:
    name: Probe 1
    entities:
    # - sensor.sensor1
    - input_select.bbq_sensor_1
    # - input_boolean.min_alarm_sensor_1
  probe_2:
    name: Probe 2
    entities:
    # - sensor.sensor2
    - input_select.bbq_sensor_2

  probe_bbq_1:
    name: Probe 1 bbq
    entities:
    - input_number.sensor_min_1
    - input_number.sensor_max_1
    - input_boolean.min_alarm_sensor_1
  probe_bbq_2:
    name: Probe 2 bbq
    entities:
    - input_number.sensor_min_2
    - input_number.sensor_max_2
    - input_boolean.min_alarm_sensor_2
  probe_kern_1:
    name: Probe 1 bbq
    entities:
    - input_number.sensor_kern_1
  probe_kern_2:
    name: Probe 2 bbq
    entities:
    - input_number.sensor_kern_2

input_boolean:
  min_alarm_sensor_1:
    name: Min Alarm Sensor 1
    initial: off
  min_alarm_sensor_2:
    name: Min Alarm Sensor 2
    initial: off

Appdeamon in apps folder called bbq.py

import appdaemon.plugins.hass.hassapi as hass

class BBQtemp(hass.Hass):

  def initialize(self):
    self.select = "input_select.bbq_sensor_" + str(self.args["number"])
    self.sensor = "sensor.sensor_" + str(self.args["number"])
    self.number_kern = "input_number.sensor_kern_" + str(self.args["number"])
    self.number_min = "input_number.sensor_min_" + str(self.args["number"])
    self.number_max = "input_number.sensor_max_" + str(self.args["number"])
    self.min_alarm = "input_boolean.min_alarm_sensor_" + str(self.args["number"])
    self.group_kern = "group.probe_kern_" + str(self.args["number"])
    self.group_bbq = "group.probe_bbq_" + str(self.args["number"])
    self.group_probe = "group.probe_" + str(self.args["number"])
    self.listen_state(self.temp_change, self.sensor)
    self.listen_state(self.temp_type, self.select)
    self.warning = False
  def temp_change(self, entity, attribute, old, new, kwargs):
    self.log(entity)
    self.log(new)
    if new == "unknown":
      self.log(new)
      self.call_service("notify/pushbullet", message = "temperatuur sensor " + str(self.args["number"]) + " is uitgevallen")
#      self.call_service("group/set_visibility", entity_id = self.group_probe, visible = False )
      self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = False )
      self.call_service("group/set_visibility", entity_id = self.group_kern, visible = False )
    else:
      self.type = self.get_state(entity = self.select)
      if self.type == "Kern":
        if int(float(new)) >= int(float(self.get_state(entity = self.number_kern))) and self.warning == False:
          self.warning = True
          self.log("heet")
          self.call_service("notify/pushbullet", message = "kern temperatuur sensor " + str(self.args["number"]) + " bereikt")
      #    self.call_service("tts/google_say", intity_id = "media_player.google_home", message = "kern temperatuur sensor " + str(self.args["number"]) + " bereikt")
          self.run_in(self.warning_timer, 3)
      elif self.type == "BBQ":
        #self.log("type is BBQ")
        self.start = self.get_state(self.min_alarm)
        if int(float(new)) < int(float(self.get_state(entity = self.number_min))) and self.warning == False and self.start == "on": 
          self.warning = True
          self.log("bbq te koud")
          self.call_service("notify/pushbullet", message = "BBQ sensor " + str(self.args["number"]) + " te koud")
#         self.call_service("tts/google_say", intity_id = "media_player.google_home", message = "kern temperatuur sensor 1 bereikt")
          self.run_in(self.warning_timer, 3)
        elif int(float(new)) > int(float(self.get_state(entity = self.number_max))) and self.warning == False:
          self.set_state(self.min_alarm, state = "on")
          self.warning = True
          self.log("BBQ te heet")
          self.call_service("notify/pushbullet", message = "BBQ sensor " + str(self.args["number"]) + " te heet")
#          self.call_service("tts/google_say", intity_id = "media_player.google_home", message = "kern temperatuur sensor 1 bereikt")
          self.run_in(self.warning_timer, 3)
      else:
        self.log("type is None")
        self.call_service("group/set_visibility", entity_id = self.group_probe, visible = True )
  def temp_type(self, entity, attribute, old, new, kwargs):
 #   if state = "None"
 #   self.log (new)
    if new == "none":
      self.log("set to none")
      self.log(self.group_bbq)
      self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = False )
      self.call_service("group/set_visibility", entity_id = self.group_kern, visible = False )
    if new == "Kern":
      self.log("set to Kern")
      self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = False )
      self.call_service("group/set_visibility", entity_id = self.group_kern, visible = True )
    if new == "BBQ":
      self.log("set to BBQ")
      self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = True )
      self.call_service("group/set_visibility", entity_id = self.group_kern, visible = False )
  def warning_timer(self, kwargs):
    self.warning = False

apps.yaml of appdeamon:

bbq1:
  module: bbq
  class: BBQtemp
  number: 1
bbq2:
  module: bbq
  class: BBQtemp
  number: 2
1 Like

I installed Hassio on my qnap as a container. I am able to load the default page and when i activated lovelace UI with the generic ui-lovelace.yaml settings i could see the site.

I replaced the default settings and copied over yours ( this is what my file contains):

- icon: mdi:pig
    title: iGrill
    cards:
      - type: vertical-stack
        cards:
         - type: weather-forecast
           entity: weather.openweathermap
         - type: entities
           show_header_toggle: true
           title: Weber iGrill
           entities:
             - entity: sensor.probe_1
               secondary_info: last-changed
             - entity: sensor.probe_2
               secondary_info: last-changed
             - entity: sensor.probe_3
               secondary_info: last-changed
             - entity: sensor.probe_4
               secondary_info: last-changed
             - entity: sensor.igrill_battery
               secondary_info: last-changed
      - type: horizontal-stack
        cards:
         - type: custom:gauge-card
           title: Probe 1
           entity: sensor.probe_1
           min: 0
           max: 350
           severity:
             red: 190
             green: 65
             amber: 0
         - type: custom:gauge-card
           title: Probe 2
           entity: sensor.probe_2
           min: 0
           max: 350
           severity:
             red: 190
             green: 65
             amber: 0
      - type: horizontal-stack
        cards:
         - type: custom:gauge-card
           title: Probe 3
           entity: sensor.probe_3
           min: 0
           max: 350
           severity:
             red: 190
             green: 65
             amber: 0
         - type: custom:gauge-card
           title: Probe 4 (Ambient)
           entity: sensor.probe_4
           min: 0
           max: 425
           severity:
             red: 300
             green: 90
             amber: 0
- type: history-graph
        title: 'History'
        entities:
          - sensor.probe_1
          - sensor.probe_2
          - sensor.probe_3
          - sensor.probe_4
      - type: entities
        title: iGrill info
        entities:
          - input_number.grill_alert_low
          - input_number.grill_alert_high
          - sensor.grill_alert_temp
          - input_number.grill_probe_1_target
          - sensor.target_alert_temp_probe_1
          - input_number.grill_probe_2_target
          - sensor.target_alert_temp_probe_2
          - input_number.grill_probe_3_target
          - sensor.target_alert_temp_probe_3
          - automation.monitor_grill_temp_alert
          - automation.monitor_grill_temp_normal
          - automation.probe_1_target_temp
          - automation.probe_2_target_temp
          - automation.probe_3_target_temp

I also used your configuration and automation file.

I get the following error when i try to load the site:

** mapping values are not allowed here in “/config/ui-lovelace.yaml”, line 2, column 14**

now i get the message:
mapping values are not allowed here
in “/config/configuration.yaml”, line 2, column 24

you indentation is off for yaml syntax:

 - icon: mdi:pig
   title: iGrill
   cards:
     - type: vertical-stack
        cards:

icon, title, and card should align, and the - type start under the “r” in cards:

Ok ill give it a try. I looked at your copy in the thread and the way I have it shows the same in in your file snippet. Maybe the site changed the format. I am new to yaml and do not know the syntax very well. Thank you.

Another question is do I need all the default configuration text or can I clear it all out and just use what you have.

i aligned it and now all get is a popup in bottom service system log write called and it goes away and then i just have a white screen.

i was able to find this Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 2, column 24

and that is this section: - 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”
- platform: mqtt
state_topic: “bbq/grill/probe3”
name: “Probe 3”
qos: 0
unit_of_measurement: “°F”
- platform: mqtt
state_topic: “bbq/grill/probe4”
name: “Probe 4”
qos: 0
unit_of_measurement: “°F”
- platform: mqtt
state_topic: “bbq/grill/battery”
name: “igrill battery”
qos: 0
unit_of_measurement: “%”

you need to have a few other things than what I included for the lovelace-ui to work, before the stuff I posted you need to have this information

Title: The Test Home
resources:
   - url: /local/gauge-card.js?v=0.2.0
     type: js
views:
  - icon: mdi:home
    title: Main
    cards:

There is one custom card referenced in what I posted, the guage card. This explains how to use the custom cards for lovelace: https://github.com/ciotlosm/custom-lovelace and this is the reference for lovelace-ui https://www.home-assistant.io/lovelace/

ok i added that top part and this is what i get? i dont have my PI setup with igrill. and i didnt do anything with the gauge except add that syntax to my file. This is what i have:

Title: The Test Home
resources:

  • url: /local/gauge-card.js?v=0.2.0
    type: js
    views:

  • icon: mdi:home
    title: Main
    cards:

  • icon: ‘mdi:pig’
    title: iGrill
    cards:
    -
    type: “vertical-stack\ncards:\n - type: weather-forecast\n entity: weather.openweathermap\n - type: entities\n show_header_toggle: true\n title: Weber iGrill\n entities:\n - entity: sensor.probe_1\n secondary_info: last-changed\n - entity: sensor.probe_2\n secondary_info: last-changed\n - entity: sensor.probe_3\n secondary_info: last-changed\n - entity: sensor.probe_4\n secondary_info: last-changed\n - entity: sensor.igrill_battery\n secondary_info: last-changed\n - type: horizontal-stack\n cards:\n - type: custom:gauge-card\n title: Probe 1\n entity: sensor.probe_1\n min: 0\n max: 350\n severity:\n red: 190\n green: 65\n amber: 0\n - type: custom:gauge-card\n title: Probe 2\n entity: sensor.probe_2\n min: 0\n max: 350\n severity:\n red: 190\n green: 65\n amber: 0\n - type: horizontal-stack\n cards:\n - type: custom:gauge-card\n title: Probe 3\n entity: sensor.probe_3\n min: 0\n max: 350\n severity:\n red: 190\n green: 65\n amber: 0\n - type: custom:gauge-card\n title: Probe 4 (Ambient)\n entity: sensor.probe_4\n min: 0\n max: 425\n severity:\n red: 300\n green: 90\n amber: 0”
    -
    type: “history-graph\ntitle: ‘History’\nentities:\n - sensor.probe_1\n - sensor.probe_2\n - sensor.probe_3\n - sensor.probe_4”
    -
    type: “entities\ntitle: iGrill info\nentities:\n - input_number.grill_alert_low\n - input_number.grill_alert_high\n - sensor.grill_alert_temp\n - input_number.grill_probe_1_target\n - sensor.target_alert_temp_probe_1\n - input_number.grill_probe_2_target\n - sensor.target_alert_temp_probe_2\n - input_number.grill_probe_3_target\n - sensor.target_alert_temp_probe_3\n - automation.monitor_grill_temp_alert\n - automation.monitor_grill_temp_normal\n - automation.probe_1_target_temp\n - automation.probe_2_target_temp\n - automation.probe_3_target_temp”

also with the screen above if i do a check in configuration i still get the error:
Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 2, column 24

this is my file:
Preformatted text - 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”
- platform: mqtt
state_topic: “bbq/grill/probe3”
name: “Probe 3”
qos: 0
unit_of_measurement: “°F”
- platform: mqtt
state_topic: “bbq/grill/probe4”
name: “Probe 4”
qos: 0
unit_of_measurement: “°F”
- platform: mqtt
state_topic: “bbq/grill/battery”
name: “igrill battery”
qos: 0
unit_of_measurement: “%”
- platform: template
sensors:
grill_alert_temp:
value_template:
‘{% if (states.sensor.probe_4.state | int) < (states.input_number.grill_alert_low.state | int) or (states.sensor.probe_4.state | int) > (states.input_number.grill_alert_high.state | int) %}
Alert
{% else %}
Normal
{% endif %}’
friendly_name: Grill Temp Alert
- platform: template
sensors:
target_alert_temp_probe_1:
value_template:
‘{% if (states.sensor.probe_1.state | int) >= (states.input_number.grill_probe_1_target.state | int) %}
Alert
{% else %}
Normal
{% endif %}’
friendly_name: Probe 1 Target Alert
- platform: template
sensors:
target_alert_temp_probe_2:
value_template:
‘{% if (states.sensor.probe_2.state | int) >= (states.input_number.grill_probe_2_target.state | int) %}
Alert
{% else %}
Normal
{% endif %}’
friendly_name: Probe 2 Target Alert
- platform: template
sensors:
target_alert_temp_probe_3:
value_template:
‘{% if (states.sensor.probe_3.state | int) >= (states.input_number.grill_probe_3_target.state | int) %}
Alert
{% else %}
Normal
{% endif %}’
friendly_name: Probe 3 Target Alert
input_number:
grill_alert_low:
name: Grill Low Temp
initial: 150
min: 100
max: 500
step: 5
grill_alert_high:
name: Grill High Temp
initial: 340
min: 100
max: 500
step: 5
grill_probe_1_target:
name: Probe 1 Target Temp
initial: 160
min: 60
max: 250
step: 1
grill_probe_2_target:
name: Probe 2 Target Temp
initial: 160
min: 60
max: 250
step: 1
grill_probe_3_target:
name: Probe 3 Target Temp
initial: 160
min: 60
max: 250
step: 1Preformatted text

i added the guage to my folder but i dont see any difference. I have the tag you sent me in my UI file.

Hi.

I see that some of you have had some trouble getting the threaded version of my iGrill application to work. (monitor.py)
The branch (enable_threading) was primarily my personal working branch, so depending on when you cloned the code, you might have an interesting set of bugs. :wink:
I have had some time to code now, and have finished the branch and merged branch to master, so if anybody want to give it another try, I believe you have a much better chance of success now. :slight_smile:
I have also added a config checker, so that you, hopefully, will get more meaningful error messages if something is wrong.

I will delete the enable_threading branch soon, and I have deleted monitor_igrill_v[2,3].py on master, but i have created a tag (0.9) for those of you who don’t want to let it go.

FYI: Python 3 support is not implemented, as many of you have noticed, but it is the next thing on my list (but dont hold your breath, it can take a while before it’s done).

In the meantime, please file an issue and/or a pull-request if there is something that is not working.

-Bendik

5 Likes

Thanks for all your work!!!

hi

I’m having trouble getting the auto run to work there are some here an idea of ​​what I’m doing wrong when I’m very new with this

pi@iGrill : ~/igrill-master $ systemctl status igrill.service
● igrill.service - igrill MQTT service
Loaded: loaded (/lib/systemd/system/igrill.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2018-11-25 21:49:36 GMT; 1s ago
Process: 1387 ExecStart=/usr/bin/python ~/igrill-master/monitor.py -c ~/igrill-master (code=exited, status=2)
Main PID: 1387 (code=exited, status=2)
Nov 25 21:49:36 iGrill systemd[1]: igrill.service: Failed with result ‘exit-code’.

pi@iGrill : ~/igrill-master $ systemctl status igrill.service
igrill.service - igrill MQTT service
Loaded: loaded (/lib/systemd/system/igrill.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2018-11-25 21:49:39 GMT; 54ms ago
Main PID: 1395 (python)
CGroup: /system.slice/igrill.service
└─1395 /usr/bin/python ~/igrill-master/monitor.py -c ~/igrill-master
Nov 25 21:49:39 iGrill systemd[1]: Started igrill MQTT service.

I did have issues getting it to start on boot. My error looked different. I was getting a failure when trying to connect to the MQTT broker due to the network not being established yet. I added a sleep in the utils.py right before it tries to connect to MQTT and that solved my problem.