How to fix disabling pair setup using HomeKit-ESP8266 libary with NodeMcu esp8266 - esp8266

This is my Serial Monitor of Arduino IDE:
WiFi connected, IP: *My Ip*
>>> [ 5079] HomeKit: Update the CPU to run at 160MHz
>>> [ 5087] HomeKit: Starting server
>>> [ 5091] HomeKit: Using existing accessory ID: *ID*
>>> [ 5097] HomeKit: Found admin pairing with *Some characters*, disabling pair setup
>>> [ 5106] HomeKit: Configuring MDNS
>>> [ 5111] HomeKit: MDNS begin: Temperature, IP: *My IP*
>>> [ 5118] HomeKit: Init server over
I want to connect it to my Apple Homkit but it's not showing up.

Related

Cannot connect to TWS using IBrokers with R

library(IBrokers)
tws <- twsConnect(port=7496)
Error in socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
cannot open the connection
In addition: Warning message:
In socketConnection(host = host, port = port, open = "ab", blocking = blocking) :
localhost:7496 cannot be opened
I have checked my Global Configurations in the TWS. The port is in fact 7496.
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] IBrokers_0.9-12 xts_0.12-0 zoo_1.8-8
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3 grid_3.6.3 lattice_0.20-40
I am using the latest of Linux Mint. My IB account has been approved and funded.

AWS IoT: Use MQTT on port 443

