GithubHelp home page GithubHelp logo

bendikwa / igrill Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bjoernhoefer/igrill

76.0 76.0 38.0 77 KB

Hacking the iGrill (mini, V2, V3 & Pulse 2000)

License: MIT License

Python 98.61% Dockerfile 1.39%

igrill's People

Contributors

bendikwa avatar bjoernhoefer avatar chairstacker avatar kneip68 avatar kvantetore avatar onlywade avatar paulantondeen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

igrill's Issues

reconnect when disconnected

Hi. Great to see a fork of this great work surviving. Although, if I'm honest, I wish the basic igrill functionality and your mqtt implementation on top of it were separated into separate repos, but it is what it is. I just honestly don't need the mqtt functionality. But I digress.

Do you not find that you can get disconnected from your iGrill periodically? I ended up doing this to deal with it:

class myIgrill(IGrillV2Peripheral):
    def __init__(self, *args, **kwargs):
        self.address = args[0]
        super(myIgrill, self).__init__(*args, **kwargs)
    
    def read_temperature(self, *args, **kwargs):
        try:
            return super(myIgrill, self).read_temperature(*args, **kwargs)
        except bluepy.btle.BTLEDisconnectError:
            while True:
                try:
                    print("Disconnected from iGrill, trying to reconnect...")
                    device = self.__init__(self.address)
                    return super(myIgrill, self).read_temperature(*args, **kwargs)
                except bluepy.btle.BTLEDisconnectError:
                    print("Failed to reconnect -- trying again...")
                    continue

As you can see, I've modified read_temperature to reconnect if trying to read the temps fails with a BTLEDisconnectError. Do you think this is is something the iGrill() class itself could benefit from?

mqtt when using auth, username and password

I ran into some problems with mqtt when using 'auth', 'username' and 'password' (Socket error on client 316c3c60-05fd-4b71-beb5-4c7d286fcdc6, disconnecting). When changing to anonymous and username and password are not necessary, it works. I use hass.io on my other pi and installed the add-on mosquitto broker. I'm already using mosquitto in combination with username and password with for example the shelly 1 switches with no problems at all.

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

NooB doing something dumb I'm sure

Love the concept of this as we have no end of grief trying to get the iGrill to work on our IOS devices.

Having a bit of trouble getting it working though as I'm a bit of a noob when it comes to Linux. I have a config folder under /home/igrill and this path is defined in the igrill.service file. I'm running this on a Pi Zero W with Debian Stretch on it. Using it for Bluetooth scanning already for the Xiaomi plant gateway (maybe there is a conflict with that service?)

When I try running the code in the readme, I get this:

pi@raspberrypi-ble:/home/igrill $ ./monitor.py -c /home/igrill/config                                          Traceback (most recent call last):
  File "./monitor.py", line 8, in <module>
    from config import Config
  File "/home/igrill/config.py", line 1, in <module>
    from builtins import object
ImportError: No module named builtins

What does that mean? FYI: Successfully installed future-0.18.2

Propane Sensor?

My igrill3 has a propane level sensor. Any chance of adding that to the project? I should add I would be happy to buy you coffee!

Failed to connect to peripheral

I checked the MAC of iGrill, is ok
the type is ok
all components are installed
but I receive error Failed to connect to peripheral.
The igrill work without problems with my android phone.
Can you help me?

`2020-05-08 03:31:56,072 MainThread DEBUG: Validating dict {'topic': 'grill/', 'interval': 20, 'type': 'igrill_v2', 'name': 'grill', 'address': 'D4:81:CA:23:3D:25'} with specs: {'list_type': <type 'dict'>, 'optional_entries': {'publish_missing_probes': <type 'bool'>, 'missing_probe_value': <type 'str'>}, 'required_entries': {'topic': <type 'str'>, 'interval': <type 'int'>, 'type': <type 'str'>, 'name': <type 'str'>, 'address': <type 'str'>}}

2020-05-08 03:31:56,075 grill DEBUG: Device thread grill (re)started, trying to connect to iGrill with address: D4:81:CA:23:3D:25

2020-05-08 03:31:56,075 grill DEBUG: Created new device with name grill

2020-05-08 03:31:56,076 grill DEBUG: Trying to connect to the device with address D4:81:CA:23:3D:25

2020-05-08 03:31:56,076 grill DEBUG: Calling btle.Peripheral.init with lock: 3067462912

2020-05-08 03:31:56,086 grill DEBUG: Failed to connect to peripheral D4:81:CA:23:3D:25, addr type: public

2020-05-08 03:31:56,087 grill DEBUG: Sleeping for 20 seconds before retrying

2020-05-08 03:32:16,107 grill DEBUG: Device thread grill (re)started, trying to connect to iGrill with address: D4:81:CA:23:3D:25
2020-05-08 03:32:16,107 grill DEBUG: Created new device with name grill
2020-05-08 03:32:16,108 grill DEBUG: Trying to connect to the device with address D4:81:CA:23:3D:25
2020-05-08 03:32:16,108 grill DEBUG: Calling btle.Peripheral.init with lock: 3067462912
2020-05-08 03:32:16,119 grill DEBUG: Failed to connect to peripheral D4:81:CA:23:3D:25, addr type: public
2020-05-08 03:32:16,119 grill DEBUG: Sleeping for 20 seconds before retrying`

Stuck on 'Authenticating'

My v2 device gets stuck in the 'authenticating' prompt.

Works fine with my phone. Have checked the device address, new install, etc.

Any thoughts?

Firmware says 1.4 on device.

Pulse 2000 compatible

Awesome work, thank!
I have a Weber Pulse 2000 electric grill which has the temp probes built in. What data do I need to capture from my grill to integrate it in this code and make it work?

Negative Temperatures

in igrill.py the 2 byte temperature value becomes T + 65536 when temperature is negative.
this fixed it for my iGrill v2:
for probe_num, temp_char in list(self.temp_chars.items()):
temp = bytearray(temp_char.read())[1] * 256
temp += bytearray(temp_char.read())[0]
#temps[probe_num] = float(temp) if float(temp) != 63536.0 else empty
temps[probe_num] = float(temp) if float(temp) < 32768.0 else float(temp) - 65536.0

cheers
Recherchen
and of course many thanks for this nice implementation!!

external mqtt server not working

Hi,

I want to use an external mqtt server. But the config did not accept it. It is always using localhost instead of the external mqtt broker.

I edit the utils.py file and changes the line of code from "localhost" to "ip-adress-external-mqtt-server". Now it is working.

config_defaults = { 'mqtt': { 'host': '**ip-adress-external-mqtt-server**' } }

Regards,
Bert

No Pub to Topic

Hi There,

Sorry if this is the wrong forum to ask, but I am struggling to get the device to publish to the topic:

I am using the mqtt-cli to check the topic "sub -t test/grill/probe1 -s" and I cannot see any topics being published. I did a test publish to the topic using a seperate py file and it worked.

Any ideas?

pi@raspberrypi:~/igrill/igrill $ ./monitor.py -c config -l debug
2021-05-06 12:25:36,873 MainThread INFO: log_level set to: debug
2021-05-06 12:25:36,874 MainThread DEBUG: initialized with source=config, defaultdata={'mqtt': {'host': 'localhost'}}
2021-05-06 12:25:36,876 MainThread DEBUG: Reading config/device.yaml, config/mqtt.yaml

