Hi Tom,
After your help, and a bit of forehead on wall thumping I finally figured 
out my problem.  The permissions for the serial port I am using 
/dev/ttyAMA0 on my RPi2 were: 
crw--w---- 1 root tty 204, 64 Nov 26 11:57 /dex/ttyAMA0
and my user was a member of the tty group and not the owner.  So it could 
not read from the port.

My previous attempts to communicate all worked because I was issuing the 
commands using sudo (duh).

So I have fixed the permission issue by changing the group of ttyAMA0 using 
the command:

sudo systemctl mask serial-getty@ttyAMA0.service

so that the port is now a member of the dialout group which has the proper 
permissions for the port and my user is also a member of this group.
crw--w---- 1 root dialout  204, 64 Nov 26 11:58 /dex/ttyAMA0

Not sure why the permissions are set this way but my RPi2 is about 6 years 
old now, and the RPi OS & hardware in use today have evolved significantly 
as has the need for better security.  These combined with my infrequent use 
of Linux all bit me in the back side.

Again thanks! 
On Wednesday, November 25, 2020 at 5:25:50 AM UTC-7 tke...@gmail.com wrote:

> It's not quite that simple. The command is "WRD\x12\x4d". That is, it's 
> the characters WRD, followed by two bytes with values 0x12 and 0x4d. 
> Unfortunately, I don't know of any easy way to transmit special characters 
> using minicom. But, here's a little program that will do it:
>
> import serial
> import time
>
> # open up the serial port. Your port may differ.
> s = serial.Serial('/dev/ttyUSB0', 19200)
> # Wake up the console
> s.write(b"\n\n")
> time.sleep(0.2)
> # Query for the hardware type
> s.write(b"WRD\x12\x4d\n")
> # Wait a bit for the console to respond
> time.sleep(0.2)
> # Get the response
> b = s.read(4)
> print(b)
>
> When I run this program on my machine, I get:
> b'\n\r\x06\x10'
>
> The \x06 is the <ACK> character. 
>
> The \x10 is the code for the type of Davis console. \x10 is a VantagePro2. 
> \x11 would be a VantageVue.
>
> As for why this worked before, but not now, I don't know what version of 
> WeeWX you were running. It's possible very old versions did not query for 
> hardware type, but I really don't remember.
>
> -tk
>
>
>
> On Tue, Nov 24, 2020 at 7:00 PM Chip Towner <gct3...@gmail.com> wrote:
>
>> Hi,
>> Thanks for the quick reply!
>> You must see the code and/or these log messages in your sleep, I didn't 
>> see anything that even mentioned WRD.  I confirmed with minicom that I am 
>> not getting a response when I send out a WRD.  
>>
>> I appreciate the work around, but before I use it I need to understand 
>> why the WRD is not working otherwise I have no idea what else is going 
>> wrong and my brain will start to itch.  
>>
>> FYI, the serial connection is three wires connected from the serial port 
>> on the PI to the serial port on the VP2.  The cable ends do not appear to 
>> have been moved but it is certainly not robust. I had to move my hardware 
>> to perform the upgrade and if things were not shut down properly I suppose 
>> I could have damaged something.  Not sure why the WRD was impacted put the 
>> TEST, LAMP, VER, NVER commands were not impacted.  Of course different 
>> parts of the underlying circuits could have been damaged.
>>
>> Again thanks very much.
>>
>> Cheers! 
>>
>>
>>
>> On Tuesday, November 24, 2020 at 5:32:11 PM UTC-7 tke...@gmail.com wrote:
>>
>>> You didn't say much about your direct serial connection to the console, 
>>> but it is not properly emulating the Davis WRD command. This command 
>>> returns the hardware type (VantageVue, VantagePro, etc.)
>>>
>>> If all else fails, you can hard set it in the driver. At line 494 (or 
>>> thereabouts), change this
>>>
>>> self.hardware_type = None
>>>
>>>
>>> to this
>>>
>>> self.hardware_type = 16
>>>
>>>
>>> That may fix things, but there are likely to be other problems. You'll 
>>> have to do this every time you upgrade. Or, get the serial connection fixed!
>>>
>>>
>>>
>>> On Tue, Nov 24, 2020 at 4:20 PM Chip Towner <gct3...@gmail.com> wrote:
>>>
>>>> Hi,
>>>> I have been using Weewx since 2014 on a RaspberryPi 2.  My weather 
>>>> station is a VantagePro2 and the connection is a straight serial 
>>>> connection 
>>>> (no data logger).  Weewx has worked well for this entire time.
>>>>
>>>> This year after a failed update (mirror sites no longer exist),  I 
>>>> decided I would take a chance and upgrade to the latest version of the 
>>>> Raspbian OS (Buster I beleive).  I backed up my Weewx data as directed 
>>>> prior to the update.  Then I updated the OS and took the opportunity to 
>>>> also update Weewx to the latest/greatest.
>>>>
>>>> Unfortunately Weewx is now unable to connect to the VP2.  
>>>>
>>>> Since I originally configured this connection in 2014 it is possible 
>>>> (perhpas eve likely) that I have missed something or even damaged the VP2 
>>>> (hope not).  
>>>>
>>>>    - I have dug into the User Guide and believe I have things 
>>>>    configured properly.
>>>>    - I have used minicom and screen to confirm that my RPi can in fact 
>>>>    talk to the VP2.   
>>>>    - Used TEST and received the expected reply
>>>>       - Used LAMP 1 and turned the display light on
>>>>    - I attempted to use wee_device to turn on the VP2 lamp. It did not 
>>>>    work. 
>>>>       - I copied the results into the file weeDeviceLog.txt in case it 
>>>>       might be helpful 
>>>>    - I edited the weewx.conf that was installed and did my best to 
>>>>    configure things as they were previously (attached is 
>>>> weewxCurrent.conf, a 
>>>>    renamed version of this document with some passwords removed)
>>>>       - I have updated the weewx.conf file to use software based 
>>>>       record generation.
>>>>       - The port settings appear to be correct - even when comparing 
>>>>       to my previous weewx.conf file.
>>>>    
>>>> I am attaching a portion of the tail of the syslog file. I stopped 
>>>> weewx and then started it to show what happens. 
>>>>
>>>> Because it appears that I can communicate with the VP2 using minicom 
>>>> and screen I am hoping this means my RPI & VP2 are healthy and that this 
>>>> is 
>>>> some weewx configuration issue I have missed.
>>>>
>>>> Any help is appreciated!
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "weewx-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to weewx-user+...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/weewx-user/e9bf7d61-7762-4853-b8be-4805299e7536n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/weewx-user/e9bf7d61-7762-4853-b8be-4805299e7536n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "weewx-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to weewx-user+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/2f58831b-1187-4379-a551-d3b32981869bn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/2f58831b-1187-4379-a551-d3b32981869bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/f104a118-9d59-4eb6-b9f9-1e85d41aa1cen%40googlegroups.com.

Reply via email to