Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup as per instructions failing to get data points #10

Open
jezzaw007 opened this issue Dec 17, 2023 · 16 comments
Open

Setup as per instructions failing to get data points #10

jezzaw007 opened this issue Dec 17, 2023 · 16 comments

Comments

@jezzaw007
Copy link

jezzaw007 commented Dec 17, 2023

I have created the folders and amended the configuration.yaml as per instruction, commented out switch in favor of command_line and rebooted HA.
The sensors and switch are created.

I edited the IP and password in zte_tool.py are correct. Not sure if this is a script issue or if its a configuration issue,
look forward to your guidance:

Logger: homeassistant.components.command_line.utils
Source: components/command_line/utils.py:54
Integration: Command Line (documentation, issues)
Command failed (with return code 1): /usr/local/bin/python /config/python_scripts/zte_tool.py 1
Command failed (with return code 1): /usr/local/bin/python /config/python_scripts/zte_tool.py 3
Command failed (with return code 1): /usr/local/bin/python /config/python_scripts/zte_tool.py 6

I think this because i use HAOS and python is located at /usr/bin/python
symlinks do not save on reboot, I amended the script but not sure what else I need to check to get it to work, thanks

@jezzaw007 jezzaw007 changed the title Setup as per instuction failing to get data points Setup as per instructions failing to get data points Dec 19, 2023
@rafalpietrzakio
Copy link

Same issue here unfortunately (with exact same errors); using docker-based image of newest HA on my Synology NAS. Did you manage to fix this? I'm trying to reverse engineer it right now and run outside HA, I have some issues with the cookie return (no key 'stok' in there) for MC889

@ngarafol ngarafol mentioned this issue Mar 8, 2024
@ngarafol
Copy link
Collaborator

ngarafol commented Mar 8, 2024

@jezzaw007 @rafalpietrzakio Guys, can you please check if latest PR fixes the issue?

@rafalpietrzakio
Copy link

I've just tried again.

  1. Added Lines to my configuration.yaml
  2. Updated the zte_tool.py #300 to my credentials
  3. Uploaded the sensors, python_scripts, command_line and switch folders to my main home assistant config

I see the sensors in the dev tools but all data is unavailable/unknown. Note that I've used the 192.168.254.1 IP which is the IP of MC889 modem I have
Screenshot 2024-03-15 at 00 20 55

@ngarafol
Copy link
Collaborator

What is the output of:

python config/python_scripts/zte_tool.py 3

(or modify path to where your zte_tool.py is and run the command)

@rafalpietrzakio
Copy link

rafalpietrzakio commented Mar 15, 2024

I did it inside of my docker terminal of the home assistant and got this. Maybe I did it wrong?

homeassistant-home-assistant1:/config# python python_scripts/zte_tool.py
Traceback (most recent call last):
File "/config/python_scripts/zte_tool.py", line 301, in
ha_select = int(sys.argv[1])
~~~~~~~~^^^
IndexError: list index out of range

@rafalpietrzakio
Copy link

rafalpietrzakio commented Mar 15, 2024

I've manually changed the ha_select to 3 (zteInfo)
ha_select = 3
instead of
ha_select = int(sys.argv[1])

Now the output is actual data from the router.

{ "wa_inner_version":"BD_PLKPLMC889V1.0.0B13", "cr_version":"", "network_type":"ENDC", "rssi":"", "rscp":"", "rmcc":"260", "rmnc":"2", "enodeb_id":"47489", "lte_rsrq":"-11", "lte_rsrp":"-100", "Z5g_snr":"", "Z5g_rsrp":"-93", "ZCELLINFO_band":"", "Z5g_dlEarfcn":"", "lte_ca_pcell_arfcn":"", "lte_ca_pcell_band":"7", "lte_ca_scell_band":"1", "lte_ca_pcell_bandwidth":"15.0", "lte_ca_scell_info":"", "lte_ca_scell_bandwidth":"15.0", "wan_lte_ca":"ca_activated", "lte_pci":"101", "Z5g_CELL_ID":"", "Z5g_SINR":"7.5", "cell_id":"4748924", "wan_lte_ca":"ca_activated", "lte_ca_pcell_band":"7", "lte_ca_pcell_bandwidth":"15.0", "lte_ca_scell_band":"1", "lte_ca_scell_bandwidth":"15.0", "lte_ca_pcell_arfcn":"", "lte_ca_scell_arfcn":"", "lte_multi_ca_scell_info":"1,396,1,1,225,15.0;2,293,1,1,225,15.0;3,227,2,3,1599,10.0", "wan_active_band":"LTEBAND7", "nr5g_pci":"125", "nr5g_action_band":"n1", "nr5g_cell_id":"", "lte_snr":"7.2", "ecio":"", "wan_active_channel":"3175", "nr5g_action_channel":"426050", "ngbr_cell_info":"REDACTED", "monthly_tx_bytes":"2153724263", "monthly_rx_bytes":"36731967594", "lte_pci":"101", "lte_pci_lock":"", "lte_earfcn_lock":"", "wan_ipaddr":"REDACTED", "wan_apn":"internet", "pm_sensor_mdm":"", "pm_modem_5g":"", "nr5g_pci":"125", "nr5g_action_channel":"426050", "nr5g_action_band":"n1", "Z5g_SINR":"7.5", "Z5g_rsrp":"-93", "wan_active_band":"LTEBAND7", "wan_active_channel":"3175", "wan_lte_ca":"ca_activated", "lte_multi_ca_scell_info":"1,396,1,1,225,15.0;2,293,1,1,225,15.0;3,227,2,3,1599,10.0", "cell_id":"4748924", "dns_mode":"auto", "prefer_dns_manual":"", "standby_dns_manual":"", "network_type":"ENDC", "rmcc":"260", "rmnc":"2", "lte_rsrq":"-11", "lte_rssi":"-70", "lte_rsrp":"-100", "lte_snr":"7.2", "wan_lte_ca":"ca_activated", "lte_ca_pcell_band":"7", "lte_ca_pcell_bandwidth":"15.0", "lte_ca_scell_band":"1", "lte_ca_scell_bandwidth":"15.0", "lte_ca_pcell_arfcn":"", "lte_ca_scell_arfcn":"", "wan_ipaddr":"REDACTED", "static_wan_ipaddr":"", "opms_wan_mode":"LTE_BRIDGE", "opms_wan_auto_mode":"AUTO_LTE_GATEWAY", "ppp_status":"ppp_connected", "loginfo":"ok", "realtime_time":"25496", "signalbar":"5" }

@ngarafol
Copy link
Collaborator

I did it inside of my docker terminal of the home assistant and got this. Maybe I did it wrong?

homeassistant-home-assistant1:/config# python python_scripts/zte_tool.py Traceback (most recent call last): File "/config/python_scripts/zte_tool.py", line 301, in ha_select = int(sys.argv[1]) ~~~~~~~~^^^ IndexError: list index out of range

Just to be clear, did you try python python_scripts/zte_tool.py 3 -> integer 3 is at the end of the line. That would translate to value of ha_select = int(sys.argv[1]) and it should work

@rafalpietrzakio
Copy link

Ah, right. Actually I get the response as above, so it seem to be working. Although all sensors have unavailable / unknown data. My HomeAssistant log says this:
Screenshot 2024-03-15 at 17 01 38

@ngarafol
Copy link
Collaborator

It is strange that "cell_id" would return as None, and it is clearly visible in output...

I would suggest you edit https://github.com/Kajkac/ZTE-MC-Home-assistant/blob/master/sensors/sensors.yaml#L63

to:

value_template: "{{ state_attr('sensor.zte_router_info', 'cell_id') |default(0) |int(base=16) }}"

Mind the indentation. This should set default value to 0 :)

@rafalpietrzakio
Copy link

Still doesn't work unfortunately

@YichGa
Copy link

YichGa commented May 3, 2024

Hi everyone,

any news on this issue? Have the same issue with MC888 at the moment on HA Green.

image

Thank you in advance,

Robert

@YichGa
Copy link

YichGa commented May 3, 2024

Hi, just wanted to update you that I managed to get the data from sensors to display:

image

1st issue I had, the zte_tool_py wasn't running because it would stop at the 1st line "import requests" since it wasn't installed. Sorted by:

image

2nd issue when trying to run python python_scripts/zte_tool.py 3 was

image

Sorted by adding empty "" zteInstance = zteRouter("192.168.0.1", "", "PASSWORD")

After that I could run the script and got the sensors to show values

image

New to this so I would like to apologize if the explanation is a bit messy.

Before all this I had to add to configuration.yaml: python_script: like explained at https://www.home-assistant.io/integrations/python_script/

@Kleimo83
Copy link

Hi, just wanted to update you that I managed to get the data from sensors to display:

image

1st issue I had, the zte_tool_py wasn't running because it would stop at the 1st line "import requests" since it wasn't installed. Sorted by:

image

2nd issue when trying to run python python_scripts/zte_tool.py 3 was

image

Sorted by adding empty "" zteInstance = zteRouter("192.168.0.1", "", "PASSWORD")

After that I could run the script and got the sensors to show values

image

New to this so I would like to apologize if the explanation is a bit messy.

Before all this I had to add to configuration.yaml: python_script: like explained at https://www.home-assistant.io/integrations/python_script/

I am having the same issue but can you clarify that you also edited the configuration.yaml? If so what did you add?

@YichGa
Copy link

YichGa commented May 28, 2024

Hi, here is my configuration.yaml

Loads default set of integrations. Do not remove.

default_config:

Load frontend themes from the themes folder

frontend:
themes: !include_dir_merge_named themes

python_script:
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
sensor: !include_dir_merge_list sensors/

switch: !include_dir_merge_list switch/

command_line: !include_dir_merge_list command_line/

logger:
default: info

image

@marijolis
Copy link

marijolis commented May 29, 2024

was able to run "python -m pip install requests" via add-on "Advanced SSH & Web Terminal", if it helps someone.

@ben423423n32j14e
Copy link

ben423423n32j14e commented Jun 29, 2024

I use HASSIO

I chose to add the Python requests module via a Python virtual environment.

  1. python3 -m venv /config/python_scripts/python_requests_virtual_environment

  2. source /config/python_scripts/python_requests_virtual_environment/bin/activate

  3. pip3 install requests

Then modify the zte_tool.py file:

Move import sys to the top of the file and put this line under it. The top of my zte_tool.py file looks like this:

import sys
sys.path.append('/config/python_scripts/python_requests_virtual_environment/lib/python3.12/site-packages')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants