Minecraft Server Sensor

I see everywhere that “query=true” should be set. But according to https://minecraft.gamepedia.com/Server.properties#Java_Edition_3, should it be “enable-query=true”?

Hi - did you get anywhere with this? The HA interface doesn’t load in 0.105, and if I try the suggested https://github.com/olenoerby/MinecraftServer-HA it doesn’t even load, complains about the config/port not responding. Did you figure out the query config - I think that would have just been a typo?
This - https://github.com/sondregronas/MinecraftServer-HA - worked great previously, though seemed to crash the UI after a few hours too, not sure if it was when the server was unavailable as I have it shutting down at night.

No, I eventually took it out. I never got it resolved.

I wonder if its possible to add minecraft time of day to the entities for this? I’ve looked over the python code and sadly its beyond my understanding… but if we knew the time of day in minecraft we could do cool things with lights in the real world

Here we go:

There’s an official Minecraft server sensor https://www.home-assistant.io/integrations/minecraft_server/

1 Like

What have a missed?
I can ping, telnet to minecraft server. Nothing in firewall logs.
minecraft1

2 Likes

Hi Everyone!

I’m trying to use the integration with an external IP address. So it looks something like:

Host: 213.99.22.105:25565 (This is a random IP address ofcourse)

In this case the integration gives an error: IP address is invalid (MAC address could not be determined).

I’ve tried it with my internal IP address and i can connect to the server. But externally with an IP address doesn’t seem to work for the integration. My Minecraft client can connect to the host.

Does someone know what to try out next?

2 Likes

Ran into same issue, and came here searching for solution too

Keep in mind this is only for the java version, not bedrock.

There is an (unnecessary?) check on the mac address. If your server isn’t running in the same LAN segment it will fail.
When using a hostname, it won’t do the mac check and works.

I don’t know enough of github/programming to do a pr, but maybe someone else could try?
Github comment

1 Like

I’m running java version

1 Like

Hi!
The MAC address check is still there but you can fix this with a workaround in Linux.
Associate the address of your server to an IP in the /etc/hosts file of your server (or if you also have a pihole in your net, add a DNS entry for your server IP) and it should work correctly!

Hey, Manuel, thanks for sharing the tip about the MAC address check workaround in Linux! It’s cool to see how tech-savvy folks find creative solutions. Your suggestion involving the /etc/hosts file or even utilizing a pihole is a handy trick.

Speaking of tech creativity, have you ever come across the world of minecraft casinos? They’re pretty fascinating.

Your contributions to the community are invaluable, and your willingness to share knowledge is truly appreciated. Keep up the fantastic work, and may your tech endeavors continue to lead to exciting discoveries!

Hi all. FYI: The MAC check for the Minecraft Server integration was removed in HA core 2023.10. And in 2023.11 support for Bedrock Edition servers was added.

I’m curious if anyone has any bedrock and/or java sensors that display what the latest version is? Not the version my server is running, but the latest one available. Seems to me this should be doable with a Rest or command_line sensor, but I’m having a hard time determining what resource I could query for the current latest version.

I wrote a shell_command service that runs upgrades on my Turnkey servers, would love it if I could get a notification that an update is available.

Answered my own question today, using LinuxGameServer’s source, specifically update_mc.sh (Line 42) and update_mcb.sh (Line 56)

I’ve created two one liners based on their code, resulting in these command_line sensors:

command_line:
  - sensor:
      name: Minecraft Bedrock Latest Version
      command: 'curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -Ls -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.${randomint}.212 Safari/537.36" "https://www.minecraft.net/en-us/download/server/bedrock/" | grep -o "https://minecraft.azureedge.net/bin-linux/[^\"]*" | sed "s/.*\///" | grep -Eo "[.0-9]+[0-9]"'
      icon: mdi:update

  - sensor:
      name: Minecraft Java Latest Version
      command: curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release'
      icon: mdi:update

image

From there it’s just a simple matter of writing an automation that triggers when this sensor is different from the current values provided by the installation to flag when an update is available.