I am trying to setup AWS IoT in Pi on port 443 using Paho MQTT .
As AWS document (https://docs.aws.amazon.com/iot/latest/developerguide/protocols.html) mentioned that
Clients wishing to connect using MQTT with X.509 Client Certificate authentication on port 443 must implement the Application Layer Protocol Negotiation (ALPN) TLS extension and pass x-amzn-mqtt-ca as the ProtocolName in the ProtocolNameList.
I actually don't know how to achieve it properly in Paho MQTT (https://github.com/eclipse/paho.mqtt.python)
What I tried to do (mqtt_apln.py)
import sys
import ssl
import time
import datetime
import logging, traceback
import paho.mqtt.client as mqtt
MQTT_TOPIC = "topictest"
MQTT_MSG = "hello MQTT"
IoT_protocol_name = "x-amzn-mqtt-ca"
aws_iot_endpoint = "xxxxxxx.iot.eu-west-1.amazonaws.com"
url = "https://{}".format(aws_iot_endpoint)
ca = ".xxxxx/rootCA.pem"
cert = ".xxxxx/xxxxx-certificate.pem.crt"
private = ".xxxxx/xxxxxx-private.pem.key"
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
log_format = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(log_format)
logger.addHandler(handler)
# Define on connect event function
# We shall subscribe to our Topic in this function
def on_connect(mosq, obj, rc):
mqttc.subscribe(MQTT_TOPIC, 0)
# Define on_message event function.
# This function will be invoked every time,
# a new message arrives for the subscribed topic
def on_message(mosq, obj, msg):
print "Topic: " + str(msg.topic)
print "QoS: " + str(msg.qos)
print "Payload: " + str(msg.payload)
def on_subscribe(mosq, obj, mid, granted_qos):
print("Subscribed to Topic: " +
MQTT_MSG + " with QoS: " + str(granted_qos))
def ssl_alpn():
try:
#debug print opnessl version
logger.info("open ssl version:{}".format(ssl.OPENSSL_VERSION))
ssl_context = ssl.create_default_context()
ssl_context.set_alpn_protocols([IoT_protocol_name])
ssl_context.load_verify_locations(cafile=ca)
ssl_context.load_cert_chain(certfile=cert, keyfile=private)
return ssl_context
except Exception as e:
print("exception ssl_alpn()")
raise e
mqttc = mqtt.Client()
# Assign event callbacks
mqttc.on_message = on_message
mqttc.on_connect = on_connect
mqttc.on_subscribe = on_subscribe
ssl_context= ssl_alpn()
mqttc.tls_set_context(context=ssl_context)
logger.info("start connect")
mqttc.connect(aws_iot_endpoint, port=443)
logger.info("connect success")
mqttc.loop_start()
In Pi, I installed python 2.7.14 and paho-mqtt
But When I run python mqtt_apln.py, it shows error: ImportError: No module named paho.mqtt.client
Any suggestion is appreciated
I think there are two things going on here. First, a pip install paho-mqtt should make the package active for the current referenced python. For instance, under a 3.6.2 virtualenv should return:
$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your
pip.conf under the [list] section) to disable this warning.
paho-mqtt (1.3.1)
pip (9.0.1)
setuptools (28.8.0)
How did you install the paho-mqtt package, via an apt package or directly with pip? Personally I virtualenv everything or include the package within the application directory via pip install package_name -t . to reference the current working directory.
From there it's working with the ALPN configuration. I reduced your code to just publish to the test topic on my end-point and used the AWS IoT console-->Test to subscribe to the test topic. For both python 2.7.12 and 3.6.2 I successfully received messages.
The main changes were to remove the callbacks, place a mqttc.publish followed by a time.sleep(3) to give the thread time to publish, then closed the connection.
Here is the code paired down for the publish only:
import sys
import ssl
import time
import datetime
import logging, traceback
import paho.mqtt.client as mqtt
MQTT_TOPIC = "topictest"
MQTT_MSG = "hello MQTT"
IoT_protocol_name = "x-amzn-mqtt-ca"
aws_iot_endpoint = "xxxxxx.iot.us-east-1.amazonaws.com"
ca = "ca.pem"
cert = "xxxx-certificate.pem.crt"
private = "xxxx-private.pem.key"
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
log_format = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(log_format)
logger.addHandler(handler)
def ssl_alpn():
try:
#debug print opnessl version
logger.info("open ssl version:{}".format(ssl.OPENSSL_VERSION))
ssl_context = ssl.create_default_context()
ssl_context.set_alpn_protocols([IoT_protocol_name])
ssl_context.load_verify_locations(cafile=ca)
ssl_context.load_cert_chain(certfile=cert, keyfile=private)
return ssl_context
except Exception as e:
print("exception ssl_alpn()")
raise e
mqttc = mqtt.Client()
ssl_context= ssl_alpn()
mqttc.tls_set_context(context=ssl_context)
logger.info("start connect")
mqttc.connect(aws_iot_endpoint, port=443)
logger.info("connect success")
mqttc.loop_start()
# After loop start publish and wait for message to be sent.
# Hard coded delay but would normally tie into event loop
# or on_publish() CB
# JSON payload because, pretty
mqttc.publish('test', '{"foo": "bar"}')
time.sleep(3)
mqttc.loop_stop()
Please let me know if that works for you? It's awesome that AWS now supports MQTT connections on port 443 without having to utilize websockets (and the need for SigV4 credentials).
I ran into the same issue regarding the use of paho-mqtt with aws IoT core.
https://aws.amazon.com/de/blogs/iot/how-to-implement-mqtt-with-tls-client-authentication-on-port-443-from-client-devices-python/
The tutorial uses no clientID. Depending on your security rules you have to deliver a client ID to be able to connect properly. Here an SDK-example ruleset where only the clients "sdk-java", "basicPubSub" and "sdk-nodejs-*" are allowed to connect.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Publish",
"iot:Receive"
],
"Resource": [
"arn:aws:iot:eu-central-1:036954049003:topic/sdk/test/java",
"arn:aws:iot:eu-central-1:036954049003:topic/sdk/test/Python",
"arn:aws:iot:eu-central-1:036954049003:topic/topic_1",
"arn:aws:iot:eu-central-1:036954049003:topic/topic_2"
]
},
{
"Effect": "Allow",
"Action": [
"iot:Subscribe"
],
"Resource": [
"arn:aws:iot:eu-central-1:036954049003:topicfilter/sdk/test/java",
"arn:aws:iot:eu-central-1:036954049003:topicfilter/sdk/test/Python",
"arn:aws:iot:eu-central-1:036954049003:topicfilter/topic_1",
"arn:aws:iot:eu-central-1:036954049003:topicfilter/topic_2"
]
},
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"arn:aws:iot:eu-central-1:036954049003:client/sdk-java",
"arn:aws:iot:eu-central-1:036954049003:client/basicPubSub",
"arn:aws:iot:eu-central-1:036954049003:client/sdk-nodejs-*"
]
}
]
}
To allow connection in case you have permits based on clientid change this line:
mqttc = mqtt.Client(client_id=MYCLIENTID)
MYCLIENTID is one of the three "sdk-java", "basicPubSub" or "sdk-nodejs-*" for this example.

