Created
October 7, 2019 19:50
-
-
Save elizabethn119/c1ab0313c57d1cd5e2f3e3fed32cd7d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
import time | |
from ISStreamer.Streamer import Streamer | |
streamer = Streamer(bucket_name="Temperature Stream", bucket_key="piot_temp_stream031815", access_key="PUT_YOUR_ACCESS_KEY_HERE") | |
os.system('modprobe w1-gpio') | |
os.system('modprobe w1-therm') | |
base_dir = '/sys/bus/w1/devices/' | |
device_folder = glob.glob(base_dir + '28*')[0] | |
device_file = device_folder + '/w1_slave' | |
def read_temp_raw(): | |
f = open(device_file, 'r') | |
lines = f.readlines() | |
f.close() | |
return lines | |
def read_temp(): | |
lines = read_temp_raw() | |
while lines[0].strip()[-3:] != 'YES': | |
time.sleep(0.2) | |
lines = read_temp_raw() | |
equals_pos = lines[1].find('t=') | |
if equals_pos != -1: | |
temp_string = lines[1][equals_pos+2:] | |
temp_c = float(temp_string) / 1000.0 | |
return temp_c | |
while True: | |
temp_c = read_temp() | |
temp_f = temp_c * 9.0 / 5.0 + 32.0 | |
streamer.log("temperature (C)", temp_c) | |
streamer.log("temperature (F)", temp_f) | |
time.sleep(.5) |
Author
elizabethn119
commented
Jan 24, 2022
via email
Hi,
I don’t have any example code for multiple sensors. It would require some tinkering to make it work with multiple sensors and we just haven’t done that yet.
Thanks,
Elizabeth Adams
Product Evangelist, Initial State
***@***.***
… On Jan 24, 2022, at 7:09 AM, lampe208 ***@***.***> wrote:
@lampe208 commented on this gist.
Hi, im totally lost in the code. I have the exact same request. I have one sensor , works great. I want to add another sensor. I tried to follow that code and add your things,..but I get lost in it. Can you give me a different pasted code I can just cut and paste and then enter my serial numbers manually.. ? Thanks tom.
—
Reply to this email directly, view it on GitHub <https://gist.github.com/c1ab0313c57d1cd5e2f3e3fed32cd7d3#gistcomment-4039713>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKILQXFTL34JSU2K7HV75TLUXVMQLANCNFSM4QAJNFFA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.
so the code that you wrote in that email doesn’t work then?
On Mon, Jan 24, 2022 at 12:08 Elizabeth Adams ***@***.***>
wrote:
***@***.**** commented on this gist.
------------------------------
Hi,
I don’t have any example code for multiple sensors. It would require some
tinkering to make it work with multiple sensors and we just haven’t done
that yet.
Thanks,
Elizabeth Adams
Product Evangelist, Initial State
***@***.***
> On Jan 24, 2022, at 7:09 AM, lampe208 ***@***.***> wrote:
>
> @lampe208 commented on this gist.
> Hi, im totally lost in the code. I have the exact same request. I have
one sensor , works great. I want to add another sensor. I tried to follow
that code and add your things,..but I get lost in it. Can you give me a
different pasted code I can just cut and paste and then enter my serial
numbers manually.. ? Thanks tom.
>
> —
> Reply to this email directly, view it on GitHub <
https://gist.github.com/c1ab0313c57d1cd5e2f3e3fed32cd7d3#gistcomment-4039713>,
or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AKILQXFTL34JSU2K7HV75TLUXVMQLANCNFSM4QAJNFFA
>.
> Triage notifications on the go with GitHub Mobile for iOS <
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android <
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
> You are receiving this because you authored the thread.
>
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/c1ab0313c57d1cd5e2f3e3fed32cd7d3#gistcomment-4040102>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AWFCVMQS2V7LNCRYQK7GSRDUXWITXANCNFSM4QAJNFFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Sent from Gmail Mobile
Hi,
I may have misunderstood. Are you saying the code as is does not work?
Thanks,
Elizabeth Adams
Product Evangelist, Initial State
***@***.***
… On Jan 24, 2022, at 7:27 PM, lampe208 ***@***.***> wrote:
@lampe208 commented on this gist.
so the code that you wrote in that email doesn’t work then?
On Mon, Jan 24, 2022 at 12:08 Elizabeth Adams ***@***.***>
wrote:
> ***@***.**** commented on this gist.
> ------------------------------
> Hi,
>
> I don’t have any example code for multiple sensors. It would require some
> tinkering to make it work with multiple sensors and we just haven’t done
> that yet.
>
> Thanks,
> Elizabeth Adams
> Product Evangelist, Initial State
> ***@***.***
>
>
>
> > On Jan 24, 2022, at 7:09 AM, lampe208 ***@***.***> wrote:
> >
> > @lampe208 commented on this gist.
> > Hi, im totally lost in the code. I have the exact same request. I have
> one sensor , works great. I want to add another sensor. I tried to follow
> that code and add your things,..but I get lost in it. Can you give me a
> different pasted code I can just cut and paste and then enter my serial
> numbers manually.. ? Thanks tom.
> >
> > —
> > Reply to this email directly, view it on GitHub <
> https://gist.github.com/c1ab0313c57d1cd5e2f3e3fed32cd7d3#gistcomment-4039713>,
> or unsubscribe <
> https://github.com/notifications/unsubscribe-auth/AKILQXFTL34JSU2K7HV75TLUXVMQLANCNFSM4QAJNFFA
> >.
> > Triage notifications on the go with GitHub Mobile for iOS <
> https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android <
> https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> > You are receiving this because you authored the thread.
> >
>
> —
> Reply to this email directly, view it on GitHub
> <https://gist.github.com/c1ab0313c57d1cd5e2f3e3fed32cd7d3#gistcomment-4040102>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AWFCVMQS2V7LNCRYQK7GSRDUXWITXANCNFSM4QAJNFFA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
--
Sent from Gmail Mobile
—
Reply to this email directly, view it on GitHub <https://gist.github.com/c1ab0313c57d1cd5e2f3e3fed32cd7d3#gistcomment-4040585>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKILQXDFEO5DGMXUQRM23T3UXYC7PANCNFSM4QAJNFFA>.
Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment