haruny / adt-pulse-mqtt

ADT Pulse Bridge for Home Assistant
MIT License
10 stars 5 forks source link

getZoneStatus(via Orb) #40

Closed gary-albano closed 3 years ago

gary-albano commented 3 years ago

Been using this for a long time, and now getting this error, it just dies. not much else I can say, but love this, and like to get it working, I have triggers that use the ADT sensors.

Anything I can do to help, let me know.

1/21/2021, 10:06:58 PM Pulse.Sync: Sync stuck?
1/21/2021, 10:06:59 PM Pulse: Authentication Success
1/21/2021, 10:06:59 PM Pulse: updateAll
1/21/2021, 10:06:59 PM Pulse.getAlarmStatus: Getting Alarm Statuses
1/21/2021, 10:06:59 PM Pulse.Sync: Syncing 2-0-0
1/21/2021, 10:06:59 PM Pulse: updateAll
1/21/2021, 10:06:59 PM Pulse.getAlarmStatus: Getting Alarm Statuses
1/21/2021, 10:06:59 PM: Pushing alarm state: disarmed to home/alarm/state
1/21/2021, 10:06:59 PM Pulse.getDeviceStatus: Getting Device Statuses
1/21/2021, 10:06:59 PM Pulse.getZoneStatus(via Orb): Getting Zone Statuses
1/21/2021, 10:06:59 PM Pulse.getDeviceStatus No other devices found
1/21/2021, 10:06:59 PM Pulse.getDeviceStatus: Getting Device Statuses
1/21/2021, 10:06:59 PM Pulse.getZoneStatus(via Orb): Getting Zone Statuses
/usr/src/app/node_modules/cheerio/lib/parse.js:38
      content.forEach(function (node) {
              ^

TypeError: content.forEach is not a function
    at parse (/usr/src/app/node_modules/cheerio/lib/parse.js:38:15)
    at Function.exports.load (/usr/src/app/node_modules/cheerio/lib/static.js:39:14)
gary-albano commented 3 years ago

I can log into the ADT site, and I can see it trying on the logs from ADT as well

Version
core-2021.1.4
digitalcraig commented 3 years ago

The error occurs in parsing https://portal.adtpulse.com/myhome/20.0.0-244/ajax/orb.jsp. Does that page show all of your sensors? Has anything changed in your environment? Did you upgrade versions of anything?

Are you running as an addon or standalone in docker? Can you post a redacted version of your addon configuration or options.json file?

gary-albano commented 3 years ago

Page renders. shows my sensors. I generally upgrade the core often when ever new patches come out, I am at the current version now. core-2021.1.4 running the addon. Current version: 2.3.0 I think that answers the questions, let me know if I'm missing something, And huge thanks for replying so quickly.

gary-albano commented 3 years ago
ssl: false
certfile: fullchain.pem
keyfile: privkey.pem
pulse_login:
  username: redacted 
  password: redacted 
mqtt_host: redacted 
mqtt_url: ''
mqtt_connect_options:
  username: redacted 
  password: redacted 
alarm_state_topic: home/alarm/state
alarm_command_topic: home/alarm/cmd
zone_state_topic: adt/zone
smartthings_topic: smartthings
smartthings: false
digitalcraig commented 3 years ago

I think I have an idea what's causing the problem. The current version specifies "latest" as the version for cheerio and I think a newer version may have had breaking changes. That's bad practice anyway, so I will get a new release out which requires a specific, working version of cheerio. It should be sometime this weekend once I test it thoroughly.

gary-albano commented 3 years ago

Sounds epic, I can assist if you like some help testing.

digitalcraig commented 3 years ago

Having slept on it, there may be workaround to get you up and running again. If you add my add-on repository and install the add-on from there instead, it should pull in the pre-built docker container with the correct library instead of building it locally. At some point, I think your supervisor re-built the container which pulled in the newer version of cheerio.

gary-albano commented 3 years ago

ok, that does work, I see the in the log, that its getting all the states of the ADT sensors, however now it seems not to be trying to talk to my mqtt. I can see other msg coming into my mqtt, I also purged mqtt, and for grins restarted the VM, double checking other msg are coming after the restart/reboot (I have a bunch of ESP devices bulbs, and sensors)

any thoughts ?

gary-albano commented 3 years ago

I also use a wrong creds for mqtt, thinking I could see an error, but even with a bad user name, I see nothing in the log to point to why its not send the msg to the broker

digitalcraig commented 3 years ago

Are there are my client connection messages in the mqtt log? Like this:

1611269263: New client connected from xxx.xxx.xxx.xxx as mqttjs (p2, c1, k60, u'adt-pulse')

gary-albano commented 3 years ago

1611334871: Socket error on client mosqsub|5102-hauti, disconnecting.

I see other clients connecting, and then I see this,

Nothing from or with adt

digitalcraig commented 3 years ago

I think the socket error means it's connecting, but they aren't talking the same protocol. Make sure mqtt_url is an empty string in the configuration or remove it altogether so that it will use the default of "mqtt://mqtt_host". If you are using a non-standard port or want to use mqtts instead, you can specify it explicitly in mqtt_url.

Other than that, the only other thing I can offer is to add additional logging for mqtt connections in the next release which I'm already working on to add automated unit tests. The latest image on Docker Hub hasn't been updated in 8 months and I've been using it without any issues.

digitalcraig commented 3 years ago

If @haruny will merge the attached pull request, it should resolve the cheerio dependency issue.

haruny commented 3 years ago

Done!