Intel Edison + Ubilinux + USB to UART = USB Device not created

Dear community members,
We are working in the development of a robot autonomous control system running inside an Intel Edison, which -in turn- runs in a PixHawk automatic pilot module . This system uses ROS (Robot Operating System) and therefore we had to install Ubilinux. Our system requires being connected with a 360-degree laser (RPLIDAR-360) that sends data through a serial channel, so we are trying to get laser's data through USB-to-UART adapter (Silicon lab's CP2102) (the PixHawk only has a USB available for data transfer).
In summary, the laser is connected to the USB2UART adapter, and the adapter is connected to Edison's serial port.
However, we are stuck with some kind of driver issue. When tracing 'dmesg' the device is detected (idVendor=10c4, idProduct=ea60):
[ 917.812195] usb usb2: Product: xHCI Host Controller
[ 917.812214] usb usb2: Manufacturer: Linux 3.10.17-yocto-standard-r2 dwc-xhci
[ 917.812232] usb usb2: SerialNumber: dwc3-host.2
[ 917.812858] xHCI xhci_add_endpoint called for root hub
[ 917.812878] xHCI xhci_check_bandwidth called for root hub
[ 917.813141] hub 2-0:1.0: USB hub found
[ 917.813185] hub 2-0:1.0: 1 port detected
[ 918.128982] usb 1-1: new full-speed USB device number 2 using dwc3-host
[ 918.151786] usb 1-1: New USB device found, idVendor=10c4, idProduct=ea60
[ 918.151818] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 918.151839] usb 1-1: Product: CP2102 USB to UART Bridge Controller
[ 918.151857] usb 1-1: Manufacturer: Silicon Labs
[ 918.151875] usb 1-1: SerialNumber: 0001
With the following details:
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=10c4 ProdID=ea60 Rev= 1.00
S: Manufacturer=Silicon Labs
S: Product=CP2102 USB to UART Bridge Controller
S: SerialNumber=0001
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
But no /dev/ttyUSBX device is created, and there are no error messages about missing Drivers or configuration failures.
We are using Ubilinux 3, which reports the following with the 'uname' command:
** 3.10.17-yocto-standard-r2
And the following is the listing of the installed drivers:
usb
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/media/usb:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/media/usb/gspca:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/media/usb/uvc:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/usb:
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/usb/gadget:
usb_f_acm.ko
/lib/modules/3.10.17-yocto-standard-r2/kernel/drivers/usb/serial:
usb_wwan.ko
Does anyone has had a similar configuration and managed to make work a CP2102 adapter?
As a last resort, we are trying to compile and install the driver by ourselves, using this reference: [url=https://askubuntu.com/questions/941594/installing-cp210x-driver]Installing CP210x Driver?Installing CP210x Driver? - Ask Ubuntu[/url]
The 'make' process crashes due to a lack of headers. We were unable to download the headers through APT, but at the end, we managed to compile the '.ko' module by downloading the headers manually from a Website.
However, after doing:
insmod cp210x.ko
We got:
Insmod: ERROR: could not insert module cp210x.ko: Invalid module format
So, at this point we have several questions... any advice about any of them would be really appreciated:
Does anybody know how to install the Kernel headers in Ubilinux - 3.10.17?
What is the official procedure to upgrade the Kernel in Ubilinux?, we already have ROS working on the board... do you think a kernel upgrade could mess our ROS configuration?
In general, do you have any successful experience in the configuration of a cp210x device?
Thanks in advance,
Héctor
The driver for cp2102 already exist in kernel, no need of extra efforts. Just use the correct udev rule file (not present by default in linux distro). An example is here. With this file /dev/ttyUSBX will be created.

ESP8266 AT commands working but Fatal on NodeMCU

Hardware: ESP8266-1
Settings in IDE
Module: ESP8266-1
Flash Size: 4MB
Flash Mode: DIO
Flash Speed: 40Mhz
Upload Using: Arduino FTDI Serial
Firmware installed :
nodemcu_integer_0.9.5_20150318.bin : 0X00000
(Also tried with latest firmware nodemcu_integer_0.9.6-dev_20150627.bin)
Error : (Esplorer)
PORT OPEN 115200
Communication with MCU…
……….
……….
Got answer! AutoDetect firmware…
Communication with MCU established.
Can’t autodetect firmware, because proper answer not received (may be unknown firmware).
Please, reset module or continue.
Fatal exception (0):
epc1=0x40210880, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
Fatal exception (0):
epc1=0x40210880, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
PS : I'm using a separate 3.3V power supply from beaglebone.
I'm able to flash the module with NoduMCU (above settings without any error)
Module works fine with AT commands
boot_v1.6.bin : 0X00000
esp_init_data_default.bin : 0XFC000
blank.bin : 0XFE000
user1.1024.new.2.bin : 0x1000
But not able to program Lua in my module.
Please help!!!

Android Unable to register Appium to selenium grid on windows

I am trying to register Appium to local Selenium grid. Below are my steps:
I am able to access grid console at
http://localhost:4444/grid/console
I created below configuration json file:-
{ "capabilities": [{ "browserName": "Android", "version": "4.4.2",
"maxInstances": 1, "platform": "Android", "deviceName":
"4d0002174dca3161", }], "configurations": { "cleanUpCycle": 2000,
"timeout": 30000, "proxy":
"org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "host":
"127.0.0.1", "port": 4723, "url": "http://127.0.0.1:4723/wd/hub",
"maxSession": 1, "register": true, "registerCycle": 5000, "hubPort":
4444, "hubHost": "127.0.0.1", "hub":
"http://127.0.0.1:4444/grid/register" } }
The deviceName is from:
"adb devices" command
When I started Appium with command
appium --nodeconfig C:\mobile\androidConfig.json
I am getting an exception:
info: Welcome to Appium v1.3.4 (REV
c8c79a85fbd6870cd6fc3d66d038a115ebe22efe) info: Appium REST http
interface listener started on 0.0.0.0:4723 info: [debug] Non-default
server args: {"nodeconfig":"C:\mobile\androidConfig. json"} info:
Console LogLevel: debug error: uncaughtException: Cannot read property
'url' of undefined date=Tue Feb 1 0 2015 15:08:52 GMT+0200 (South
Africa Standard Time), pid=8644, uid=null, gid=n ull,
cwd=C:\Users\administrator\AppData\Roaming\npm\node_modules\appium,
execPath=C:\Pr ogram Files\nodejs\node.exe, version=v0.10.30,
argv=[node, C:\Users\administrator\AppDa
ta\Roaming\npm\node_modules\appium\bin\appium.js, -p, 4723,
--nodeconfig, C:\mob ile\androidConfig.json], rss=45649920, heapTotal=35002496, heapUsed=23290972, lo adavg=[0, 0, 0],
uptime=11049.0117945, trace=[column=32, file=C:\Users\administrator\Ap
pData\Roaming\npm\node_modules\appium\lib\server\grid-register.js,
function=post Request, line=46, method=null, native=false, column=7,
file=C:\Users\administrator\AppD
ata\Roaming\npm\node_modules\appium\lib\server\grid-register.js,
function=null, line=14, method=null, native=false, column=14,
file=fs.js, function=null, line=2 71, method=null, native=false,
column=15, file=fs.js, function=Object.oncomplete , line=107,
method=oncomplete, native=false], stack=[TypeError: Cannot read prop
erty 'url' of undefined, at postRequest
(C:\Users\administrator\AppData\Roaming\npm
\node_modules\appium\lib\server\grid-register.js:46:32), at
C:\Users\administrator\
AppData\Roaming\npm\node_modules\appium\lib\server\grid-register.js:14:7,
at fs.js:271:14, at Object.oncomplete (fs.js:107:15)]
What am I doing wrong?
Thanks.
Ok, It was a silly typo.
“configurations” node was incorrectly written. It should be configuration “without an s”. In addition, on the platform side, it should be MAC or WINDOWS
node got successfully registered to the Grid after above changes.

Resources