CGI Control Commands for Panasonic Remote Camera AW-HE40

Introduction

The Panasonic AW-HE40 is a Pan-Tile-Zoom Remote camera. It support CGI control via IP network. The control commands are in compliance with the HTTP1.1 communication specifications. Their format is given below:

http://[Camera_IP_Address]/cgi-bin/aw_ptz?cmd=[Command]&res=1

This article will cover the following mostly used information and control functions:

Power On and StandBy

# Power on
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23O1&res=1
Return: 200 OK "p1"

# Put in standby mode
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23O0&res=1
Return: 200 OK "p0"

# Inquiry
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23O&res=1
Return (Standby): 200 OK "p0"
Return (Power On): 200 OK "p1"
Return (Transferring from Standby to ON): 200 OK "p3"

Pan/Tilt Operations

For Pansonic AW-HE40, Pan range is from -175o (2D09h) to +175 o (D2F5h), and Tilt range is from -30o (5555h) to +90o (8E38h).

1 degree = 121 (decimal) or 79 (hex)

# Pan/tilt position control (Absolute Value)
# #APC[Data1][Data2][[Data3][Data4]]
# [Data1] - Pan Position 0000h(ccw max)-8000h(home)-FFFF(cw max)
# [Data2] - Tilt Position 0000h(up max)-8000h(center)-FFFF(down max)
# [Data3] - Pst Spd 00h-1Dh
# [Data4] - Spd Tbl 0(SLOW)-2(FAST)
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23APC80008000&res=1
# Return (home): 200 OK "aPC80008000"

# Inquiry of current pan and tilt position
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23APC&res=1
# Return (home): 200 OK "aPC80008000"

# Stop current pan/tilt operation
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23PTS5050&res=1
# Return: 200 OK "pTS5050"

# Pan/tilt position control (Relative Value)
# #RPC[Data1][Data2][[Data3][Data4]]
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23RPC80008000&res=1
# Return (home): 200 OK "rPC80008000"

Note: When using the pan-tilt head control commands, send the commands with a gap of 130 ms between each command.

Zoom Operations

These commands control the zooming (between Wide and Tele) of the camera lens and enable the current zoom position and zooming speed to be acquired.

# Zoom control: #AXZ[Data]
# [Data] - 555h (Wide) to FFFh (Tele)
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23AXZ555&res=1
# Return: 200 OK "axz555"

# Query zoom position (1): #AXZ
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23AXZ&res=1
# Return: 200 OK "axz555"

# Query zoom position (2): #GZ
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23GZ&res=1
# Return (if Standby): 200 OK "axz---"

Preset

The camera has functions to register and play back the presets of the camera and enable the preset number last played back to be acquired. They also enable the preset speed to be registered and the current preset speed to be acquired.

# Register a Preset: #M[Data]
# [Data] - 00h to 99h (Preset 001 to 100)
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23M00&res=1
# Return: 200 OK "s00"

# Recall a Preset: #R[Data]
# [Data] - 00h to 99h (Preset 001 to 100)
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23R00&res=1
# Return: 200 OK "s00"

# Inquiry last preset number being played back: #S
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23S&res=1
# Return: 200 OK "s00"

# Pan/tilt position control (Relative Value)
# #RPC[Data1][Data2][[Data3][Data4]]
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23RPC80008000&res=1
# Return (home): 200 OK "rPC80008000"

Wireless Remote Controller

Wireless Remote Controller can be enabled or disabled via the CGI commands. The Wireless Controller ID can be set too.

# Enable/Disable wireless remote controller: #WLC[Data]
# [Data] - 0 (Disable) or 1 (Enable)
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23WLC0&res=1
# Return: 200 OK "wLC0"

# Query the status: #WLC
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23WLC&res=1
# Return: 200 OK "wLC0"

# Set wireless remote controller ID: #RID[Data]
# [Data] - 0 to 3 (CAM1 to CAM4)
http://192.168.0.10/cgi-bin/aw_ptz?cmd=%23RID0&res=1
# Return: 200 OK "rID0"

Camera Information

There are a number of query strings to obtain the camera information. The following table indicates the query strings and their return values.

General information including camera model, serial number, MAC address, etc. can be obtained using the query string below.

# QUery URL:
http://username:password@192.168.10.24/cgi-bin/getinfo?FILE=1

# Return values:
MAC=4C-36-4E-28-12-34
SERIAL=F0TQJ1234
VERSION=V1.88
NAME=AW-HE40
SDrec=disable
SDrec2=disable
sAlarm=off
sAUX=off
ePort=31004
aEnable=in
aEnc=2
aBitrate=128
aBitrate2=64
aInInterval=20
aOutInterval=640
aOutPort=34004
aOutStatus=off
aOutUID=0
aInPort_h264=33004
aInPort_h264_2=33014
aInPort_h264_3=33024
aInPort_h264_4=33034
sRtspMode_h264=0
sRtspMode_h264_2=0
sRtspMode_h264_3=0
sRtspMode_h264_4=0
ImageCaptureMode=2m
ratio=16_9
Maxfps=25
StreamMode=1
iTransmit_h264=1
sDelivery_h264=uni
iBitrate_h264=6144
iResolution_h264=1920
iQuality_h264=low
iMultiAuto_h264=0
iTransmit_h264_2=1
sDelivery_h264_2=uni
iBitrate_h264_2=8192
iResolution_h264_2=1280
iQuality_h264_2=low
iMultiAuto_h264_2=0
iTransmit_h264_3=1
sDelivery_h264_3=uni
iBitrate_h264_3=4096
iResolution_h264_3=640
iQuality_h264_3=low
iMultiAuto_h264_3=0
iTransmit_h264_4=1
sDelivery_h264_4=uni
iBitrate_h264_4=4096
iResolution_h264_4=640
iQuality_h264_4=low
iMultiAuto_h264_4=0

Network information including IPv4 and IPv6 addresses, DNS, DHCP and Gateway can be obtained using the query string below.

# Query URL:
http://username:password@192.168.10.24/cgi-bin/network

# Return values:
ip4_dhcp=0
ip4_addr=192.168.10.24
ip4_netmask=255.255.255.1
ip4_gateway=192.168.10.1
ip4_pri_server=
ip4_sec_server=
port=80
dns=manual
ip6_auto=1
ip6_addr=
ip6_gateway=
ip6_pri_server=
ip6_sec_server=
ip6_dhcp=0
rtp_packet_max=1500
mss=1460
time=20
bandwidth=0

Camera Live Information including the power status, model name, camera title, video output format, last called preset, pan/tilt/zoom information, etc. can be obtained using the following query string.

# Query URL:
http://192.168.0.10/live/camdata.html