2021-05-06 12:25:36,891 MainThread DEBUG: YAML LOAD: {'devices': [{'topic': 'test', 'interval': 60, 'type': 'igrill_v2', 'name': 'grill', 'address': '70:91:8F:19:58:95'}]}
2021-05-06 12:25:36,909 MainThread DEBUG: YAML LOAD: {'mqtt': {'tls': None, 'host': '636406ef0b4c4f9ab1c400b9f6d71ddd.s1.eu.hivemq.cloud', 'port': 8883, 'auth': {'username': 'igrill', 'password': 'redacted'}, 'keepalive': 10}}
2021-05-06 12:25:36,910 MainThread DEBUG: Validating dict {'mqtt': {'tls': None, 'host': '636406ef0b4c4f9ab1c400b9f6d71ddd.s1.eu.hivemq.cloud', 'port': 8883, 'auth': {'username': 'igrill', 'password': 'redacted'}, 'keepalive': 10}, 'devices': [{'topic': 'test', 'interval': 60, 'type': 'igrill_v2', 'name': 'grill', 'address': '70:91:8F:19:58:95'}]} with specs: {'required_entries': {'mqtt': <type 'dict'>, 'devices': <type 'list'>}}
2021-05-06 12:25:36,911 MainThread DEBUG: Validating dict {'host': '636406ef0b4c4f9ab1c400b9f6d71ddd.s1.eu.hivemq.cloud', 'port': 8883, 'auth': {'username': 'igrill', 'password': 'redacted'}, 'keepalive': 10} with specs: {'optional_entries': {'tls': <type 'dict'>, 'port': <type 'int'>, 'auth': <type 'dict'>, 'keepalive': <type 'int'>}, 'required_entries': {'host': <type 'str'>}}
2021-05-06 12:25:36,911 MainThread DEBUG: Validating dict {'username': 'igrill', 'password': 'redacted'} with specs: {'optional_entries': {'password': <type 'str'>}, 'required_entries': {'username': <type 'str'>}}
2021-05-06 12:25:36,912 MainThread DEBUG: Validating list [{'topic': 'test', 'interval': 60, 'type': 'igrill_v2', 'name': 'grill', 'address': '70:91:8F:19:58:95'}] with specs: {'specs': {'list_type': <type 'dict'>, 'optional_entries': {'publish_missing_probes': <type 'bool'>, 'missing_probe_value': <type 'str'>}, 'required_entries': {'topic': <type 'str'>, 'interval': <type 'int'>, 'type': <type 'str'>, 'name': <type 'str'>, 'address': <type 'str'>}}}
2021-05-06 12:25:36,912 MainThread DEBUG: Validating dict {'topic': 'test', 'interval': 60, 'type': 'igrill_v2', 'name': 'grill', 'address': '70:91:8F:19:58:95'} with specs: {'list_type': <type 'dict'>, 'optional_entries': {'publish_missing_probes': <type 'bool'>, 'missing_probe_value': <type 'str'>}, 'required_entries': {'topic': <type 'str'>, 'interval': <type 'int'>, 'type': <type 'str'>, 'name': <type 'str'>, 'address': <type 'str'>}}
2021-05-06 12:25:38,212 grill DEBUG: Device thread grill (re)started, trying to connect to iGrill with address: 70:91:8F:19:58:95
2021-05-06 12:25:38,213 grill DEBUG: Created new device with name grill
2021-05-06 12:25:38,214 grill DEBUG: Trying to connect to the device with address 70:91:8F:19:58:95
2021-05-06 12:25:38,215 grill DEBUG: Calling btle.Peripheral.__init__ with lock: 1993508096
2021-05-06 12:25:44,863 grill DEBUG: Releasing lock: 1993508096

Multiple iGrill device connections not working correctly

It seems that communication to the MQTT server is not working correctly when using more than one iGrill device. In my setup I am using two iGrill Mini with iobroker MQTT adapter but after the initial successful publishing of both sensor's data only the data of one them (mostly the one switched on as latest) is being sent to the MQTT server.

I have checked the code and I think I found a solution (or workaround) by moving the MQTT client.reconnect() call into the while loop as follows:

`

def run(self):
    while self.run_event.is_set():
        try:
            logging.debug("Device thread {} (re)started, trying to connect to iGrill with address: {}".format(self.name, self.address))
            device = self.device_types[self.type](self.address, self.name)
            while True:
                self.mqtt_client.reconnect()
                temperature = device.read_temperature(self.publish_missing_probes, self.missing_probe_value)
                battery = device.read_battery()
                heating_element = device.read_heating_elements()
                utils.publish(temperature, battery, heating_element, self.mqtt_client, self.topic, device.name)
                logging.debug("Published temp: {} and battery: {} to topic {}/{}".format(temperature, battery, self.topic, device.name))
                logging.debug("Sleeping for {} seconds".format(self.interval))
                time.sleep(self.interval)
        except Exception as e:
            logging.debug(e)
            logging.debug("Sleeping for {} seconds before retrying".format(self.interval))
            time.sleep(self.interval)

    logging.debug('Thread exiting')

`

Remove pycrypto and iGrill Keys From the Code

I put together a short blog post here https://blog.kins.dev/2019/04/igrill-device-support-for-igrill-smoker.html

Basically, the way handshaking is done, if you present a challenge of all zeros, you can simplify the authentication to:

  • Present the challenge
  • Read the response
  • Present the response

You can find tested code in my own project https://git.kins.dev/igrill-smoker

The reason you may want to do this is, pycrypto has a couple of security issues:

Stuck at Authenticating

I have had no luck with the MQTT - the client side stops to this message:

2019-09-23 23:02:52,981 grill DEBUG: Releasing lock: 1993086208
2019-09-23 23:02:54,974 grill DEBUG: Authenticating...
2019-09-23 23:02:54,975 grill DEBUG: Sending key of all 0's

Nothing happen's and the MQTT server (hass.io) doesn't get a response to CONNACK:

1569268971: New connection from 192.168.1.107 on port 1883.
1569268971: New client connected from 192.168.1.107 as auto-9ED13433-F888-E56D-845A-44639CD16EF7 (p2, c1, k10000, u'XXXXXX').
1569268971: No will message specified.
1569268971: Sending CONNACK to auto-9ED13433-F888-E56D-845A-44639CD16EF7 (0, 0)

I tried with a different MQTT-server but it didn't work either. I've tried anonymous authentication as well.

Any suggestions?

(Not) connected-Message

How about a "Connected" / "Disconnected"-MQTT-Message?

My iGrill sometimes disconnects from my Pi, it would be great to get some Info, if that happens.

Lighted knobs support?

My iGrill_V3 has a propane level sensor and lighted knobs control.

The lighted knobs can be controlled by the iGrill app (on/off). Any chance of adding lighted knobs control support to the project?
(I see the propane sensor enhancement is being addressed in #12)

Thanks for creating this great addition for the geeky iGrillers :-)

Docker image stopped working on Raspberry PI OS after full-upgrade

Having updated docker last week, the container created about 1/2 year ago suddenly stopped working. The error message given was
Error response from daemon: OCI runtime create failed: invalid mount {Destination:config Type:bind Source:/var/lib/docker/volumes/158dffded131a6cc3b65b19688ccd473e6c1435a0171928db808787dc7ea4e2a/_data Options:[rbind]}: mount destination config not absolute: unknown.
I tried to rebuild the image first of all, which failed. I am running an updated Raspberry Pi OS 32bit on a RPi4, so was at first expecting this to be a side effect of the incompatibility of Alpine 3.13 with Raspberry Pi OS.

So first thing I did was to update Dockerfile changing the FROM line to FROM python:3-alpine3.12 which enabled me to rebuild, but the original error persisted when starting the container as per README.

So next I changed was the VOLUME line in Dockerfile to
VOLUME /usr/src/igrill/config
and the CMD line to
CMD [ "python", "./monitor.py", "-c", "/usr/src/igrill/config" ]
now the container started and is working as expected (as it always has been).

Changes are available in fork kneip68/igrill and the completed image is at jheipmann/igrill in DockerHub.

Let me know whether I should send a pull request.

KR

Kneip

Not reconnecting

Is it just here, that my iGrillV2 is not reconnecting after a PowerOff?

Besides that, it works great.
Any chance for the future, that we can set a Temperature-Alert?

iGrill won't connect

I had everything working fine, and now my iGrill v2 is in an endless loop of connecting/disconnecting. I've followed the troubleshooting steps and that didn't resolve it.

pi@raspberrypi:~ $ bluetoothctl
Agent registered
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[CHG] Device 70:91:8F:11:FF:F5 Connected: yes
[CHG] Device 70:91:8F:11:FF:F5 Connected: no
[bluetooth]#

Questions

  1. Is it possible to send commands to the iGrill device like the original app does?
  2. Does the iGrill device has some logic for turning on the alarm or the app sends the alarm command?
  3. Is there a way to sniff the Bluetooth packets?

I want to build an app for controlling the iGrill through WiFi.

Thanks

Dockerfile to Support Ease of Installation for Raspberry Pi

First, thank you SO much for providing this fork and the troubleshooting information! I got my implementation working like I want, and in that process created a dockerfile and a docker-compose file that might help standardize the install for novice users (like myself). I believe I have the docker-compose configured correctly such that if the monitor script ever exits with an error, the container will be restarted to try again.

I had a specific use case I wrote up the documentation for here, https://github.com/WilliamAlexanderMorrison/igrill-hassio. To be totally frank, I don't have the know-how to do any sort of testing outside of my use-case on the raspberry pi, but the docker container should make things standardized across devices.

Do you have interest in me submitting a PR to add a docker directory with the docker files and some documentation to the readme?

Thanks again,

-Will

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.