jwhitby91 / gmg_home_assistant

Green Mountain Grill home assistant
22 stars 3 forks source link

Needs details how to open UDP port 8080 #4

Open astranberg opened 2 years ago

astranberg commented 2 years ago

Instructions say:

UDP port 8080 open between home assistant & GMG

How does one do that? In my router I port forwarded 8080 to 8080 on UDP with the service HTTP.

But autodiscovery isn't working.

KyleLeMarbe commented 1 year ago

@astranberg , if you are on an internal network with the grill on it, you should not need to do anything to open up the ports. Just make sure that if you have a firewall on your home assistant device, it is allowing that port through.

I am running HomeAssistant in a container and autodiscovery is not working for me as well. It appears that I have installed everything correctly and updated the configuration.yml but nothing shows up. I do see where the integration is supposed to send the broadcast UDP data. I'm going to try and do a packet trace on this when I can to see where it is getting hung up.

astranberg commented 1 year ago

That would be great. If you have a potential fix I'm happy to test.

Thanks, Adam


From: Kyle LeMarbe @.> Sent: Tuesday, January 24, 2023 3:36:45 PM To: jwhitby91/gmg_home_assistant @.> Cc: astranberg @.>; Mention @.> Subject: Re: [jwhitby91/gmg_home_assistant] Needs details how to open UDP port 8080 (Issue #4)

@astranberghttps://github.com/astranberg , if you are on an internal network with the grill on it, you should not need to do anything to open up the ports. Just make sure that if you have a firewall on your home assistant device, it is allowing that port through.

I am running HomeAssistant in a container and autodiscovery is not working for me as well. It appears that I have installed everything correctly and updated the configuration.yml but nothing shows up. I do see where the integration is supposed to send the broadcast UDP data. I'm going to try and do a packet trace on this when I can to see where it is getting hung up.

— Reply to this email directly, view it on GitHubhttps://github.com/jwhitby91/gmg_home_assistant/issues/4#issuecomment-1402719319, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELYYJ64AYOEE32O44T2RMLWUBDO3ANCNFSM5Y5GRU5A. You are receiving this because you were mentioned.Message ID: @.***>

KyleLeMarbe commented 1 year ago

I have a pull request out to hopefully fix this issue. In my testing there were a couple of issues: 1: the port 8080 was being used to open up the udp socket which might not be available on the server. This port does not matter on the server side, only on the grill itself. 2: not all local ip addresses were bing bound and searched. Depending on your local ip configuration this would not find the grill. it will now search all ip adapters found on the system.

KyleLeMarbe commented 1 year ago

Also, I have a fork on my gitHub that will fix it. Not sure how much the OP keeps up with this integration.

jwhitby91 commented 1 year ago

Hey guys,

Apologies for being missing a bit I've had a lot going on

Sorry @KyleLeMarbe I did not get a notification about the pull request so I just merged it now. Thanks so much for contributing

One main reason I have not been working on this a lot is I contacted GMG about if they will open up their API which they advised they won't. In the newer firmware for GMG it looks like they remove the wifi open so you only get bluetooth or server options so if they do not open the API if only other option would be bluetooth. If they force everyone to new firmware eventually this will not work but lets hope that is awhile away at least

mckaycr commented 1 year ago

Our grills have bluetooth?

Kyle-LeMarbe commented 1 year ago

I'm not sure about Bluetooth but will look up the specs on the controller to see if it supports it. I do see the 1.2 firmware out there for choice grills, but the new app is not in the iOS App Store from what I can tell.

I'm still on firmware v7. Udp on WiFi works great on that revision. If they do take udp support away, I may just not update the firmware. We'll see.

Found this good write up on the grill controller: https://www.secplicity.org/2019/05/31/green-mountain-grill-security-analysis/amp/.

Also, have some other updates coming for this code base like manual config of grills in the config file and better grill not responding messaging when you're grill is turned off.

jwhitby91 commented 1 year ago

Sorry for length of this reply

I am in same boat as you Kyle - I was thinking about just not ever updating firmware but wasn't sure if there will be a point they stop supporting the old app. Probably years away at a guess but never know.

Their support was hard to get a reply from even about the API support. I asked if they would support it in the future but they stopped replying so sort of took wind out of my sail a bit if they have no interest/won't even reply. Sadly looks like the security researches had same experience from that post.

If you guys all have interest in still using it on wifi I'm happy to pick this back up & help out. If you're happy to help Kyle that would be awesome too & really appreciated

Here is a link to both iOS & Android apps for the new firmware. The app is actually better I think but it does require firmware update then where it becomes annoying is if you pick server mode first time you cannot swap to local mode. You have to downgrade firmware back to old app then re-do it to pick local mode.

I have used it on Android but not iOS though I have both so I will give iOS a go later today and report back.

Below is the part where it mentions using bluetooth.. When you update to new firmware it asks you to turn on bluetooth and when I had it local mode I could no longer see it on the network but I'll try to look again

"This app utilizes WiFi and Bluetooth technology and has a range of up to 40 meters in Local Mode. You also have the ability to connect your grill to our online servers in server mode."

https://play.google.com/store/apps/details?id=com.greenmountaingrills.prime&hl=en&gl=US&pli=1

https://apps.apple.com/us/app/gmg-prime-app/id1525047680

mckaycr commented 1 year ago

Well, I'm still all in. I just unknowingly updated my grill this week, but I haven't done any switching to server mode so I will have to keep an eye on that. I also haven't downloaded any new android app. I am curious though to know if it might be possible to create a middleman server that the grill connects to, before forwarding on traffic to GMG? I think that type of thing is above my pay grade but I have seen it done with my Carrier Thermostat.

I started working on my own python gmg package. GreenMountainGrill before I saw this repo, with the intent to import it and use it as a custom integration. Your repo has definitely helped provide some understanding on the HA integration part which I have struggled to understand for years.

So again, I'm all in. I'll definitely be keeping an eye on your updates. But I really like the idea of the gmg part being its own package and not sort of hard coded into the HA integration, if that makes sense. Its a weird OCD thing I have I think.

jwhitby91 commented 1 year ago

Once you update to the latest firmware on old app you can download the new app then do another firmware update to use the new app from memory. It's a bit of a process so as long as you don't update it from the new app you should be all good.

I think they've updated the way it connects to be more secure but I'll look into doing a packet capture in next couple of weeks to see can work something out. I was really hoping they would just allow access to API to avoid all of it. The other concern is they can change how it works down the track and break it

Glad the repo helped! HA integration is still very new to me too and takes a lot of figuring out.

KyleLeMarbe commented 1 year ago

@astranberg , are you able to download the latest code and see if the auto discovery works for you?

KyleLeMarbe commented 1 year ago

I move to close this ticket.

Aesop7 commented 1 year ago

Hopefully it's not too late to tag onto this since I'm having some difficulty getting the extension to work as well. I'm fairly certain that I have port 8080 open for HASS, but on the flip-side when I try nmap -p 8080 <GMG_IP_ADDRESS> it comes back closed. Is there a better way to test the GMG host port?

Here's what I get from the logs with the following in configuration.yaml

logger:
  default: info
  logs:
    climate.gmg: debug
    homeassistant.components.climate: debug 

cat home-assistant.log | grep gmg returns:

2023-08-21 15:34:20.436 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration gmg which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-21 15:34:28.576 INFO (MainThread) [homeassistant.setup] Setting up gmg
2023-08-21 15:34:28.577 INFO (MainThread) [homeassistant.setup] Setup of domain gmg took 0.0 seconds
2023-08-21 15:34:34.626 INFO (MainThread) [homeassistant.components.climate] Setting up climate.gmgb
KyleLeMarbe commented 1 year ago

In my fork, I was able to make the discovery logic much more robust. It will look at all available interfaces to form a connection.

Also, make sure your grill is on and in WiFi mode before restarting home assistant.

Aesop7 commented 1 year ago

@KyleLeMarbe I tried using your fork, and actually those logs are the ones from that fork ( and I don’t see anything in HASS). I can connect to GMG without issues using the app (via wifi)

KyleLeMarbe commented 1 year ago

@Aesop7 , Try changing your logger default to debug.

logger: default: debug

Let us know what the output is.

Aesop7 commented 1 year ago

@Kyle-LeMarbe Here's what i'm getting:

# cat home-assistant.log | grep gmg | egrep -v 'p3fXjrVrT9SuruPVkuGlgmgi|websocket_api.http.connection'
egrep: warning: egrep is obsolescent; using grep -E
2023-08-25 06:54:25.231 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration gmg which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-08-25 06:54:35.649 INFO (MainThread) [homeassistant.setup] Setting up gmg
2023-08-25 06:54:35.650 INFO (MainThread) [homeassistant.setup] Setup of domain gmg took 0.0 seconds
2023-08-25 06:54:36.076 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=gmg>
2023-08-25 06:54:41.929 DEBUG (MainThread) [homeassistant.helpers.translation] Cache miss for en: conversation, history, climate, blueprint, hardware, nodered, gmg, bluetooth, stt, homeassistant_alerts, moon, cloud, trace, light, ssdp
2023-08-25 06:54:42.164 DEBUG (SyncWorker_4) [homeassistant.util.json] JSON file not found: /config/custom_components/gmg/translations/en.json
2023-08-25 06:54:53.088 INFO (MainThread) [homeassistant.components.climate] Setting up climate.gmg
2023-08-25 06:54:53.090 DEBUG (MainThread) [custom_components.gmg.climate] Looking for grills
2023-08-25 06:54:53.090 DEBUG (MainThread) [custom_components.gmg.climate] hostIP from config file: None
2023-08-25 06:54:53.090 DEBUG (MainThread) [custom_components.gmg.climate] No grills configured in yml, autodiscovering grills.
2023-08-25 06:54:53.090 DEBUG (MainThread) [custom_components.gmg.gmg] Opening up udp sockets and broadcasting for grills.
2023-08-25 06:54:53.090 DEBUG (MainThread) [custom_components.gmg.gmg] Creating socket for IP: 10.42.8.7
2023-08-25 06:54:53.093 DEBUG (MainThread) [custom_components.gmg.gmg] Broadcast sent.
2023-08-25 06:54:55.095 DEBUG (MainThread) [custom_components.gmg.gmg] Socket timed out.
2023-08-25 06:54:55.095 DEBUG (MainThread) [custom_components.gmg.gmg] Creating socket for IP: 10.42.8.7
2023-08-25 06:54:55.096 DEBUG (MainThread) [custom_components.gmg.gmg] Broadcast sent.
2023-08-25 06:54:57.098 DEBUG (MainThread) [custom_components.gmg.gmg] Socket timed out.
2023-08-25 06:54:57.098 DEBUG (MainThread) [custom_components.gmg.gmg] Creating socket for IP: 0.0.0.0
2023-08-25 06:54:57.099 DEBUG (MainThread) [custom_components.gmg.gmg] Broadcast sent.
2023-08-25 06:54:59.099 DEBUG (MainThread) [custom_components.gmg.gmg] Socket timed out.
2023-08-25 06:54:59.100 DEBUG (MainThread) [custom_components.gmg.gmg] Found 0 grills.
2023-08-25 06:55:01.936 DEBUG (MainThread) [homeassistant.helpers.translation] Cache miss for en: media_player.plex, alarm_control_panel.mqtt, climate.gmg, button.plex, cover.group, number.ecobee, binary_sensor.ecobee, light.group, button.google_assistant, binary_sensor.template, cover.template, weather.ecobee, climate.ecobee, alarm_control_panel.manual, humidifier.ecobee
2023-08-25 06:55:01.938 DEBUG (SyncWorker_7) [homeassistant.util.json] JSON file not found: /config/custom_components/gmg/translations/climate.en.json
2023-08-25 06:56:16.852 DEBUG (MainThread) [homeassistant.bootstrap] Integration setup times: {'persistent_notification': 0.000717, 'websocket_api': 0.001041, 'file_upload': 0.001115, 'onboarding': 0.002755, 'sensor': 0.003783, 'dhcp': 0.007452, 'analytics': 0.008609, 'lovelace': 0.009454, 'frontend': 0.010705, 'image_upload': 0.011653, 'assist_pipeline': 0.013478, 'network': 0.013491, 'backup': 0.017462, 'system_log': 0.019688, <Platform.BINARY_SENSOR: 'binary_sensor'>: 0.02087, 'zeroconf': 0.024108, 'manual': 0.029877, 'bluetooth_adapters': 0.030782, <Platform.SWITCH: 'switch'>: 0.034815, 'webhook': 0.044212, 'thread': 0.050625, <Platform.IMAGE: 'image'>: 0.062156, 'climate': 0.062649, <Platform.CAMERA: 'camera'>: 0.071992, 'http': 0.074691, 'usb': 0.080476, <Platform.VACUUM: 'vacuum'>: 0.088113, <Platform.UPDATE: 'update'>: 0.093103, <Platform.SIREN: 'siren'>: 0.097585, <Platform.WATER_HEATER: 'water_heater'>: 0.099314, 'auth': 0.101951, <Platform.TEXT: 'text'>: 0.103496, <Platform.SELECT: 'select'>: 0.10353, <Platform.EVENT: 'event'>: 0.10562, 'api': 0.10675, <Platform.BUTTON: 'button'>: 0.107097, <Platform.FAN: 'fan'>: 0.116146, <Platform.LOCK: 'lock'>: 0.121378, 'ssdp': 0.13623, 'twilio_sms': 0.158141, 'logger': 0.159889, 'stt': 0.168392, 'homeassistant': 0.174099, <Platform.NUMBER: 'number'>: 0.189641, <Platform.HUMIDIFIER: 'humidifier'>: 0.206998, <Platform.WEATHER: 'weather'>: 0.21233, 'automation': 0.218772, <Platform.MEDIA_PLAYER: 'media_player'>: 0.248822, 'proximity': 0.256759, 'my': 0.264747, 'cloud': 0.310477, 'repairs': 0.318605, 'cover': 0.334693, 'device_automation': 0.346301, 'twilio': 0.371653, 'diagnostics': 0.377779, 'homeassistant_alerts': 0.394904, 'config': 0.410579, 'default_config': 0.421348, 'alarm_control_panel': 0.432513, 'notify': 0.441764, 'tank_utility': 0.451389, 'template': 0.49099, 'blueprint': 0.502587, 'history': 0.505308, 'stream': 0.608068, 'trace': 0.650594, 'conversation': 0.662089, 'light': 0.671641, 'tts': 0.684791, 'hardware': 0.797617, 'recorder': 1.438636, 'bluetooth': 2.252389, 'search': 2.563012, 'cast': 2.583074, <Platform.CALENDAR: 'calendar'>: 2.709919, 'person': 2.770532, 'script': 3.683327, 'map': 3.869329, 'panel_iframe': 3.924705, 'media_source': 4.220253, 'logbook': 4.225986, 'system_health': 4.257842, 'energy': 4.427015, 'nodered': 4.592599, 'mail_and_packages': 4.857705, 'timer': 4.893101, 'counter': 4.92194, 'tag': 4.929454, 'mobile_app': 4.958846, 'homekit_controller': 5.03046, 'hue': 5.295468, 'shopping_list': 5.562679, 'application_credentials': 5.946448, 'device_tracker': 6.063374, 'input_text': 6.210304, 'input_button': 6.21499, 'gmg': 6.473795, 'group': 6.544197, 'zone': 7.468485, 'pirateweather': 7.487381, 'input_boolean': 7.547167, 'schedule': 7.555022, 'input_select': 7.602254, 'input_datetime': 7.610696, 'input_number': 7.796524, 'rest': 9.425345, 'tplink': 9.710007, 'lutron_caseta': 10.979862, 'met': 12.033478, 'bond': 12.944472, 'scene': 13.958327, 'unifiprotect': 19.761094, 'local_calendar': 20.640079, 'google_assistant': 24.993991, 'oncue': 80.187399, 'roomba': 80.269962, 'mqtt': 80.989261, 'shelly': 81.754626, 'zha': 83.667699, 'plex': 87.436644, 'hacs': 87.818048, 'ecobee': 89.307077, 'moon': 93.439628, 'sense': 93.564801, 'sun': 94.117467}
2023-08-25 06:56:23.455 DEBUG (MainThread) [custom_components.hacs] <Integration KyleLeMarbe/gmg_home_assistant> Getting repository information
2023-08-25 06:56:23.801 DEBUG (MainThread) [custom_components.hacs] <Integration KyleLeMarbe/gmg_home_assistant> Running checks against v1.0.5
2023-08-25 06:56:31.906 DEBUG (Recorder) [homeassistant.components.recorder.core] Processing task: EventTask(event=<Event component_loaded[L]: component=gmg>)
grep: (standard input): binary file matches
KyleLeMarbe commented 1 year ago

@Aesop7 , thanks for the logs. Can you confirm that 10.42.8.7 is a local network IP address? What is the IP address of your grill?

It appears that it is opening the socket correctly and sending the broadcast, but not receiving a response back. Also, knowing how you are running HomeAssistant will help the diagnosis. If you are running this in a container and it is not configured to run on the host network, it will not find anything on your local network (for example).

Aesop7 commented 12 months ago

@Kyle-LeMarbe I'm currently remotely watching a 5lb Boston Butt from Home Assistant after I pre-heated the smoker from inside the house as well... I just want to thank you and everyone who has worked on this community extension - truly one of the coolest integrations/automations there is.

PS... yeah, it was the IPs 😬.

KyleLeMarbe commented 12 months ago

Love this man! So glad it's working for you!