# Return values:
p1              # Power status
OID:AW-HE40     # Model number
CGI_TIME:0      # CGI send interval
OSA:87:0x11     # Video Format: 0x11: 1080/50p
TITLE:CAMERA_01 # Camera Title
OGU:0x80        # Gain: Auto
OTD:0x1E        # Pedestal: 0
OAW:0           # AWB Mode: ATW
OSH:0x0         # Shutter Mode: Off
ODT:1           # Detail: Off
OSF:3           # Scene: Full Auto
OBR:0           # Camera/ColorBar: Camera
sWZ1            # Speed with Zoom Pos: On
OSE:71:0        # Preset Mode: Mode A
iNS1            # Install Position: Hanging
OUS:0           # OSD: Off
d11             # Focus Mode: Auto
d31             # Iris Mode: Auto
s0              # Latest Call Preset No.: 1
OSA:30:89       # Total Detail Level: 9
d20             # ND Filter: 0
d60             # Option SW: Off
d40             # Lamp: 0
OSD:4F:F4       # Iris Follow: F4h
OER:0           # Error Notice (Not supported for AW-HE40)
rt1             # P/T Mode of Preset: 1 (fixed)
axz7A4          # Zoom Position: Wide (555h) to Tele (FFFh)
rER00           # Error Status Info.: No Error
axfDDD          # Focus Position: Near (555h) to Far (FFFh)
pE000000000007  # Preset Entry 001 to 040 (40-bit): Preset 1, 2 and 3 set 
pE010000000000  # Preset Entry 041 to 080 (40-bit):
pE020000000000  # Preset Entry 081 to 100 (40-bit):
uPVS500         # Preset Speed
lC10            # Tilt-Up Limitation Set: Release
lC20            # Tilt-Down Limitation Set: Release
lC30            # Pan-Left Limitation Set: Release
lC40            # Pan-Right Limitation Set: Release
ORG:0           # R Gain: -30
OBG:0           # B Gain: -30
OSD:B1:0x008    # Color Temperature
pST2            # Preset Speed Table: Fast
pRF0            # Freezing images during preset playback: Off
OIS:0           # Image Stablilization: Off
OSE:70:0        # Digital Zoom: Off
OSD:B3:1        # iZoom: On
ODE:0           # Digital Extender: Off

Video Stream

Stream No.URL
1rtsp://192.168.0.1/mediainput/h264/stream_1
2rtsp://192.168.0.1/mediainput/h264/stream_2
3rtsp://192.168.0.1/mediainput/h264/stream_3

Image Acquisition

Still Image:

Sequence of images:

Code Snippets

Capture a live image from the camera

Get Network Information

References

Panasonic official support website

The “Authentication Required to Create Managed Color Device” Problem

Create the following files under /etc/polkit-1/localauthority/50-local.d/

References

Change Default Username of Raspberry Pi

The Raspbian OS comes with a default username ‘pi’. For security reason, it is suggested to change the username. This article shows how to change it.

Since pi is the only account after the installation and we cannot change the account while it is logged in, we have to login as root. By default, the sulogon of root account is disabled. We enable it by the following steps:

Set a password for root

Open ssh configuration file

Find the line for PermitRootLogin and set it to yes

Restart the SSH service to apply changes:

Log out user pi and login with root

Change the default username:

Rename the home directory:

Change the group name:

Reboot and done.

To disable root login:

References

VPN without public IP using ZeroTier

I want to access my office network (192.168.1.0/24) from home. My office PC is behind NAT. It can access Internet, but no public IP is available for hosting a VPN server.  Here is how to use zerotier to setup a VPN channel for my home PC to connect to the office network.

Here is the configurations of the home and office PCs.

ItemHome PCOffice PC
Physical Network Interfaceens33eno1
IP address192.168.5.123192.168.1.89
Network192.168.5.0/24192.168.1.0/24

Installation

Install ZeroTier Client on both PCs using the following command:

If GPG is installed, here is the more secure way to install zerotier:

Go to https://www.zerotier.com/ to register an account. You will be given a Network ID, e.g. 17d70944892a9b2b.

On both PCs, join the network using the following command:

On the management webpage of ZeroTier, check the ‘Auth?’ of the two PCs.

After joining the network, a virtual network interface will be added

ItemHome PCOffice PC
Virtual Network Interfaceztks52g3qx ztks52g3qx
IP address192.168.191.34192.168.191.88
Network192.168.191.0/24192.168.191.0/24

Configure the ZeroTier managed route

At my.zerotier.com/network/ 17d70944892a9b2b -> Settings -> Managed Routes, add the following route:

Destination(via)
192.168.1.0/24
(Office Subnet)
192.168.191.88
(ZeroTier IP Address of “Router”)

Enabling IP forwarding

Configure the IP forwarding in the office PC.

To make the setting permanent, edit /etc/sysctl.conf to uncomment net.ipv4.ip_forward. This enables forwarding at boot.

Save iptables rules for next boot

References

  1. Zerotier
  2. Route between ZeroTier and Physical Networks