Giter VIP home page Giter VIP logo

Comments (8)

danimtb avatar danimtb commented on August 25, 2024

Try using:

"service": "toggle"

from dasshio.

mavericksv avatar mavericksv commented on August 25, 2024

I am also having this same issue, and I changed it to Toggle as well.

The exact command works in the developer console, but I am getting the error above when it detects my button press.

{
  "name": "Glad",
  "address": "MAC",
  "domain": "light",
  "service": "toggle",
  "service_data": "light.office_strip"

from dasshio.

mavericksv avatar mavericksv commented on August 25, 2024

Just to show it's the same:

2018-08-05 15:28:20,000 | INFO | Request: http://hassio/homeassistant/api/services/light/light.toggle
2018-08-05 15:28:20,001 | ERROR | Unable to perform request: Check [url], [body], [headers] and API password or [domain], [service] and [service_data] format.
Traceback (most recent call last):
File "/dasshio.py", line 56, in arp_display
button["service_data"]), headers={'x-ha-access': os.environ.get('HASSIO_TOKEN')})
File "/usr/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

from dasshio.

danimtb avatar danimtb commented on August 25, 2024

Ok, now I got it.

Service data should be a json formatted string. Like this:

 "service_data": "{\"entity_id\": \"light.room_light\"}"

Please try that and close this issue if that's the solution. Many thanks!

from dasshio.

mavericksv avatar mavericksv commented on August 25, 2024

Hmm, now it is this:

2018-08-05 18:31:33,622 | INFO | Glad button pressed!
2018-08-05 18:31:33,623 | INFO | Request: http://hassio/homeassistant/api/services/light/toggle
2018-08-05 18:31:33,718 | INFO | Status Code: 502
2018-08-05 18:31:33,719 | ERROR | Bad request

{
"timeout": 5,
"buttons": [
{
"name": "Glad",
"address": "MAC",
"domain": "light",
"service": "toggle",
"service_data": "{"xxxxxx09880446f29a832a8xxxxxxxxx": "light.office_strip"}"
}
]
}

from dasshio.

saad1232 avatar saad1232 commented on August 25, 2024

I'm Done with it, Works Just fine now with the following setup

{
  "timeout": 20,
  "buttons": [
    {
      "name": "Cafe",
      "address": "KC:A6:67:96:7B:6A",
      "domain": "switch",
      "service": "toggle",
      "service_data": "{\"entity_id\": \"switch.office_lights\"}"
    }
  ]
}

from dasshio.

mavericksv avatar mavericksv commented on August 25, 2024

Mine still does not work, even with this:

{
  "timeout": 5,
  "buttons": [
    {
      "name": "Glad",
      "address": "MAC",
      "domain": "light",
      "service": "toggle",
      "service_data": "{\"entity_id\": \"light.office_strip\"}"
    }
  ]
}

from dasshio.

danimtb avatar danimtb commented on August 25, 2024

@mavericksv please check your configuration. @saad1232 reported it just worked.

Make sure you scape the quote symbols in service_data like this: \"

https://github.com/danimtb/dasshio#options-example-domain-service-service_data

from dasshio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.