├── official_api ├── curl │ ├── smart_meter_texas.netrc │ ├── on_demand_read.sh │ ├── on_demand_request.sh │ └── daily.sh ├── home-assistant │ ├── smart_meter_texas.netrc │ ├── sensor_on_demand.yaml │ ├── sensor_daily.yaml │ └── secret.yaml └── node-red │ └── reddit-example.json ├── unofficial_api ├── curl_1_web_auth.sh ├── curl_2_web_read_req.sh └── curl_3_web_read_value.sh ├── LICENSE └── README.md /official_api/curl/smart_meter_texas.netrc: -------------------------------------------------------------------------------- 1 | machine services.smartmetertexas.net 2 | login YOUR_USER_ID_GOES_HERE 3 | password YOUR_PASSWORD_GOES_HERE 4 | -------------------------------------------------------------------------------- /official_api/home-assistant/smart_meter_texas.netrc: -------------------------------------------------------------------------------- 1 | machine services.smartmetertexas.net 2 | login YOUR_USER_ID_GOES_HERE 3 | password YOUR_PASSWORD_GOES_HERE 4 | -------------------------------------------------------------------------------- /unofficial_api/curl_1_web_auth.sh: -------------------------------------------------------------------------------- 1 | # 2 | # update below with your smartmetertexas.com username and password 3 | # 4 | # Just execute this script once per hour or two to retreive a token, which 5 | # can then be used to request a meter read 6 | # 7 | # 8 | curl 'https://smartmetertexas.com/api/user/authenticate' \ 9 | --header 'Content-Type: application/json' \ 10 | --header "Accept:application/json" \ 11 | --insecure \ 12 | --data ' { "rememberMe": "true", "username" : "YOUR_LOGIN_USERNAME_GOES_HERE", "password" : "YOUR_LOGIN_PASSWORD_GOES_HERE" } ' 13 | 14 | # 15 | # typical JSON response from smart meter texas: 16 | # 17 | # {"usr_id":"YOUR_USERNAME","is_rgstrd":"Y","usr_type":"RES","usr_frst_nm":"YOUR_FIRST_NAME_WILL_APPEAR_HERE","usr_lst_nm":"YOUR_LAST_NAME_APPEARS_HERE","usr_eml":"YOUR_EMAIL@.COM","lang_pref":"en","ai":"N","smtStatus":"active","smtStatuskey":"SMTPR_smtStatus","token":"THIS_IS_LONG_TOKEN"} 18 | -------------------------------------------------------------------------------- /unofficial_api/curl_2_web_read_req.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Pre-configure below with at least your ESIID (or alter script to pull it from the command line) 3 | # 4 | # MeterNumber is NOT required, nor is it checked (you can enter a bogus number), at least 5 | # if you only have one meter. Unknown if it helps when you have multiple meters 6 | # 7 | # Usage: 8 | # 2_web_read_req 9 | # 10 | # 11 | curl 'https://smartmetertexas.com/api/ondemandread' \ 12 | --insecure \ 13 | --header 'Content-Type: application/json' \ 14 | --header "Accept:application/json" \ 15 | --header "Authorization: Bearer $1" \ 16 | --data ' { "ESIID": "PUT_YOUR_ESIID_RIGHT_HERE", "MeterNumber": "OPTIONALLY_PUT_YOUR_METER_NUMBER_HERE" } ' 17 | 18 | # 19 | # Typical response from smart meter texas: 20 | # 21 | # {"data":{"trans_id":"3","correlationId":"666666","statusCode":"0","statusReason":"Request submitted successfully for further processing"}} 22 | -------------------------------------------------------------------------------- /unofficial_api/curl_3_web_read_value.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Pre-configure below with at least your ESIID 3 | # MeterNumber is NOT required, nor is it checked (you can enter a bogus number), at least 4 | # if you only have one meter. Unknown if it helps when you have multiple meters 5 | # 6 | # Usage: 7 | # 3_web_read_value 8 | # 9 | # 10 | # 11 | curl 'https://smartmetertexas.com/api/usage/latestodrread' \ 12 | --insecure \ 13 | --header "Accept:application/json" \ 14 | --header "Content-Type: application/json" \ 15 | --header "Authorization: Bearer $1" \ 16 | --data ' { "ESIID" : "YOUR_ESIID_GOES_HERE", 17 | "MeterNumber": "OPTIONAL_METER_NUMBER_GOES_HERE" } ' 18 | 19 | # 20 | # Example response: 21 | # 22 | # {"data":{"odrstatus":"COMPLETED","odrread":"12345.789","odrusage":"55.555","odrdate":"05/16/2020 16:08:23","responseMessage":"SUCCESS"}} 23 | # 24 | # or if it isn't ready yet: 25 | # {"data":{"odrstatus":"PENDING","odrread":"0","odrusage":"0","odrdate":"05/16/2020 17:16:40","responseMessage":"SUCCESS"}} 26 | -------------------------------------------------------------------------------- /official_api/curl/on_demand_read.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This is step 2. Take the CorrelationID from step 1 and put it below 3 | # 4 | # Update requestorID below. 5 | # 6 | curl 'https://services.smartmetertexas.net/odrstatus/' \ 7 | --netrc-file smart_meter_texas.netrc \ 8 | --header "Accept:application/json" \ 9 | --key ".cloud/remote_private.pem" \ 10 | --cert ".cloud/remote_fullchain.pem" \ 11 | --insecure \ 12 | --data ' { 13 | "SMTTermsandConditions":"Y", 14 | "requestorID" :"YOUR_USER_ID_GOES_HERE", 15 | "trans_id" :"124", 16 | "reportFormat" :"JSON", 17 | "deliveryMode" :"API", 18 | "correlationId":"123456" 19 | } ' 20 | 21 | # 22 | # Example response if this is done very quickly after step 1: 23 | # 24 | # {"trans_id":"124","correlationId":"123456","statusCode":"PEN","statusReason":"Request Submitted by API","odrRead":{"registeredRead":0E+0,"readDate":"04\/04\/2020 21:25:34"}} 25 | # 26 | # 27 | # and later: 28 | # 29 | # {"trans_id":"124","correlationId":"123456","statusCode":"0","statusReason":"ODR retreived successfully","odrRead":{"registeredRead":2.3459133E+4,"readDate":"04\/04\/2020 21:26:41"}} 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Marc Randolph 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /official_api/curl/on_demand_request.sh: -------------------------------------------------------------------------------- 1 | # 2 | # This is step 1 for making an "On demand" meter read request from Smart Meter Texas 3 | # 4 | # It's a waste to do this more than twice an hour 5 | # 6 | # This uses smart_meter_texas.netrc file for a little bit of security rather 7 | # than putting the account password on the command line for other users to see 8 | # 9 | # Update requestorID and ESIID in this file, and the login and password in the netrc fle 10 | # 11 | # original source: https://github.com/mrand/smart_meter_texas/ 12 | # 13 | curl 'https://services.smartmetertexas.net/odr/' \ 14 | --netrc-file smart_meter_texas.netrc \ 15 | --header "Accept:application/json" \ 16 | --key ".cloud/remote_private.pem" \ 17 | --cert ".cloud/remote_fullchain.pem" \ 18 | --insecure \ 19 | --data ' { 20 | "SMTTermsandConditions": "Y", 21 | "trans_id" : "123", 22 | "requesterType": "RES", 23 | "reportFormat" : "JSON", 24 | "deliveryMode" : "API", 25 | "requestorID" : "YOUR_USER_ID_GOES_HERE", 26 | "ESIID" : "10222222222222201" 27 | } ' 28 | 29 | # successful call returns this: 30 | # 31 | # {"trans_id":"123","correlationId":"123456","statusCode":"0","statusReason":"Request submitted successfully for further processing"} 32 | # 33 | # 34 | # For step 2, use the correlationID from this result to make a read request after waiting a minute 35 | -------------------------------------------------------------------------------- /official_api/curl/daily.sh: -------------------------------------------------------------------------------- 1 | # Daily usage example from https://github.com/mrand/smart_meter_texas/ 2 | # 3 | # Update requestorID and ESIID in this file, and the login and password in the netrc fle 4 | # 5 | # Today's energy won't be available until tomorrow, late afternoon / early evening 6 | # 7 | # other options to consider adding if it doesn't work for you: --tlsv1.2 8 | # 9 | curl 'https://services.smartmetertexas.net/dailyreads/' \ 10 | --netrc-file smart_meter_texas.netrc \ 11 | --header "Accept:application/json" \ 12 | --key ".cloud/remote_private.pem" \ 13 | --cert ".cloud/remote_fullchain.pem" \ 14 | --insecure \ 15 | --data ' { 16 | "reportFormat" : "JSON", 17 | "SMTTermsandConditions": "Y", 18 | "version" : "L", 19 | "trans_id" : "123", 20 | "startDate" : "04/27/2020", 21 | "endDate" : "04/27/2020", 22 | "requesterType": "RES", 23 | "readingType" : "c", 24 | "requestorID" : "YOUR_USER_ID_GOES_HERE", 25 | "esiid" : [ "12345678901234" ] 26 | } ' 27 | 28 | 29 | 30 | #### 31 | # Reply example 32 | #### 33 | # 34 | # Reading at 8am on morning of 04/23/2020 only provides data from two days ago: 35 | # 36 | # {"trans_id":"123","esiid":"107008271234098","registeredReads":[{"readDate":"04\/21\/2020","revisionDate":"04\/22\/2020 07:41:22","startReading":"24002.915","endReading":"24038.915","energyDataKwh":"36.492"}]} 37 | # 38 | # 39 | # This is the response when requesting yesterday's data before it's available 40 | # 41 | # {"errorCode":"1","errorMessage":"No data received from the respective TDSP"} 42 | -------------------------------------------------------------------------------- /official_api/home-assistant/sensor_on_demand.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Smart Meter Texas 2.0 for Home Assistant using command_line sensor with cURL 3 | # 4 | # Originally from https://github.com/mrand/smart_meter_texas/ 5 | # 6 | # Step 1: submit an on-demand request to SMT. This returns a correlationId, which is used in step 2 7 | # 8 | - platform: command_line 9 | name: Smart Meter Request 10 | value_template: '{{ value_json.correlationId }}' 11 | json_attributes: # These are not strictly necessary. Could be useful for status and/or debug 12 | - statusReason 13 | - statusCode 14 | - trans_id 15 | - errorMessage 16 | scan_interval: 3600 # SMT blocks request any faster/lower than 1800 (twice an hour). 17 | command: !secret smart_meter_curl_request 18 | # 19 | # 20 | # Step 2: use the correlationId provided above to read the results of the above request. 21 | # Usually isn't immediately available after step 1... might take a minute or more. 22 | # 23 | # Note: at HA bootup, the below sensor might return and error about invalid correlationId 24 | # because the correlationId sensor above hasn't been initalized yet. 25 | # It always seems to quickly resolve itself. 26 | # 27 | # value_template: '{{ value_json.smart_meter_read_json.odrRead }}' 28 | - platform: command_line 29 | name: Smart Meter Read 30 | unit_of_measurement: kWh 31 | value_template: '{{ value_json.odrRead.registeredRead }}' 32 | json_attributes: # These are not strictly necessary. Could be useful for status and/or debug 33 | - correlationId # This is the correlationId returned by this status read. Should match the Id from sensor.smar 34 | t_meter_request 35 | - statusReason 36 | - statusCode 37 | - errorMessage 38 | - odrRead 39 | scan_interval: 900 # Much lower doesn't make sense since we can only read once every 30 minutes 40 | command: !secret smart_meter_curl_read 41 | -------------------------------------------------------------------------------- /official_api/home-assistant/sensor_daily.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Originally from https://github.com/mrand/smart_meter_texas/ 3 | # 4 | # Retrieve yesterday's meter read (or daily consumption) from Smart Meter Texas 2.0 5 | # 6 | # 7 | # Since yesterday's reading isn't available until late afternoon / early evening today, 8 | # here are the ways to deal with that: 9 | # 10 | # Option 1: always launch your HA instance after 5pm and set scan_interval for 24 hours (note: first reading on HA launch might be N/A) 11 | # Option 2: use automation to pull your data later in the day 12 | # Option 3: avoid situation completely by pulling the data from two days ago rather than yesterday 13 | # 14 | # 15 | # Following sensor is used to get yesterday's date and force proper formatting for SMT call 16 | # 17 | - platform: template 18 | sensors: 19 | yesterday_usa: 20 | value_template: > 21 | {% set ct = states('sensor.date_time') %} 22 | {% set ct = as_timestamp(strptime(ct,'%Y-%m-%d, %H:%M')) %} 23 | {% set ct = ct - 60*60*24 %} 24 | {{ ct | timestamp_custom("%m/%d/%Y") }} 25 | # 26 | # NOTE: at HA bootup, the below sensor can return "Invalid Date. Expected format of: startDate is MM/dd/yyyy" 27 | # because the above sensor hasn't been initalized yet. It always seems to resolve itself. 28 | # 29 | - platform: command_line 30 | name: Smart Meter Daily 31 | value_template: '{{ value_json.registeredReads[0].endReading }}' # yesterday's meter read 32 | # value_template: '{{ value_json.registeredReads[0].energyDataKwh }}' # yesterday's consumption 33 | json_attributes: # These are not strictly necessary. Useful for status and/or debug 34 | - statusReason 35 | - statusCode 36 | - trans_id 37 | - errorMessage 38 | - errorCode 39 | - registeredReads 40 | scan_interval: 16777216 # Just a random big number (6.47 months) when using an automation to scan (see below) 41 | command: !secret smart_meter_curl_daily 42 | # 43 | # example automation (copy to automation.yaml, or enter via Home Assistant GUI) 44 | # 45 | # Retrieve daily power number from official Smart Meter Texas (SMT) API 46 | #- alias: 'Daily Power' 47 | # trigger: 48 | # - platform: time 49 | # at: '17:17:17' # Arbitrary time later in the day. Right before midnight might be best to allow for late evening reboots 50 | # action: 51 | # - service: homeassistant.update_entity 52 | # entity_id: sensor.smart_meter_daily 53 | 54 | -------------------------------------------------------------------------------- /official_api/home-assistant/secret.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # SECURITY NOTE: --netrc-file line could be replaced with --user username:password, HOWEVER this exposes 3 | # both on the command line, which might be seen by other users. 4 | # Therefore recommend putting Your SMT password in the smart_meter.netrc file. 5 | # Just like secrets.yaml, smart_meter.netrc should be .ignored and not uploaded to public/open locations like github 6 | # 7 | # Random stuff: 8 | # lines above Terms and conditions line may not be required, but keeping on the assumption it could help guarantee 9 | # JSON responses forever more. 10 | # 11 | # originally from https://github.com/mrand/smart_meter_texas 12 | # 13 | # other options to consider adding if stops working: --tlsv1.2 14 | # 15 | smart_meter_curl_request: >- 16 | curl 'https://services.smartmetertexas.net/odr/' 17 | --netrc-file smart_meter_texas.netrc 18 | --header "Accept:application/json" 19 | --key ".cloud/remote_private.pem" 20 | --cert ".cloud/remote_fullchain.pem" 21 | --data ' { 22 | "reportFormat" :"JSON", 23 | "deliveryMode" :"API", 24 | "SMTTermsandConditions":"Y", 25 | "requesterType":"RES", 26 | "trans_id" :"123", 27 | "requestorID" :"YOUR_USER_ID_GOES_HERE", 28 | "ESIID" :"YOUR_ESIID_GOES_HERE" 29 | } ' 30 | --insecure 31 | # 32 | # For reasons I don't yet understand, when using a template (like below in the last entry), 33 | # HA will strip off the single quote (notice it's fine in the above call). 34 | # Escaping the single quote works, but in so doing, now HA strips all the double quotes... so 35 | # they have to be escaped also. Never would have figured that out without turning on debug logs 36 | # 37 | smart_meter_curl_read: >- 38 | /usr/bin/curl https://services.smartmetertexas.net/odrstatus/ 39 | --netrc-file smart_meter_texas.netrc 40 | --header Accept:application/json 41 | --key .cloud/remote_private.pem 42 | --cert .cloud/remote_fullchain.pem 43 | --data \' { 44 | \"reportFormat\" :\"JSON\", 45 | \"deliveryMode\" :\"API\", 46 | \"requesterType\":\"RES\", 47 | \"SMTTermsandConditions\":\"Y\", 48 | \"trans_id\" :\"123\", 49 | \"requestorID\" :\"YOUR_USER_ID_GOES_HERE\", 50 | \"correlationId\":\"{{ states("sensor.smart_meter_request") }} \" 51 | } \' 52 | --insecure 53 | 54 | # 55 | # Example of retreiving daily meter and usage 56 | # 57 | # Not dependant on the above example. You could either use the above two, or this one below... or both. 58 | # It is dependent on a custom sensor called yesterday_usa 59 | # 60 | smart_meter_curl_daily: >- 61 | /usr/bin/curl https://services.smartmetertexas.net/dailyreads/ 62 | --netrc-file smart_meter.netrc 63 | --header Accept:application/json 64 | --key .cloud/remote_private.pem 65 | --cert ./remote_fullchain.pem 66 | --data \' { 67 | \"reportFormat\" :\"JSON\", 68 | \"readingType\" :\"c\", 69 | \"SMTTermsandConditions\":\"Y\", 70 | \"version\" :\"L\", 71 | \"requesterType\":\"RES\", 72 | \"trans_id\" :\"123\", 73 | \"startDate\" :\"{{ states("sensor.yesterday_usa") }}\", 74 | \"endDate\" :\"{{ states("sensor.yesterday_usa") }}\", 75 | \"requestorID\" :\"YOUR_USER_ID_GOES_HERE\", 76 | \"esiid\" :[\"YOUR_ESIID_GOES_HERE\"] 77 | } \' 78 | --insecure 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SmartMeterTexas Index 2 | In December 2019, Smart Meter Texas (SMT) introduced their "2.0" with marginally improved API. It's still not a smooth process, but doable. 3 | 4 | 0. Get your ESIID from your Electric bill 5 | 1. Create a userID at https://smartmetertexas.com 6 | 2. Pick an API process 7 | 3. Pick an access method 8 | 9 | ## Pick an API process 10 | 11 | ### "Official" API process 12 | 13 | Despite wording impling otherwise, given the complexity required and manual steps, it's obvious this is not really set up with everyday residential users in mind. Instead, I suspect this is more geared towards companies which would then provide the data to end users. Make no mistake, residential users are allowed - it's just the steps aren't user friendly: 14 | 15 | * Have a public / private SSL certificate. You can use Let's Encrypt to generate one, or use an existing one (I re-used my Nabu Casa / Home Assistant certificate, which is based on Let's Encrypt) 16 | * Determine your public IP address of your router by visiting https://whatismyipaddress.com/ from the network that you will be accessing the API from 17 | * Send an email to support@smartmetertexas.com with your public IP address, ESIID, userID, and public certificate 18 | * Wait a number of days for the outsourced overseas IBM employees to respond 19 | * When they say go, you should be able to use the official API. As if we need more proof how silly this process is, they will email you an outdated interface guide in response. You can find the latest here https://www.smartmetertexas.com/Smart_Meter_Texas_Interface_Guide.pdf or with all their other documentation: https://smartmetertexas.com/quickrefguides 20 | 21 | As a bonus, if you're using generating a cert from Let's Encrypt or others, you have to re-contact them every 3 months to update it. Oh, and yes, your IP address might change some day, at which point you might need to email support again to update the IP. Or maybe by then, they won't care about the IP address. I tried to get support to use a domain name and they would not. 22 | 23 | ### Unofficial API process 24 | 25 | Use login tokens instead. No waiting. No SSL certificate. 26 | First documented here: https://github.com/keatontaylor/smartmetertexas-api/ and on that repo's wiki 27 | 28 | 29 | ## Pick access method 30 | 31 | First off, whatever method you use, **PLEASE** make sure not to poll for results faster than every 900 seconds / 15 minutes. Some programs might default polling to every 10 seconds. There is no reason to, and enterprises entities might start taking notice and add additional restrictions when polling rates are so high. 32 | 33 | ### Shell script calling Curl 34 | * See the Curl examples in this repo 35 | 36 | ### Python 37 | * https://github.com/cmulk/python_smartmetertx 38 | * unofficial api: https://github.com/grahamwetzler/smart-meter-texas 39 | * unofficial api: https://github.com/thejcannon/strickland-cannon-coop-src/blob/master/backend/strickland_cannon_coop/scripts/electricity.py 40 | * unofficial api: https://github.com/BrittanyMcNeal/Electricity-Usage-and-Automation (based on https://github.com/ankitkchoudhary/electricity-usage-monitoring) 41 | 42 | ### Home Assistant integration 43 | * Someone has been kind enough to create an integration, available starting in 0.115: https://rc.home-assistant.io/integrations/smart_meter_texas 44 | ** Unfortunately, it doesn't work reliably due to authentication errors 45 | 46 | ### Home Assistant using Curl 47 | * official api: see the Curl examples in this repo 48 | * unofficial api: due to the token usage, probably easier to just use python 49 | 50 | ### Home Assistant using python 51 | * unofficial api, running in a Docker Container: https://github.com/scadaguru/pysmtreader 52 | 53 | ### Node_RED 54 | * unofficial api: https://github.com/stmrocket/ha-smartmetertexas 55 | * official api: https://old.reddit.com/r/homeassistant/comments/ep3pki/texas_smart_meteroncor_users_api_work/ (older; and I've archived the node-red code here) 56 | * official api: https://github.com/johnavich/SMT-NodeRed-Official (as of 2023) 57 | 58 | ### Web scraping 59 | Examples: 60 | * https://github.com/vaj4088/ElectricityUsagePredictor5 61 | -------------------------------------------------------------------------------- /official_api/node-red/reddit-example.json: -------------------------------------------------------------------------------- 1 | [{"id":"945e4cfe.55a17","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"fdb1c37.924d44","type":"http request","z":"945e4cfe.55a17","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"https://services.smartmetertexas.net/15minintervalreads/","tls":"d00befa0.a5484","persist":false,"proxy":"","authType":"basic","x":770,"y":440,"wires":[["431802ff.e777ac"]]},{"id":"19a8eeed.5ca7b1","type":"inject","z":"945e4cfe.55a17","name":"","topic":"","payload":"","payloadType":"date","repeat":"900","crontab":"","once":true,"onceDelay":0.1,"x":190,"y":520,"wires":[["af69ea1b.18cbd8","9b00709f.50317","e3b5a0d5.e1b5c","21c7d833.2d4aa8","f04cd672.5b3a28"]]},{"id":"9106210f.5aabb","type":"debug","z":"945e4cfe.55a17","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1650,"y":480,"wires":[]},{"id":"3c7d5b6a.6b2494","type":"template","z":"945e4cfe.55a17","name":"page","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"","output":"json","x":610,"y":360,"wires":[[]]},{"id":"c06dfada.6d3e18","type":"template","z":"945e4cfe.55a17","name":"page","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n\"trans_id\": \"111\", \"requestorID\": \"loginname\", \"requesterType\": \"RES\", \"startDate\": \"{{{payload.1}}}\", \"endDate\": \"{{{payload.0}}}\",\n\"version\": \"L\", \"readingType\": \"c\", \"esiid\": [\n\"ESIID\" ],\n\"SMTTermsandConditions\": \"Y\" }\n","output":"json","x":610,"y":240,"wires":[["7b1c6868.6aac38"]]},{"id":"9070c4d9.2fc5d8","type":"template","z":"945e4cfe.55a17","name":"page","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{ \"trans_id\": \"123\",\"requestorID\": \"loginanme\", \"requesterType\": \"RES\",\"startDate\": \"{{{payload.1}}}\",\"endDate\": \"{{{payload.0}}}\", \"reportFormat\": \"JSON\",\"version\": \"L\",\"readingType\": \"C\",\"esiid\": [ \"ESSID\" ], \"SMTTermsandConditions\": \"Y\" } ","output":"json","x":590,"y":500,"wires":[["fdb1c37.924d44","a89089f1.72af28"]]},{"id":"a89089f1.72af28","type":"http request","z":"945e4cfe.55a17","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"https://services.smartmetertexas.net/dailyreads/","tls":"d00befa0.a5484","persist":false,"proxy":"","authType":"basic","x":770,"y":520,"wires":[["d911c988.070998"]]},{"id":"21c7d833.2d4aa8","type":"moment","z":"945e4cfe.55a17","name":"yesterday","topic":"","input":"","inputType":"msg","inTz":"America/Chicago","adjAmount":"2","adjType":"days","adjDir":"subtract","format":"MM/DD/YYYY","locale":"C","output":"","outputType":"msg","outTz":"America/Chicago","x":260,"y":360,"wires":[["8b1ea893.4e4438"]]},{"id":"e3b5a0d5.e1b5c","type":"moment","z":"945e4cfe.55a17","name":"today","topic":"","input":"","inputType":"msg","inTz":"America/Chicago","adjAmount":"0","adjType":"days","adjDir":"add","format":"MM/DD/YYYY","locale":"C","output":"payload","outputType":"msg","outTz":"America/Chicago","x":270,"y":300,"wires":[["8b1ea893.4e4438"]]},{"id":"8b1ea893.4e4438","type":"join","z":"945e4cfe.55a17","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":450,"y":360,"wires":[["9070c4d9.2fc5d8"]]},{"id":"d911c988.070998","type":"change","z":"945e4cfe.55a17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.registeredReads[0].energyDataKwh","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":620,"wires":[["1ca2662b.1186ba"]]},{"id":"7b1c6868.6aac38","type":"http request","z":"945e4cfe.55a17","name":"","method":"POST","ret":"obj","paytoqs":false,"url":"https://services.smartmetertexas.net/monthlybillingInformation/","tls":"d00befa0.a5484","persist":false,"proxy":"","authType":"basic","x":770,"y":320,"wires":[["2ee58b0d.cae6e4"]]},{"id":"af69ea1b.18cbd8","type":"moment","z":"945e4cfe.55a17","name":"this month","topic":"","input":"","inputType":"msg","inTz":"America/Chicago","adjAmount":"0","adjType":"days","adjDir":"add","format":"MM/01/YYYY","locale":"C","output":"","outputType":"msg","outTz":"America/Chicago","x":290,"y":180,"wires":[["baf1e91d.75e128"]]},{"id":"9b00709f.50317","type":"moment","z":"945e4cfe.55a17","name":"last month","topic":"","input":"","inputType":"msg","inTz":"America/Chicago","adjAmount":"1","adjType":"months","adjDir":"subtract","format":"MM/01/YYYY","locale":"C","output":"","outputType":"msg","outTz":"America/Chicago","x":290,"y":240,"wires":[["baf1e91d.75e128"]]},{"id":"baf1e91d.75e128","type":"join","z":"945e4cfe.55a17","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"payload","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":470,"y":260,"wires":[["c06dfada.6d3e18"]]},{"id":"2ee58b0d.cae6e4","type":"change","z":"945e4cfe.55a17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.billingData[0].actualkWh","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":360,"wires":[["c8c9c929.fb1238"]]},{"id":"431802ff.e777ac","type":"change","z":"945e4cfe.55a17","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.energyData[0].RD","tot":"msg"},{"t":"change","p":"payload","pt":"msg","from":"-A","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":420,"wires":[["eb9a165d.62c578"]]},{"id":"eb9a165d.62c578","type":"split","z":"945e4cfe.55a17","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1130,"y":480,"wires":[["cb50a94e.144f98"]]},{"id":"cb50a94e.144f98","type":"buffer-array","z":"945e4cfe.55a17","name":"","bufferLen":"1","startWhenFilled":true,"x":1050,"y":540,"wires":[["18dd443.8d682bc"]]},{"id":"18dd443.8d682bc","type":"timeframerlt","z":"945e4cfe.55a17","name":"","throttleType":"reset","timeLimit":"1","timeLimitType":"milliseconds","countLimit":"3","byresetcountLimit":"1","x":1250,"y":720,"wires":[["a4294b7f.da5d58"]]},{"id":"1a1bd1a2.7377ae","type":"function","z":"945e4cfe.55a17","name":"","func":"msg.payload='{\"Current\": \"'+msg.payload+'\"}';\nreturn msg;","outputs":1,"noerr":0,"x":1430,"y":660,"wires":[["203c7d4c.ce5382"]]},{"id":"a4294b7f.da5d58","type":"switch","z":"945e4cfe.55a17","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"cont","v":".","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1330,"y":580,"wires":[[],["1a1bd1a2.7377ae"]]},{"id":"65189db6.ef9814","type":"debug","z":"945e4cfe.55a17","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":700,"wires":[]},{"id":"ac71ecda.d4433","type":"inject","z":"945e4cfe.55a17","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":740,"wires":[["21c7d833.2d4aa8","e3b5a0d5.e1b5c"]]},{"id":"f04cd672.5b3a28","type":"change","z":"945e4cfe.55a17","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":600,"wires":[["18dd443.8d682bc"]]},{"id":"c8c9c929.fb1238","type":"mqtt out","z":"945e4cfe.55a17","name":"","topic":"","qos":"","retain":"","broker":"fc746857.99d0f8","x":1380,"y":380,"wires":[]},{"id":"203c7d4c.ce5382","type":"mqtt out","z":"945e4cfe.55a17","name":"","topic":"","qos":"","retain":"","broker":"fc746857.99d0f8","x":1470,"y":540,"wires":[]},{"id":"1ca2662b.1186ba","type":"mqtt out","z":"945e4cfe.55a17","name":"","topic":"","qos":"","retain":"","broker":"fc746857.99d0f8","x":1410,"y":860,"wires":[]},{"id":"d00befa0.a5484","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false},{"id":"fc746857.99d0f8","type":"mqtt-broker","z":"","name":"","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}] 2 | --------------------------------------------------------------------------------