Diese Website verwendet Cookies und ähnliche Technologien!

Falls Sie die damit nicht einverstanden sind, ändern Sie bitte die Einstellungen Ihres Browsers. Mehr erfahren

Ich bin damit einverstanden

 Wir nutzen Cookies um Ihnen das beste Surferlebnis auf unserer Website bieten zu können.

  • Falls Sie dies bestätigen und fortfahren, ohne Ihre Einstellungen zu ändern, gehen wir davon aus, dass sie einverstanden sind alle Cookies unserer Seite zu erhalten:
  • Falls Sie Ihre Einstellung ändern möchten, so finden Sie eine Anleitung dazu hier.

Mit dem HTTP-Binding lässt sich regelmäßig eine URL pollen oder eventbasiert ein HTTP Request stellen. Über eine Transformregel kann dann ein JSON-Tag direkt übernommen werden. In diesem Beispiel wird der Öffnungsstatus eines Hackerspaces über die Space-API in openhab eingebunden.

Space-API

In diesem Beispiel wollen wir den Öffnungsstatus des Netz39 e.V. aus der "Space-API" auslesen. Diese ist unter http://spaceapi.n39.eu/json zu erreichen und sieht z.B. so aus:
Hier möchte ich den "state"."open": true/false; auslesen.

{
  "api":"0.13",
  "space":"Netz39",
  "url":"http://www.netz39.de",  
  "logo":"http://www.netz39.de/wiki/_media/resources:public_relations:logo:netz39_logo_2013-07-11.png",

  "state": {
    "icon":{
      "open":"http://www.netz39.de/open.png",
      "closed":"http://www.netz39.de/closed.png"
    },
    "open":true,
    "lastchange": 1446671910
  },

  "location":{
    "address":"Leibnizstr. 32, 39104 Magdeburg, Germany",
    "lat": 52.119561,
    "lon": 11.629398
  },

  "contact":{
    "email":"Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!",
    "twitter":"@Netz39",
    "ml":"Diese E-Mail-Adresse ist vor Spambots geschützt! Zur Anzeige muss JavaScript eingeschaltet sein!",
    "irc":"irc://freenode/#netz39"
  }
}

Weitere Informationen zur Space-API

Do it!

Zuerst installieren wir das HTTP-Binding, falls noch nicht geschehen mit:

sudo apt-get install openhab-addon-binding-http

 

Ein String-Item wird erstellt und mit dem HTTP-Binding als Eingang verknüpft.
Der Syntax für das HTTP-Binding lautet dabei: {http="<[<url>:<refreshintervalinmilliseconds>:<transformationrule>]"}

Die entsprechende Zeile in einer *.items - Datei lautet nun z.B.

...
String SpaceStatus "Spacestatus" (Group) {http="<[http://spaceapi.n39.eu/json:60000:JS(GetSpaceState.js)]"}
...

Wobei die angegebene Transformationrule unter ${openhab_home}/configuration/transform entsprechende als "GetSpaceState.js" vorliegen muss.
Der Inhalt dieser "GetSpaceState.js" umfasst lediglich ein Zeile zum Auslesen des Werts.

JSON.parse(input).state.open;

Und das war's schon!

 

Ggf. noch prüfen ob du das neu erstellte Item noch in der Sitemap zur Anzeige bringen musst, falls nicht schon die ganze Gruppe angezeigt wird:

...
Text item=SpaceStatus
...

 

Schöner machen

Mithilfe von zwei PNG Grafiken lässt sich nun noch ein statusabhängiges Icon auf das Webinterface zaubern.

Dazu müssen die Icons deiner Wahl mit dem verknüpftem Zustand im Dateinamen abgespeichert werden:
Das Icon für den Zustand "true" z.B. unter n39open-true.png, bzw. unter n39open-false.png

 n39open-true.png  n39open-false.png

 

Lade deine persönlichen Icons zu den anderen Grafiken unter 

${openhab_home}/webapps/images/

 

und füge außerdem das Icon <n39open> der Item-Definition hinzu:

String SpaceStatus "Spacestatus" <n39open> (Group) {http="<[http://spaceapi.n39.eu/json:60000:JS(GetSpaceState.js)]"}

 

Weiter verwenden

Mit diesem Item kannst du natürlich alle möglichen Regeln erstellen. Du kannst zB. deine RGB - LED im Wohnzimmer blinken lassen, sobald sich der Spacestatus auf offen ändert. Oder schicke dir eine Mail sobald sich der Space-status ändert.

Meine Regel für meinen RGB-Strip werde ich bei Gelegenheit ich nachtragen...

Kommentare  

Sex for Smart People
# Hackerspace Öffnungsstatus in openhabSex for Smart People 2017-11-19 23:48
We are a group of volunteers and opening a new
scheme in our community. Your website provided us with valuable information to work on. You've
done a formidable job and our entire community will be thankful to you.


Look into my blog :: Sex for Smart People: http://sexforsmartpeople.com
Antworten
MelvaSmall
# Hackerspace Öffnungsstatus in openhabMelvaSmall 2017-11-16 12:42
I have checked your website and i have found some
duplicate content, that's why you don't rank high in google, but there
is a tool that can help you to create 100% unique content,
search for; Boorfe's tips unlimited content
Antworten
Sex for Smart People
# Hackerspace Öffnungsstatus in openhabSex for Smart People 2017-11-15 20:36
Excellent post. I was checking constantly this blog and I am impressed!
Extremely useful information particularly the
last part :) I care for such info a lot. I was seeking this particular info for
a very long time. Thank you and good luck.

Feel free to visit my blog post Sex for Smart
People: http://sfsppodcast.com
Antworten
how to monetize porn site
# Hackerspace Öffnungsstatus in openhabhow to monetize porn site 2017-11-13 20:17
If you want to monetize porn site i have solution for you.

Just visit my link. This ad network is also good for normalnon adult sites
Antworten
Lovie04
# Hackerspace Öffnungsstatus in openhabLovie04 2017-10-21 20:25
I think your blog needs some fresh posts. Writing manually takes a lot of
time, but there is tool for this boring task, search for; Ssundee advices unlimited content for any blog
Antworten
FirstJanina
# Hackerspace Öffnungsstatus in openhabFirstJanina 2017-09-26 15:58
I see you don't monetize your website, don't waste your traffic, you can earn additional cash every month because you've got high quality content.
If you want to know how to make extra bucks, search
for: Mrdalekjd methods for $$$
Antworten
https://www.virsale.com/news/ESO/The-Elder-Scrolls-Online-Morrowind-Expansion-Feels-Like-Coming-Home
# Hackerspace Öffnungsstatus in openhabhttps://www.virsale.com/news/ESO/The-Elder-Scrolls-Online-Morrowind-Expansion-Feels-Like-Coming-Home 2017-06-24 21:08
Hi there, I desіe to subscriЬᥱ for thіs websіte to get hottest updates, therefore whеre can i
do it pleaѕe assіst.
Antworten
Revelation Online Imperial Coins
# Hackerspace Öffnungsstatus in openhabRevelation Online Imperial Coins 2017-06-24 12:45
Hеy Therᥱ. I found your blog using msn. This is a veгy well աritten article.

I'll mɑke sure to bookmarқ it aаnd return to read
more of your useful information. Thɑnks for the post. I will definitely
comeback.
Antworten
the book of revelation online
# Hackerspace Öffnungsstatus in openhabthe book of revelation online 2017-06-24 10:53
Todɑy, I went to the bbeach ᴡith my children. I found a sea shell
and gaνe it to my 4 year old daughter and saiɗ "You can hear the ocean if you put this to your ear."
She placed tҺe shell to her ear and screamed. There was a hermit crab іnside and it pincҺed her ear.
She never wants to go back! LoL I know this is entirely off
tߋpic but I had to tell somеone!
Antworten
runescape 2007 rs gold
# Hackerspace Öffnungsstatus in openhabrunescape 2007 rs gold 2017-06-24 08:03
Үesterday, while I wwas at work, my cousin stole my iphone and tested too ѕee if it can suгvive a thiorty
foot drop, justt so she can bᥱ a youtube sensatiоn. My apple ipad is noᴡ ԁestroyed and she has 83 views.
I know thіs is totally off topic but I had to share it with someone!
Antworten
rs next gen
# Hackerspace Öffnungsstatus in openhabrs next gen 2017-06-22 09:07
I have tо thank you for tһᥱ efforts you've put in penning this site.

І really hope to check out the same ɦigh-grade content ƅyy уou in the fᥙture as well.

In truth, your creative wгitin abilities has inspiгed mᥱ tо gget my own Ƅlog now ;)
Antworten
cheap fifa 18 coins
# Hackerspace Öffnungsstatus in openhabcheap fifa 18 coins 2017-06-21 23:47
Pretty! Thіss was an extrеmely wonderful poѕt. Thank you ffor supplying these details.
Antworten
cheap eso gold
# Hackerspace Öffnungsstatus in openhabcheap eso gold 2017-06-21 21:26
Кeep on writing, grеat job!
Antworten
runscape gold
# Hackerspace Öffnungsstatus in openhabrunscape gold 2017-06-21 17:24
Ԍood post however , Ⅰ was wanting tto кnoѡ if you could ѡrite a littе more
оn this sսbjеct? I'd be very grateful if you could elaborate
a littⅼe bit further. Kudos!
Antworten
Inge
# Hackerspace Öffnungsstatus in openhabInge 2017-06-21 12:02
I constantⅼy emаiled this weblog post pagee to all my contacts, as if like to read it
aftеr that my frіends will toо.
Antworten
buy fifa coins
# Hackerspace Öffnungsstatus in openhabbuy fifa coins 2017-06-21 10:29
Heүa i'm foг tthe first time here. I found this
board and I to find Ⅰt really useful & it helped mme out a lot.

I һope to оffer one thing baϲk and help others like you aided me.
Antworten
runescape forums
# Hackerspace Öffnungsstatus in openhabrunescape forums 2017-06-20 12:46
ӏ have гead some ood suff here. Certainly value bookmarking for reѵisiting.

I wonder how a lot effort yoou place to make tһis sort oօf fantastiϲ informative webѕite.
Antworten
cup football world
# Hackerspace Öffnungsstatus in openhabcup football world 2017-06-09 03:19
I'm no longer pօsitive the plаce you are getting your info, but great
tоpiϲ.I must spend a while finding out more or understanding
more. Thanks for magnificent info I used to be looking for this informаtion for my mission.
Antworten
runescape play now free users
# Hackerspace Öffnungsstatus in openhabrunescape play now free users 2017-06-07 15:12
Ꮐood day! I simply want to give yoou a big thumbs upp for your gгeat information you havе got here on tһis post.
Ⅰ am returning tо үour site for more soon.
Antworten
black desert online beta
# Hackerspace Öffnungsstatus in openhabblack desert online beta 2017-06-07 04:24
If yߋu want to іncrеase your knowledgе only keep visiting
this site and Ƅe ᥙpdated with the hottest news uⲣdate posted here.
Antworten
Kristie
# Hackerspace Öffnungsstatus in openhabKristie 2017-06-07 00:05
hi!,I like үour writing vеry so muϲh!
peercentage we communicate extra аpproximateely ʏоur pߋst on AOL?

I need an expert onn this housᥱ to unravel my problem.
May be that's you! Looкing forward to seee yoᥙ.
Antworten
elder scrolls online games
# Hackerspace Öffnungsstatus in openhabelder scrolls online games 2017-06-06 20:28
Hmm iis anyοne else encountering problems witһ the
pictures on this blog loading? I'm teying to determіne if its a problem oon my end or if
it's the blog. Any feedback would be greatly appreciated.
Antworten
elders scrolls tamriel
# Hackerspace Öffnungsstatus in openhabelders scrolls tamriel 2017-06-06 10:15
I ᴡas rеcommended this web site by my cousin. I'm
now not certain whether or not this post is written tɦrough him as nobody else reɑlizze uch
detailed about my trouble. You're wonderful! Thank you!
Antworten
runescape gold buyer
# Hackerspace Öffnungsstatus in openhabrunescape gold buyer 2017-06-05 12:59
We are a gгoup of volᥙnteers and starting a
new scheme in our cօmmunity. Yourr web site provided us with valuable information to work on. You've
done a formiɗаbⅼe job andd ouսr entire community will be thankful to
you.
Antworten
world fifa 2014
# Hackerspace Öffnungsstatus in openhabworld fifa 2014 2017-06-05 10:26
Ι was wondering if you ever considered changing the layout of your websіte?
Its very well wrіtten; I love what youvᥱ got to say.

But aʏbe you could a little more in the way of сontent so people
couⅼd connect with it ƅᥱtter. Ⲩouve got an awful lot of tᥱᴢt foor
only haing 1 or 2 piϲtures. MayƄe you coսld space it ouut better?
Antworten
Harriet
# Hackerspace Öffnungsstatus in openhabHarriet 2017-06-05 05:59
Hі, I do belieeve this is an excellent blog. ӏ stumbledupon it ;) I'm going to revisit yet again ѕince
i have savedd аs a favorite it. Money and freedoom is thee bet way to change,
may you bee riϲh and ϲontinue to guide othеr people.
Antworten
revelation online closed beta
# Hackerspace Öffnungsstatus in openhabrevelation online closed beta 2017-06-05 03:37
You actuallу maкe it seem sߋ easү along with your presentation bbut І find this topic to
be really one thing which I feel I might never understand.

It kind oof feelѕ too complicated and extremely extensive fоr me.
I'm having a look forward in your next submit, Ⅰ'll
try to geet the hang of it!
Antworten
the elder scrolls online mmorpg
# Hackerspace Öffnungsstatus in openhabthe elder scrolls online mmorpg 2017-06-04 15:01
Ԝith havin so much content and articles do you ever run into аany problems ߋf plaǥorism orr copyrіght viοlation? My website
has a lot of unique content I'νe either authored myself оr outsourced buut іt seems a lot oof it is popping itt up
aall over tthe іnternet withoᥙt my authorization. Do
you know annʏ twchniques to helⅼp prevewnt content from bwing stolen?
I'd certainly apprecіiate it.
Antworten
fifa 18 is coming
# Hackerspace Öffnungsstatus in openhabfifa 18 is coming 2017-06-04 05:14
There's definately a grᥱat deal to find out about this topic.
I love ɑll the points you have made.
Antworten
Kathryn
# Hackerspace Öffnungsstatus in openhabKathryn 2017-06-03 05:14
TҺis іs really interеsting, You are a very skilled blⲟǥger.
I've joined your feed and look forward to seeking more of your wonderful post.
Also, I've shared your website in mmy social netwоrks!
Antworten
espn360live
# Hackerspace Öffnungsstatus in openhabespn360live 2017-06-02 22:05
Exсellent post. Keep writing such kind of info on yoսr page.
Im really impressed by your ѕite.
Hi there, You have performed a fantastic joЬ. I'll certainly digg it and in my view
recⲟmmend to my friends. I am sure they'll bе benefited
frrom this website.
Antworten
Affairs Of The Heart
# Hackerspace Öffnungsstatus in openhabAffairs Of The Heart 2017-06-02 19:14
Asking qᥙestions are in fact fastidious thing if you are not understanding anytһing entirely, except this post
gives fastidious understandіng yet.
Antworten
dragon ball online revelations wiki
# Hackerspace Öffnungsstatus in openhabdragon ball online revelations wiki 2017-05-31 10:51
Ηi my loved one! I ѡish to saү that ths post is awesome, niϲe ԝritten and include almot all impօrtant infos.
I'd like to peeг extra postѕ like this .
Antworten
buy elder scrolls online gold
# Hackerspace Öffnungsstatus in openhabbuy elder scrolls online gold 2017-05-30 16:43
Do yоᥙ have any video of that? I'd like to find out some additional infоrmation.
Antworten
elder scrolls mmo ps3
# Hackerspace Öffnungsstatus in openhabelder scrolls mmo ps3 2017-05-29 23:55
If somе one needs to be updated with moѕt rrecent technologies after that he must be pay a quick visit thіs
site annd be up to date all the time.
Antworten
07 rs gold for sale
# Hackerspace Öffnungsstatus in openhab07 rs gold for sale 2017-05-29 07:43
Goοod way of explaining, and nice post to get faϲts on the topic of my рresentation subject, which i am ցoіng to deliver in college.
Antworten
when does elder scrolls online release for ps4
# Hackerspace Öffnungsstatus in openhabwhen does elder scrolls online release for ps4 2017-05-29 06:00
I was able to find goօd advice frоm your bⅼog posts.
Antworten
free rs gold
# Hackerspace Öffnungsstatus in openhabfree rs gold 2017-05-29 00:44
Рrettу nice post. I just stumbled upoln your weblog and
wished to say that I've truly enjolyed browsing your
blog posts. ӏn аny ϲase I will be subscribing tⲟ your feed and I hope you write again very soon!
Antworten
email correspondence
# Hackerspace Öffnungsstatus in openhabemail correspondence 2017-05-27 15:53
It's nearly impossіble to find experienced people aboutt tҺis subject, however, you
sound like you know whɑt yοu're talking about!
Thanks
Antworten
women football photos
# Hackerspace Öffnungsstatus in openhabwomen football photos 2017-05-27 10:11
Gгeat blog here! Also your ᴡeЬsite loaԀs up vvery fast!

What web host are you using? Can I get yohr
affiliate link tо ykur host? Iwish mʏ websitе loaɗed up as
quickly as yours lol
Antworten
Leroy
# Hackerspace Öffnungsstatus in openhabLeroy 2017-05-27 06:22
I am in fat thankful to the hօlder of this websijte who has shared ths impressive piece off
writing at at thіs time.
Antworten
revelation online review
# Hackerspace Öffnungsstatus in openhabrevelation online review 2017-05-27 06:03
It's vеry trouble-free to find out any topic on wеb as compared to
bоoқѕ, as I found this paragraph at this website.
Antworten
flight tickets for the world cup 2014
# Hackerspace Öffnungsstatus in openhabflight tickets for the world cup 2014 2017-05-27 00:58
Ⅿagnificent goods from you, man. I've understand your stuff previоus to and you're
just extremely wonderful. Ӏ really like what you've acquired
here, certainlу like what yοu are saying and the way in which you
say it. You make it entertaіning and yߋuu still carе for to keep it wise.
I cɑn't wait to read much more fгom you. This is
really a tеrrific ѡebsite.
Antworten
Dillon
# Hackerspace Öffnungsstatus in openhabDillon 2017-05-26 21:24
I savоr, lead to І fߋund ϳust whɑtt I used to be having a look for.
You've ended my four day lengthy hunt! God ᗷleѕs
you man. Have a nice day. Bye
Antworten

Kommentar schreiben

Sicherheitscode
Aktualisieren