element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Forget Me Not Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Forget Me Not Design Challenge
  • More
  • Cancel
Forget Me Not Design Challenge
Blog Don't forget the windows 04 - REST can be easy
  • Blog
  • Forum
  • Documents
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: hlipka
  • Date Created: 30 Aug 2014 10:36 PM Date Created
  • Views 943 views
  • Likes 1 like
  • Comments 6 comments
  • forget_me_not
  • more_intelligent_home
Related
Recommended

Don't forget the windows 04 - REST can be easy

hlipka
hlipka
30 Aug 2014

OK, so I spend the last two days communicating with the OpenHAB REST API in much more depth than I wanted to. But at last I can report success. For now I'm able to have a test client listening to ther rocker switch button, without dropping any events or losing the connection.

Next step is extending this test client into a small library being able to handle all sensor types and the sitemap / home page.

Using the Apache HttpCore library means that my code can run on Android too since its part of the platform.image

The bug with OpenHAB sending each message three times still persists. May it gets better when I query the home page instead...

  • Sign in to reply
  • hlipka
    hlipka over 11 years ago in reply to electronichamsters

    Yes and no. This code (when refined further and maybe made into a nice library) will allow you to get at the data OpenHAB provides via the REST API. But it won't do more than that (so the house-drawing part is something you need to do by yourself...)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • electronichamsters
    electronichamsters over 11 years ago

    Hendrik,

    This is pretty cool.  Is it possible to use what you've put together to start talking with OpenHAB via the REST API to create custom dashboards?  Let's say you want a graphic of your house, showing all the window and door status, lights, etc.  Can you use this API to make a nice dynamic graphic?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • hlipka
    hlipka over 11 years ago in reply to mcb1

    I guess I would need to run OpenHAB under a Java debugger to find out whats happening there. Is this of interest to somebody here (running the debugger)?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 11 years ago in reply to hlipka
    rocker switch sends its state two times      yet OpenHAB sends it out three times...

    That is strange indeed.

     

    The solution will be a eureka moment .... good luck.

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • hlipka
    hlipka over 11 years ago in reply to mcb1

    Thats only half of the solution. According to events.log, the rocker switch sends its state two times (probably to ensure delivery), yet OpenHAB sends it out three times...

    But OTOH, I don't really need to care. As long as I don't miss any events, getting them multiple times does no damage.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube