tlskinneriv / awnet_local

Enables local support for Ambient Weather personal weather stations.
26 stars 5 forks source link

Not working with Passkey #42

Closed masterq1 closed 7 months ago

masterq1 commented 9 months ago

Integration Version: 1.0.1 Home Assistant Version: 2023.12.1

Describe the bug A clear and concise description of what the bug is. I have the WS-1965 Ambient weather station. It's running firmware version WS1965B_V1.1.4. I installed the HA add-on and integration and got everything setup to where the weather station was transmitting to HA and I could see the data in the AWNET add-on logs. However, it was saying that the MAC address was in the incorrect format. After fumbling around with the code for a few days I realized that the weather station is not sending a mac but is sending a 32 character passkey instead.

Eventually I got around this by taking the first 12 characters of the passkey that the weather station sends in its web service call and using that as my mac entry into the Ambient Weather Local integration. Then I modified the code by adding the following 2 lines to line 68 of the init.py file:

        mac = mac[:12]
        mac = format_mac(mac)

I realized that this would take the first 12 characters of the passkey that the weather station sends and format it like a mac address. That way the web service call would match with the entry into the Ambient Weather Local integration.

I have it all working as expected now. I just thought I would share my experience. Not sure if you want to modify the code or not based on my little experience.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

Debug log output from the integration (see Home Assistant docs for how to enable debug logging for an integration; integration name: "custom_components.awnet_local")

Paste your logs here
masterq1 commented 9 months ago

image

Then adding these 2 lines to init.py and restarting HA image

Good results afterwards image

tlskinneriv commented 9 months ago

Glad you were able to get it to work! I did not foresee it not being a MAC address in that field. I will roll a change into the code.

Could you send log output from the add-on in debug mode so that I can see the raw data that the station is sending?

Does the station indicate that passcode in anyway on the device?

masterq1 commented 9 months ago

Yeah I'm glad I got it working too. Not sure I would have kept the Ambient weather station otherwise. I'm testing between this and a Logia which has a smaller weather station unit and more information on the display. But it doesn't have local logging which means I would be totally dependent on an internet connection to Wunderground to get the results of my own weather station sitting right outside on my patio. So once the Ambient local got working, then it won hands down.

I don't see the actual passkey anywhere on the interface for me to be able to change it. I had already registered on ambientweather.net so it could have come from there? Perhaps a combination of my account details and the MAC address maybe? The MAC address is on the configuration screen but it isn't editable.

image

Here is the log data. I changed the passkey to all 9's and changed the value of the token:

s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 2023-12-12 14:13:09,705 INFO : Serving on http://localhost:80 2023-12-12 14:13:13,785 DEBUG : original requestline: GET /endpoint?&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:13&tempf=55.04&humidity=40&windspeedmph=0.00&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542 HTTP/1.1 2023-12-12 14:13:13,787 DEBUG : Environ is: {'BASHIO_LIB_DIR': '/usr/lib/bashio', 'S6_BEHAVIOUR_IF_STAGE2_FAILS': '2', 'HOSTNAME': '8d3f9d88-awnet-to-hass', 'S6_CMD_WAIT_FOR_SERVICES_MAXTIME': '0', 'S6_SERVICES_READYTIME': '50', 'PWD': '/', 'TZ': 'America/New_York', 'HOME': '/root', 'LANG': 'C.UTF-8', 'BASHIO_BIN': '/usr/lib/bashio/bashio', 'HASSIO_TOKEN': 'b45afb415e6f152d9e2aefc1fa088c89f1a242b89f5dbae1643a9cc830f9f5da7f2c23f84e9264fca6266b57e2bc924c66b3346b471985b4', 'SUPERVISOR_TOKEN': 'b45afb415e6f152d9e2aefc1fa088c89f1a242b89f5dbae1643a9cc830f9f5da7f2c23f84e9264fca6266b57e2bc924c66b3346b471985b4', 'SHLVL': '3', 'PATH': '/command:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'S6_CMD_WAIT_FORSERVICES': '1', '': '/usr/local/bin/python3', 'SERVER_NAME': '8d3f9d88-awnet-to-hass.local.hass.io', 'GATEWAY_INTERFACE': 'CGI/1.1', 'SERVER_PORT': '80', 'REMOTE_HOST': '', 'CONTENT_LENGTH': '', 'SCRIPT_NAME': '', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.2', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/endpoint', 'QUERY_STRING': '&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:13&tempf=55.04&humidity=40&windspeedmph=0.00&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542', 'REMOTE_ADDR': '192.168.1.114', 'CONTENT_TYPE': 'text/plain', 'HTTP_HOST': '192.168.1.122', 'HTTP_CONNECTION': 'close', 'HTTP_USER_AGENT': 'WS1965B', 'wsgi.input': <_io.BufferedReader name=4>, 'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.multithread': False, 'wsgi.multiprocess': False, 'wsgi.file_wrapper': <class 'wsgiref.util.FileWrapper'>} 2023-12-12 14:13:13,788 DEBUG : Headers:

HOST: 192.168.1.122 CONNECTION: close USER-AGENT: WS1965B CONTENT-TYPE: text/plain

2023-12-12 14:13:13,789 DEBUG : Full Data: {'PASSKEY': ['99999999999999999999999999999999'], 'stationtype': ['WS1965B_V1.1.4'], 'dateutc': ['2023-12-12 19:13:13'], 'tempf': ['55.04'], 'humidity': ['40'], 'windspeedmph': ['0.00'], 'windgustmph': ['1.12'], 'maxdailygust': ['5.82'], 'winddir': ['90'], 'winddir_avg10m': ['90'], 'hourlyrainin': ['0.000'], 'eventrainin': ['0.000'], 'dailyrainin': ['0.000'], 'weeklyrainin': ['0.012'], 'monthlyrainin': ['0.024'], 'yearlyrainin': ['0.024'], 'totalrainin': ['0.024'], 'battout': ['1'], 'tempinf': ['77.90'], 'humidityin': ['32'], 'baromrelin': ['29.542'], 'baromabsin': ['29.542']} 2023-12-12 14:13:13,799 DEBUG : Starting new HTTP connection (1): supervisor:80 2023-12-12 14:13:13,842 DEBUG : http://supervisor:80 "POST /core/api/services/awnet_local/update HTTP/1.1" 200 2 2023-12-12 14:13:13,843 INFO : Sent {"PASSKEY": "99999999999999999999999999999999", "stationtype": "WS1965B_V1.1.4", "dateutc": "2023-12-12 19:13:13", "tempf": "55.04", "humidity": "40", "windspeedmph": "0.00", "windgustmph": "1.12", "maxdailygust": "5.82", "winddir": "90", "winddir_avg10m": "90", "hourlyrainin": "0.000", "eventrainin": "0.000", "dailyrainin": "0.000", "weeklyrainin": "0.012", "monthlyrainin": "0.024", "yearlyrainin": "0.024", "totalrainin": "0.024", "battout": "1", "tempinf": "77.90", "humidityin": "32", "baromrelin": "29.542", "baromabsin": "29.542"} 2023-12-12 14:13:13,844 DEBUG : Valid Request 192.168.1.114 - - [12/Dec/2023 14:13:13] "GET /endpoint?&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:13&tempf=55.04&humidity=40&windspeedmph=0.00&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542 HTTP/1.1" 200 0 2023-12-12 14:13:29,807 DEBUG : original requestline: GET /endpoint?&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:29&tempf=55.04&humidity=39&windspeedmph=0.00&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542 HTTP/1.1 2023-12-12 14:13:29,809 DEBUG : Environ is: {'BASHIO_LIB_DIR': '/usr/lib/bashio', 'S6_BEHAVIOUR_IF_STAGE2_FAILS': '2', 'HOSTNAME': '8d3f9d88-awnet-to-hass', 'S6_CMD_WAIT_FOR_SERVICES_MAXTIME': '0', 'S6_SERVICES_READYTIME': '50', 'PWD': '/', 'TZ': 'America/New_York', 'HOME': '/root', 'LANG': 'C.UTF-8', 'BASHIO_BIN': '/usr/lib/bashio/bashio', 'HASSIO_TOKEN': 'b45afb415e6f152d9e2aefc1fa088c89f1a242b89f5dbae1643a9cc830f9f5da7f2c23f84e9264fca6266b57e2bc924c66b3346b471985b4', 'SUPERVISOR_TOKEN': 'b45afb415e6f152d9e2aefc1fa088c89f1a242b89f5dbae1643a9cc830f9f5da7f2c23f84e9264fca6266b57e2bc924c66b3346b471985b4', 'SHLVL': '3', 'PATH': '/command:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'S6_CMD_WAIT_FORSERVICES': '1', '': '/usr/local/bin/python3', 'SERVER_NAME': '8d3f9d88-awnet-to-hass.local.hass.io', 'GATEWAY_INTERFACE': 'CGI/1.1', 'SERVER_PORT': '80', 'REMOTE_HOST': '', 'CONTENT_LENGTH': '', 'SCRIPT_NAME': '', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.2', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/endpoint', 'QUERY_STRING': '&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:29&tempf=55.04&humidity=39&windspeedmph=0.00&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542', 'REMOTE_ADDR': '192.168.1.114', 'CONTENT_TYPE': 'text/plain', 'HTTP_HOST': '192.168.1.122', 'HTTP_CONNECTION': 'close', 'HTTP_USER_AGENT': 'WS1965B', 'wsgi.input': <_io.BufferedReader name=4>, 'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.multithread': False, 'wsgi.multiprocess': False, 'wsgi.file_wrapper': <class 'wsgiref.util.FileWrapper'>} 2023-12-12 14:13:29,811 DEBUG : Headers:

HOST: 192.168.1.122 CONNECTION: close USER-AGENT: WS1965B CONTENT-TYPE: text/plain

2023-12-12 14:13:29,812 DEBUG : Full Data: {'PASSKEY': ['99999999999999999999999999999999'], 'stationtype': ['WS1965B_V1.1.4'], 'dateutc': ['2023-12-12 19:13:29'], 'tempf': ['55.04'], 'humidity': ['39'], 'windspeedmph': ['0.00'], 'windgustmph': ['1.12'], 'maxdailygust': ['5.82'], 'winddir': ['90'], 'winddir_avg10m': ['90'], 'hourlyrainin': ['0.000'], 'eventrainin': ['0.000'], 'dailyrainin': ['0.000'], 'weeklyrainin': ['0.012'], 'monthlyrainin': ['0.024'], 'yearlyrainin': ['0.024'], 'totalrainin': ['0.024'], 'battout': ['1'], 'tempinf': ['77.90'], 'humidityin': ['32'], 'baromrelin': ['29.542'], 'baromabsin': ['29.542']} 2023-12-12 14:13:29,817 DEBUG : Starting new HTTP connection (1): supervisor:80 2023-12-12 14:13:29,857 DEBUG : http://supervisor:80 "POST /core/api/services/awnet_local/update HTTP/1.1" 200 2 2023-12-12 14:13:29,859 INFO : Sent {"PASSKEY": "99999999999999999999999999999999", "stationtype": "WS1965B_V1.1.4", "dateutc": "2023-12-12 19:13:29", "tempf": "55.04", "humidity": "39", "windspeedmph": "0.00", "windgustmph": "1.12", "maxdailygust": "5.82", "winddir": "90", "winddir_avg10m": "90", "hourlyrainin": "0.000", "eventrainin": "0.000", "dailyrainin": "0.000", "weeklyrainin": "0.012", "monthlyrainin": "0.024", "yearlyrainin": "0.024", "totalrainin": "0.024", "battout": "1", "tempinf": "77.90", "humidityin": "32", "baromrelin": "29.542", "baromabsin": "29.542"} 2023-12-12 14:13:29,860 DEBUG : Valid Request 192.168.1.114 - - [12/Dec/2023 14:13:29] "GET /endpoint?&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:29&tempf=55.04&humidity=39&windspeedmph=0.00&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542 HTTP/1.1" 200 0 2023-12-12 14:13:45,795 DEBUG : original requestline: GET /endpoint?&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:45&tempf=55.04&humidity=38&windspeedmph=0.67&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542 HTTP/1.1 2023-12-12 14:13:45,796 DEBUG : Environ is: {'BASHIO_LIB_DIR': '/usr/lib/bashio', 'S6_BEHAVIOUR_IF_STAGE2_FAILS': '2', 'HOSTNAME': '8d3f9d88-awnet-to-hass', 'S6_CMD_WAIT_FOR_SERVICES_MAXTIME': '0', 'S6_SERVICES_READYTIME': '50', 'PWD': '/', 'TZ': 'America/New_York', 'HOME': '/root', 'LANG': 'C.UTF-8', 'BASHIO_BIN': '/usr/lib/bashio/bashio', 'HASSIO_TOKEN': 'b45afb415e6f152d9e2aefc1fa088c89f1a242b89f5dbae1643a9cc830f9f5da7f2c23f84e9264fca6266b57e2bc924c66b3346b471985b4', 'SUPERVISOR_TOKEN': 'b45afb415e6f152d9e2aefc1fa088c89f1a242b89f5dbae1643a9cc830f9f5da7f2c23f84e9264fca6266b57e2bc924c66b3346b471985b4', 'SHLVL': '3', 'PATH': '/command:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'S6_CMD_WAIT_FORSERVICES': '1', '': '/usr/local/bin/python3', 'SERVER_NAME': '8d3f9d88-awnet-to-hass.local.hass.io', 'GATEWAY_INTERFACE': 'CGI/1.1', 'SERVER_PORT': '80', 'REMOTE_HOST': '', 'CONTENT_LENGTH': '', 'SCRIPT_NAME': '', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.2', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/endpoint', 'QUERY_STRING': '&PASSKEY=99999999999999999999999999999999&stationtype=WS1965B_V1.1.4&dateutc=2023-12-12+19:13:45&tempf=55.04&humidity=38&windspeedmph=0.67&windgustmph=1.12&maxdailygust=5.82&winddir=90&winddir_avg10m=90&hourlyrainin=0.000&eventrainin=0.000&dailyrainin=0.000&weeklyrainin=0.012&monthlyrainin=0.024&yearlyrainin=0.024&totalrainin=0.024&battout=1&tempinf=77.90&humidityin=32&baromrelin=29.542&baromabsin=29.542', 'REMOTE_ADDR': '192.168.1.114', 'CONTENT_TYPE': 'text/plain', 'HTTP_HOST': '192.168.1.122', 'HTTP_CONNECTION': 'close', 'HTTP_USER_AGENT': 'WS1965B', 'wsgi.input': <_io.BufferedReader name=4>, 'wsgi.errors': <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>, 'wsgi.version': (1, 0), 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.multithread': False, 'wsgi.multiprocess': False, 'wsgi.file_wrapper': <class 'wsgiref.util.FileWrapper'>} 2023-12-12 14:13:45,797 DEBUG : Headers:

HOST: 192.168.1.122 CONNECTION: close USER-AGENT: WS1965B CONTENT-TYPE: text/plain

tlskinneriv commented 8 months ago

Is the MAC part of the passkey at all? Based on information from all of these comments, it looks like the passkey is a 32 character hexadecimal (0-9 and a-f) field. Is that the case based on your real passkey?

masterq1 commented 8 months ago

No the MAC is not directly included in the passkey value. E.g. if the passkey is 1234567890abcdef1234567890abcdef the MAC is not anything like abcdef123456. However the passkey is a 32 character hex field. My MAC was not found anywhere in the debug logs.

AllenBurgett commented 7 months ago

Is there any resolution to this issue? My station just started delivering a passkey today as well.

I ended up hardcoding my MAC in there in a similar process to @masterq1

edalquist commented 7 months ago

Seeing the same issue, the addon logs:

2024-01-21 19:56:09,781     INFO : Sent {"PASSKEY": "38E4AECB5DAFE9D8CBC4B90ACE6D13BB", "stationtype": "AMBWeatherPro_V5.1.4", "dateutc": "2024-01-22 03:56:09", "tempf": "43.7", "humidity": "96", "windspeedmph": "6.26", "windgustmph": "7.16", "maxdailygust": "17.67", "winddir": "102", "winddir_avg10m": "100", "uv": "0", "solarradiation": "0.00", "hourlyrainin": "0.047", "eventrainin": "0.555", "dailyrainin": "0.417", "weeklyrainin": "0.417", "monthlyrainin": "2.787", "yearlyrainin": "18.276", "battout": "1", "battrain": "1", "tempinf": "71.6", "humidityin": "42", "baromrelin": "29.418", "baromabsin": "29.418", "battin": "0", "pm25_in": "4.0", "pm25_in_24h": "4.6", "aqi_pm25_in": "17", "aqi_pm25_in_24h": "19", "batt_25in": "1", "temp8f": "44.1", "humidity8": "96", "batt8": "1"}
192.168.22.77 - - [21/Jan/2024 19:56:09] "GET ?&PASSKEY=38E4AECB5DAFE9D8CBC4B90ACE6D13BB&stationtype=AMBWeatherPro_V5.1.4&dateutc=2024-01-22+03:56:09&tempf=43.7&humidity=96&windspeedmph=6.26&windgustmph=7.16&maxdailygust=17.67&winddir=102&winddir_avg10m=100&uv=0&solarradiation=0.00&hourlyrainin=0.047&eventrainin=0.555&dailyrainin=0.417&weeklyrainin=0.417&monthlyrainin=2.787&yearlyrainin=18.276&battout=1&battrain=1&tempinf=71.6&humidityin=42&baromrelin=29.418&baromabsin=29.418&battin=0&pm25_in=4.0&pm25_in_24h=4.6&aqi_pm25_in=17&aqi_pm25_in_24h=19&batt_25in=1&temp8f=44.1&humidity8=96&batt8=1 HTTP/1.1" 200 0

I'm also not sure where to discover the passkey

caylor93 commented 7 months ago

I just started having the same issue in the last several days.

I used the process @masterq1 showed.

espeir commented 7 months ago

My interface started failing with the passkey error also. Started a couple of days ago. Nothing changed on my end as far as I know...

jjohns63 commented 7 months ago

Same symptoms with a WS-2902C running version AMBWeatherPro_V5.1.4. For now I've modified the custom component to accept the first 12 characters of the PASSKEY, and match the MAC. I only have one station so it's easy to see from the add-on what the correct passkey is. I sent a request to AmbientWeather support for info on how to get the passkey

lhatton commented 7 months ago

Same here. Can the mac address be edited without reconfiguring the add on so as to match the truncated passkey?

espeir commented 7 months ago

Same here. Can the mac address be edited without reconfiguring the add on so as to match the truncated passkey?

Would love to know this answer.

Nividica commented 7 months ago

The new PASSKEY looks suspiciously like a hash code, was hoping it was a simple unsalted hash of the MAC address, but it doesn't appear that way. Wonder if they hashed/encrypted/encoded the MAC because it was somehow being abused in AWNET?

To fix my setup, I added a new query param argument to the Path, set it to my MAC, and updated the code to check for it first.

Code changes

In const.py added ATTR_MAC_OVERRIDE

# Attributes
ATTR_PASSKEY = "PASSKEY"
ATTR_MAC = "MAC"
ATTR_MAC_OVERRIDE = "MAC_OVERRIDE"

In __init__.py added check for MAC override to async_handle_update

        mac = None
        data = call.data
        if ATTR_MAC_OVERRIDE in data:
            mac = format_mac(data[ATTR_MAC_OVERRIDE])
        elif ATTR_PASSKEY in data:
            mac = format_mac(data[ATTR_PASSKEY])
        elif ATTR_MAC in data:
            mac = format_mac(data[ATTR_MAC])
        if mac:

Weather station changes

Set Path to ?MAC_OVERRIDE=083A8DDED826 image ... image


With those changes, I was able to get everything up and running image image

tlskinneriv commented 7 months ago

Sorry to have ghosted on this. Thanks everyone for all the useful information. I will soon release a fix in the code similar to the one that @Nividica posted above, as that will likely be easiest for end users to configure and will only require reconfiguration of the device rather than in HA as well. Ideally, I'd like to make it such that the add-on can inject an autoconfiguration of the device into HA on the first request sent from the station, but that will require more research and time than I'd like to take before delivering a fix for this bug caused by Ambient's changes. I'm still on 4.3.4 on my WS2902-C, so I haven't seen it yet, but I'm sure I will once I update.

To answer your questions @espeir and @lhatton, there's not currently a way to change the MAC configured in the integration without setting it up again, as it is used as the unique_id for the device.

I appreciate your patience and I expect to roll out the update this weekend.

michaelcox12 commented 7 months ago

Mmm, followed Nividica's guide above as I am also having the same issue, but the debug logs for awnet_local keep saying "NameError: name 'ATTR_MAC_OVERRIDE' is not defined" and its only show 1 entity that doesn't connect. Probably just wait for the rollout

tlskinneriv commented 7 months ago

All, I have added a new option to the add-on that is used in conjunction with this custom integration: https://github.com/tlskinneriv/hassio-addons/blob/master/awnet/DOCS.md#add-on-options. Please update to the latest 1.1.0 version to override the MAC address using the specified option. Configuration for the HA integration and on the Ambient Weather device stays the same as before.

ETA: you will likely need to expand the "Show unused optional configuration options" to see the option in the configuration pane.

espeir commented 7 months ago

Works great! Thank you so much! Didn't realize how many automatons I had using data from this integration...

michaelcox12 commented 7 months ago

image

tlskinneriv commented 7 months ago

Try all lowercase. Missed making that regex case insensitive. Will release an update with that fixed up.

michaelcox12 commented 7 months ago

Thank you so much! Lowercase worked like a charm, cheers for all the hard work