I am writing an android things app (dev preview 3) for the raspberry pi 3.
I am connecting the app to a wifi network and when I do a new Date() the time is correct (offset by the timezone - minutes/seconds correct) except for the timeZone which is being set to GMT+00:00 (i.e., timezone 0).
I want to deploy the device into households and need to automatically set their timezone, since I'm connecting to their wifi network, I assume the I should be able to know their timezone. Is this do able or is this just a problem with preview 3 and will be corrected in future releases of Android things?
Related
I’m running an app on raspberry. This raspberry is not connected to internet, and without RTC. So the raspberry datetime is random.
The app push data to GraphQL. So data are stored to the machine timestamp, witch is a random one.
Grafana is connected to GraphQL to read data.
Problem :
Data are stored at the datetime of the serveur, for example 2020-01-01 00h00m00s
Grafana get the datetime of the browser witch is sync with internet datetime, for example 2020-01-01 14h30m12s
My device is not connected to internet, but all apps (data producer app / InfluxDB / Grafana) are connected in localhost. The clock on my device is set randomly. It take probably the last known datetime ?
So data are stored at the datetime of device. But Grafana take the datetime of the browser (my phone / my pc) witch theirs datetime have been sync with UTC. When I tried t visualize data on Grafana, they are absent because they are stored at a datetime in the past.
Question :
How to say at Grafana to use server datetime and not browser one ?
My problem is not related with problem where data are store at UTC and Grafana at UTC+1.
I'm working on a project where I need to get data from a BLE environmental sensor onto a raspberry pi and send it to a server at regular intervals. The more often I can send, the better. I found a script online that works with the particular type of sensor that I'm working, but it only reads the data once and doesn't update unless some device connects and disconnects to the sensor.
So, for example, if I ran the script twice in a row it would contain the same data, but if I run the script once, then connected and disconnected from the sensor with my phone, then ran the script again, it would have new, updated data. Now, I'm trying to make this fully automated and don't want to have to keep connecting and disconnecting with my phone every time to get new data, so I've found that running gatttool and connecting has the same effect as if I were to connect and disconnect with my phone. So I've come up with a somewhat clunky solution of automation that all runs through crontab:
Run a script that connects and immediately disconnects from the sensor using gatttool
Run the data-collection script and send the data to the server
Repeat as soon as possible
Step 3 is where the issue lies. I can't run this series as often as I want. The ideal interval is to collect and send data every 30 seconds, but for some reason I intermittently get an error from gatttool:
connect error: Function not implemented (38)
I get this error on every iteration of the cron schedule until I set the interval so that the scripts only run every 2 minutes, and even then I'm intermittently getting the error. I need the data to be consistent and definitely not as sparse as 2 minutes apart. 1 minute would be the absolute max interval I can afford to have the data sent.
How can I get rid of this error?
My script to connect and disconnect from the device:
import pexpect
import time
print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
scan = pexpect.spawn("sudo hcitool lescan")
time.sleep(5)
print(scan.terminate())
child = pexpect.spawn("sudo gatttool -i hci0 -b E2:D8:9D:FF:72:A2 -I -t random")
child.sendline("connect")
child.expect("Connection successful", timeout=7)
print("connected!")
child.sendline("disconnect")
child.sendline("quit")
child.sendline("sudo hciconfig hci0 down")
child.sendline("sudo hciconfig hci0 up")
print("done!")
The script that you linked to at the start of your question does not seem to be connecting to the sensor. My understanding of their script is that it is scanning for the advertising data from the sensor which contains the measurement information. This is a common thing to do and there are many different types of beacons you can get.
I speculate that you are seeing more frequent measurements when you connect and disconnect because that is reseting the advertising as the sensor will not be advertising when you are connected.
On the front-page of the repo you linked to, there is some information about about how to change the measurement interval.
You said you wanted this to be every 30 seconds, so that would be a value of 1E that you would need to write to that characteristic.
They suggest an app to do this with. I have used that app and there is nothing specific about that app they point you towards. If you wanted alternatives, I find the nRF Connect app very good for these kinds of activities. If you have the Chrome or Chromium browser installed on your PC or Raspberry Pi, then you can do it from there if you enter the URL of:
chrome://bluetooth-internals/#devices
Press Start Scan -> Inspect the sensor device -> click on 0C4C3010-7700-46F4-AA96D5E974E32A54 service -> click on 0C4C3011-7700-46F4-AA96D5E974E32A54 characteristic -> enter the value (1E) -> press Write button.
This should allow you to use their original script with the frequency of measurement you want.
Our team is faced with a delimma where we need to at app-run time, detect (and then make an action) when a mobile device connection is made with Firebase. Our app needs to store value locally to SQL Lite when offline, and then push these cached values back up to the realtime-database in Firebase when the connection is restored. Presently this re-connection to Firebase is only happening with our App is shutdown and restarted.
It seems that (at least with typescript) everything is governed by the app.component.ts file. Is there a way to force the '.info/connected' to be true when the device network connection comes back .. and do this while our app is still running (memory on the mobile)?
I'm trying out the sample applications provided together with the PingFederate .NET Integration Kit. I was able to make it work for the Single Server set-up (my machine served as both the IdP and the SP).
But when I tried setting up two machines like it was specified in this link:
https://documentation.pingidentity.com/display/NETIK/Deploying+the+Sample+Applications
A more realistic scenario is to deploy the applications on a separate IIS server machine
I was able to edit the Adapter Instance and the Default URL but there's this problem of clock skew between servers
Verify that your server clocks are synchronized. If they are not synchronized, you can account for this by adjusting the Not Before Tolerance value in the OpenToken adapter configuration, which is the amount of time (in seconds) to allow for clock skew between servers. The default and recommended value is 0.
I checked the possible values and the max is 3600 seconds.
Question: What if my server has more than an hour of time difference? Is that set-up still possible? (Servers are actually on different time zones.)
The OpenToken uses GMT, so timezones are taken out of the picture - as long as your server is set to the proper time, and actual proper timezone for where it is, it should work just fine. For example, you can have serverA in New York City, and serverB in Los Angeles. If serverA is set to Eastern Time, and serverB is set to Pacific Time, then the OpenToken will work - since it converts times to GMT, the times on the token will be the "same".
Hope that makes sense - I need another cup of coffee this morning. :)
I developed a MFC application in C++ which I use to capture data from some USB sensors in order to save the information in a TXT file. For each data, I also save the timestamp with boost function.
I need to use my application also with another pc since I have to acquire data twice and I'd like to know what's the best method to synchronize the data between these two pcs.
I'm using the first pc to create a Wifi network and I'm able to connect the second pc to the first one and then I'm trying to use "net time" to set the NTP service without success.
Is there any tutorial or someone which can explain me how to synchronize date time between two Win7 pcs, please?
Perhaps this command? Run from the cmd prompt.
net time \\MasterPC /set /yes
where MasterPC is the network name of the computer you want to take the time from.