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

Add Support for Hub2000 #11

Merged
merged 5 commits into from
Apr 8, 2024
Merged

Add Support for Hub2000 #11

merged 5 commits into from
Apr 8, 2024

Conversation

ricariel
Copy link
Contributor

@ricariel ricariel commented Apr 5, 2024

Tried to add support for the new hub2000 with these tools.

@ricariel
Copy link
Contributor Author

ricariel commented Apr 6, 2024

Closes #10

@sstidl
Copy link

sstidl commented Apr 7, 2024

I tried your patched version. Which value should I set
SF_PRODUCT_ID to? I have the HUB2000 too

@sstidl
Copy link

sstidl commented Apr 7, 2024

Tested your changes.
You need to patch 2 Lines:

diff --git a/src/solarflow-bt-manager.py b/src/solarflow-bt-manager.py
index 3c88e20..f2bdead 100644
--- a/src/solarflow-bt-manager.py
+++ b/src/solarflow-bt-manager.py
@@ -96,7 +96,7 @@ async def set_IoT_Url(client,broker,port,ssid,deviceid):


 def handle_rx(BleakGATTCharacteristic, data: bytearray):
-    global mq_client
+    global mq_client, SF_PRODUCT_ID, SF_DEVICE_ID
     payload = json.loads(data.decode("utf8"))
     log.info(payload)

@@ -113,7 +113,7 @@ def handle_rx(BleakGATTCharacteristic, data: bytearray):
                 mq_client.publish(f'solarflow-hub/telemetry/{prop}',val)

             # also report whole state to mqtt (nothing coming from cloud now :-)
-            mq_client.publish("{SF_PRODUCT_ID}/{deviceid}/state",json.dumps(payload["properties"]))
+            mq_client.publish(f"{SF_PRODUCT_ID}/{SF_DEVICE_ID}/state",json.dumps(payload["properties"]))

         if "packData" in payload:                                                                                                 packdata = payload["packData"]                                                                           @@ -135,6 +135,7 @@ async def run(broker=None, port=None, info_only: bool = False, connect: bool = F
     else:
       product_class = "zenh"                                                                                         
+    log.info("scan for: " + str(product_class))
     device = await BleakScanner.find_device_by_filter(                                                                                lambda d, ad: d.name and d.name.lower().startswith(product_class)
             )                                                                                                        

@ricariel
Copy link
Contributor Author

ricariel commented Apr 8, 2024

You're right. Fixed that.

@ricariel
Copy link
Contributor Author

ricariel commented Apr 8, 2024

I tried your patched version. Which value should I set SF_PRODUCT_ID to? I have the HUB2000 too

SF_PRODUCT_ID='A8yh63'

@reinhard-brandstaedter reinhard-brandstaedter merged commit 22372f0 into reinhard-brandstaedter:master Apr 8, 2024
@sstidl
Copy link

sstidl commented Apr 8, 2024

I tried your patched version. Which value should I set SF_PRODUCT_ID to? I have the HUB2000 too

SF_PRODUCT_ID='A8yh63'

how did you find that out?

@sstidl
Copy link

sstidl commented Apr 8, 2024

I tried your patched version. Which value should I set SF_PRODUCT_ID to? I have the HUB2000 too

SF_PRODUCT_ID='A8yh63'

how did you find that out?

is this the appKey when call the register-api call described here: https://github.com/Zendure/developer-device-data-report ?

@ricariel
Copy link
Contributor Author

ricariel commented Apr 8, 2024

I tried your patched version. Which value should I set SF_PRODUCT_ID to? I have the HUB2000 too

SF_PRODUCT_ID='A8yh63'

how did you find that out?

I just used the bt tool. There you can see the traffic.

@sstidl
Copy link

sstidl commented Apr 8, 2024

I tried your patched version. Which value should I set SF_PRODUCT_ID to? I have the HUB2000 too

SF_PRODUCT_ID='A8yh63'

how did you find that out?

I just used the bt tool. There you can see the traffic.

I think you are referring to the device id.
I don't find the productid in the output of the tool

@reinhard-brandstaedter
Copy link
Owner

It is part of the MQTT topic the hub is writing to:
/productid/deviceid/…

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

Successfully merging this pull request may close these issues.

3 participants