jblance / mpp-solar

Python package to communicate to MPP Solar PIP-4048MS inverters (and similar)
MIT License
355 stars 149 forks source link

Accessing Victron SmartShunt over BlueTooth #174

Open spoonwzd opened 2 years ago

spoonwzd commented 2 years ago

I've paired to my SmartShunt over Bluetooth and mapped /dev/rfcomm0 - but what port and/or --porttype should I be using to make this work?

jblance commented 2 years ago

try mpp-solar -p /dev/rfcomm0 -P VED -c vedtext --porttype vserial -b 19200

spoonwzd commented 2 years ago

Yeah I did try that actually. It said:

2021-10-24 16:01:04,318:WARNING:vserialio:send_and_receive@50: VSerial read error: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
Parameter                       Value           Unit
error                           Error occured while grabbing data from /dev/rfcomm0
jblance commented 2 years ago

did you try with sudo? Are you sure that the /dev/rfcomm0 is correct and functional?

On Tue, 26 Oct 2021 at 09:23, spoonwzd @.***> wrote:

Yeah I did try that actually. It said:

2021-10-24 @.***: VSerial read error: read failed: device reports readiness to read but returned no data (device disconnected or multiple access on port?) Parameter Value Unit error Error occured while grabbing data from /dev/rfcomm0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/174#issuecomment-951286532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNTYERADY4B5JADLSKDUIW4CJANCNFSM5GTRUUUQ .

spoonwzd commented 2 years ago

Same with Sudo.

I think the bluetooth stuff is ok

pi@raspberrypi:~ $ sudo bluetoothctl
Agent registered
[bluetooth]# devices
Device C6:C8:E0:78:5F:D5 SmartShunt HQ2107P36Z7
Device C8:47:8C:F3:60:C1 BMS #2
Device C8:47:8C:F5:5C:37 BMS #1
Device C8:47:8C:F5:75:A5 BMS #3
[bluetooth]# connect C6:C8:E0:78:5F:D5
Attempting to connect to C6:C8:E0:78:5F:D5
Connection successful
[SmartShunt HQ2107P36Z7]# trust
[CHG] Device C6:C8:E0:78:5F:D5 Trusted: yes
Changing C6:C8:E0:78:5F:D5 trust succeeded
[SmartShunt HQ2107P36Z7]# pair
Attempting to pair with C6:C8:E0:78:5F:D5
Request passkey
[agent] Enter passkey (number in 0-999999): 000000
[CHG] Device C6:C8:E0:78:5F:D5 Paired: yes
[bluetooth]# exit
pi@raspberrypi:~ $ sudo rfcomm bind 0 C6:C8:E0:78:5F:D5
pi@raspberrypi:~ $ ls /dev/rfcomm*
/dev/rfcomm0
jblance commented 2 years ago

sorry i was not thinking straight I havent got SmartShunt working via bluetooth yet - my SmartShunt code is for rs485 connection. The bluetooth code is JKBMS specific and pretty hacky at the moment does /dev/rfcomm0 receive any data ?

spoonwzd commented 2 years ago

No worries. I'm a bit of a noob, so I don't quite know how I'd tell if /dev/rfcomm0 was receiving any data.

Thanks

jblance commented 2 years ago

Try cat /dev/rfcomm0

On Tue, 26 Oct 2021, 7:58 pm spoonwzd, @.***> wrote:

No worries. I'm a bit of a noob, so I don't quite know how I'd tell if /dev/rfcomm0 was receiving any data.

Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/174#issuecomment-951618309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNSCD63XAUOAQXKGJR3UIZNSBANCNFSM5GTRUUUQ .

spoonwzd commented 2 years ago

No output from that command at all.

jblance commented 2 years ago

Ok, it might have to wait until I figure out a better solution

On Tue, 26 Oct 2021, 8:02 pm spoonwzd, @.***> wrote:

No output from that command at all.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jblance/mpp-solar/issues/174#issuecomment-951620498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJVKNSKFECI6FT3I62TPW3UIZN73ANCNFSM5GTRUUUQ .

spoonwzd commented 2 years ago

No worries. I'd much rather sort out https://github.com/jblance/mpp-solar/issues/170 anyway :)