Giter Site home page Giter Site logo

How to connect on different subnet about pyess HOT 8 CLOSED

gluap avatar gluap commented on August 15, 2024
How to connect on different subnet

from pyess.

Comments (8)

gluap avatar gluap commented on August 15, 2024

In theory this should be possible without changes.

essmqtt has a command line argument --ess_host. If you pass that with the IP address of your ESS (--ess_host=192.168.176.3, essmqtt should skip the mdns autodetection (which doesn't work across subnets, probably the problem you're facing) and directly connect to the given IP address.

A prerequisite of course is that your network is configured such that - via either a gateway or an appropriate route - the machine essmqtt runs on can connect to the 192.168.176.0 subnet.

If it doesn't work with --ess_host that's a bug - in that case please speak up.

from pyess.

meschmesch avatar meschmesch commented on August 15, 2024

ping works, access to the subnet should be possible (at least from another machine on the same network the access is working).

pi@raspberry3:~/essmqtt/bin $ ./esscli --ess_host=192.168.176.3 --action get_data --password MY_PASSWORD

Traceback (most recent call last):
  File "/home/pi/essmqtt/bin/./esscli", line 5, in <module>
    from pyess.cli import main
  File "/home/pi/essmqtt/lib/python3.9/site-packages/pyess/cli.py", line 12, in <module>
    from pyess.ess import find_all_esses, get_ess_pw, extract_name_from_zeroconf, autodetect_ess, ESS
  File "/home/pi/essmqtt/lib/python3.9/site-packages/pyess/ess.py", line 60
    ip = get_ess_ip(self.name)
TabError: inconsistent use of tabs and spaces in indentation

from pyess.

gluap avatar gluap commented on August 15, 2024

You seem to be trying esscli, but the option --ess_host is only available for essmqtt, do you observe the same issue with essmqtt?

As you were asking about the mqtt my guess is that essmqtt is what you need in the end anyhow.

from pyess.

meschmesch avatar meschmesch commented on August 15, 2024

pi@raspberry3:~/essmqtt/bin $ ./essmqtt --ess_host=192.168.176.3 --mqtt_server=192.168.2.115 --ess_password theesspassword

Traceback (most recent call last):
  File "/home/pi/essmqtt/bin/./essmqtt", line 5, in <module>
    from pyess.essmqtt import main
  File "/home/pi/essmqtt/lib/python3.9/site-packages/pyess/essmqtt.py", line 14, in <module>
    from pyess.ess import autodetect_ess
  File "/home/pi/essmqtt/lib/python3.9/site-packages/pyess/ess.py", line 60
    ip = get_ess_ip(self.name)
TabError: inconsistent use of tabs and spaces in indentation

The MQTT Server has no username or password requirement, it is up and running and being used by other services.

from pyess.

gluap avatar gluap commented on August 15, 2024

How did you download the code? did you make modifications?

Background: "Inconsistent tabs and spaces" means that the leading whitespace (which in python has syntactic meaning) is inconsistent and some whitespace is made using tabs. But in that line 60 (and in fact the whole repository as it is on github) there is not a single tab character. If you edited the file with a text editor that might have introduced tab characters (many text editors render tab as four spaces, so it is not immediately apparent when editing whether or not there are tab characters in the beginning of a line.).

If you downloaded using git you can check whether there are differences in your repository by running git status which should highlight any files different from the original version.

If you downloaded as Zip I'd suggest to re-download.

For reference this is the output of essmqtt freshly downloaded from github:

paulg@desktop:~/Workspace/pyess(master)$ venv/bin/essmqtt --ess_host=192.168.1.253 --mqtt_server=192.168.1.220 --ess_password d84fb8020100
We renamed asyncio-mqtt to aiomqtt and released a version 1.0.0 in the process. This is the last release under the asyncio-mqtt name. You can find the new repository at https://github.com/sbtinstruments/aiomqtt
INFO:pyess.aio_ess:fetching auth key
...

You could also search through the file for tab characters.

from pyess.

meschmesch avatar meschmesch commented on August 15, 2024

I got it working, thank you!! There were some weird characters in the config file. In essence by using essmqtt I am constantly receiving on the respective channels updated values of the ESS and using e.g. mosquitto_pub -t ess/control/active -m "false" I can turn off (true = on) my ESS. Perfect!!

One last question, is it also possible to turn on/off the backup functionality of the ESS using your tool?

from pyess.

gluap avatar gluap commented on August 15, 2024

Unfortunately I don't know about any backup functionality - My ESS is an older model and therefore can only reverse engineer the part of the api that is available with that model. (Essentially to find out how it works I used the app and sniffed network traffic after jumping through a few hoops to decrypt said network traffic). So I can only do what my ESS+App can do.

from pyess.

meschmesch avatar meschmesch commented on August 15, 2024

Got it, thanks!!

from pyess.

Related Issues (20)

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.